diff options
Diffstat (limited to 'src/components/TimerView.tsx')
| -rw-r--r-- | src/components/TimerView.tsx | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/components/TimerView.tsx b/src/components/TimerView.tsx index 896c03a..b43973c 100644 --- a/src/components/TimerView.tsx +++ b/src/components/TimerView.tsx @@ -54,6 +54,7 @@ export function TimerView() { const { phase, remainingSecs, totalSecs, running, sessionCount, currentTaskId } = useTimerStore(); const tasks = useTaskStore((s) => s.tasks); + const syncFromBackend = useTimerStore((s) => s.syncFromBackend); const currentTask = tasks.find((t) => t.id === currentTaskId) ?? null; @@ -61,10 +62,22 @@ export function TimerView() { const dashOffset = CIRCUMFERENCE * (1 - progress); const arcColor = phaseColor(phase); - const handleStart = () => invoke('start_timer'); - const handlePause = () => invoke('pause_timer'); - const handleSkip = () => invoke('skip_phase'); - const handleReset = () => invoke('reset_timer'); + const handleStart = async () => { + await invoke('start_timer'); + await syncFromBackend(); + }; + const handlePause = async () => { + await invoke('pause_timer'); + await syncFromBackend(); + }; + const handleSkip = async () => { + await invoke('skip_phase'); + await syncFromBackend(); + }; + const handleReset = async () => { + await invoke('reset_timer'); + await syncFromBackend(); + }; return ( <div @@ -200,7 +213,7 @@ function GhostButton({ onClick, children, }: { - onClick: () => void; + onClick: () => Promise<void>; children: React.ReactNode; }) { return ( |
