fix: disable the sleep timer when no sound is selected

This commit is contained in:
MAZE 2024-08-31 20:43:22 +03:30
parent 4f45279938
commit d42eb25f7b

View file

@ -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) {