Skip to content

Commit

Permalink
고양이 클릭시 메세지가 랜덤으로 나오도록 수정 (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
haryung-lee authored Oct 22, 2024
1 parent f1ee15f commit 887bc00
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/renderer/widgets/pomodoro/ui/home-screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,14 @@ export const HomeScreen = ({
const [tooltipMessage, setTooltipMessage] = useState('');

useEffect(() => {
showRandomMessage();
}, [user?.cat?.type]);

const showRandomMessage = () => {
const messages = getTooltipMessages(user?.cat?.type);
const randomIndex = Math.floor(Math.random() * messages.length);
setTooltipMessage(messages[randomIndex]);
}, [user?.cat?.type]);
};

return (
<>
Expand All @@ -94,6 +98,7 @@ export const HomeScreen = ({
<RiveComponent
className="h-[240px] w-full cursor-pointer select-none"
onClick={() => {
showRandomMessage();
clickCatInput?.fire();
}}
/>
Expand Down

0 comments on commit 887bc00

Please sign in to comment.