From 3ef4a076a2b48911d37f75067dc60ea15dd28405 Mon Sep 17 00:00:00 2001 From: MAZE Date: Sat, 31 Aug 2024 00:21:08 +0330 Subject: [PATCH] fix: remove extra hook --- src/hooks/use-alarm.ts | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 src/hooks/use-alarm.ts diff --git a/src/hooks/use-alarm.ts b/src/hooks/use-alarm.ts deleted file mode 100644 index f5ad6ca..0000000 --- a/src/hooks/use-alarm.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { useCallback } from 'react'; - -import { useSound } from './use-sound'; -import { useAlarmStore } from '@/stores/alarm'; - -export function useAlarm() { - const { play: playSound } = useSound('/sounds/alarm.mp3', { volume: 1 }); - const isPlaying = useAlarmStore(state => state.isPlaying); - const play = useAlarmStore(state => state.play); - const stop = useAlarmStore(state => state.stop); - - const playAlarm = useCallback(() => { - if (!isPlaying) { - playSound(stop); - play(); - } - }, [isPlaying, playSound, play, stop]); - - return playAlarm; -}