diff options
| author | RanXom <saiyedshizain@gmail.com> | 2026-06-13 20:35:30 +0530 |
|---|---|---|
| committer | RanXom <saiyedshizain@gmail.com> | 2026-06-13 20:35:30 +0530 |
| commit | c82b965cf29d4e793f0196d98b1d44f03f4f14da (patch) | |
| tree | 015542da526aca70bb0585f3914308002fb42b73 /desktop/src/hooks | |
| parent | f198550ea7ea25c527e92ae5c6c221b3b1deb413 (diff) | |
| download | pomoru-c82b965cf29d4e793f0196d98b1d44f03f4f14da.tar.xz pomoru-c82b965cf29d4e793f0196d98b1d44f03f4f14da.zip | |
add sounds for timer and increase timer size
update readme
Diffstat (limited to 'desktop/src/hooks')
| -rw-r--r-- | desktop/src/hooks/useTimer.ts | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/desktop/src/hooks/useTimer.ts b/desktop/src/hooks/useTimer.ts index 408a6b0..06fa720 100644 --- a/desktop/src/hooks/useTimer.ts +++ b/desktop/src/hooks/useTimer.ts @@ -1,5 +1,6 @@ import { useState, useEffect, useRef, useCallback } from "react"; import { commands, type TimerState, type TickResult } from "../lib/commands"; +import { playWorkDoneSound, playBreakDoneSound } from "../lib/sounds"; export function useTimer() { const [timer, setTimer] = useState<TimerState | null>(null); @@ -15,6 +16,15 @@ export function useTimer() { if (timer?.is_running) { intervalRef.current = setInterval(async () => { const result: TickResult = await commands.tick(); + + if (result.event) { + if (result.timer.mode === "work") { + playBreakDoneSound(); // Break finished, wake up for work + } else { + playWorkDoneSound(); // Work finished, relax for break + } + } + setTimer(result.timer); }, 1000); } else { |