From d42eb25f7be64b5e77cd0bacd1538949d331aff7 Mon Sep 17 00:00:00 2001 From: MAZE Date: Sat, 31 Aug 2024 20:43:22 +0330 Subject: [PATCH] fix: disable the sleep timer when no sound is selected --- src/components/modals/sleep-timer/sleep-timer.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/modals/sleep-timer/sleep-timer.tsx b/src/components/modals/sleep-timer/sleep-timer.tsx index 0944b7d..83dd82b 100644 --- a/src/components/modals/sleep-timer/sleep-timer.tsx +++ b/src/components/modals/sleep-timer/sleep-timer.tsx @@ -17,6 +17,7 @@ interface SleepTimerModalProps { export function SleepTimerModal({ onClose, show }: SleepTimerModalProps) { const setActive = useSleepTimerStore(state => state.set); + const noSelected = useSoundStore(state => state.noSelected()); const [running, setRunning] = useState(false); @@ -47,6 +48,7 @@ export function SleepTimerModal({ onClose, show }: SleepTimerModalProps) { const handleStart = () => { if (timerId.current) clearInterval(timerId.current); + if (noSelected) return; if (!isPlaying) play(); if (totalSeconds > 0) {