import { useEffect } from 'react'; import { BiPause, BiPlay, BiUndo, BiTrash } from 'react-icons/bi/index'; import { useSoundStore } from '@/store'; import { usePlay } from '@/contexts/play'; import { cn } from '@/helpers/styles'; import styles from './buttons.module.css'; export function Buttons() { const { isPlaying, pause, toggle } = usePlay(); const noSelected = useSoundStore(state => state.noSelected()); const restoreHistory = useSoundStore(state => state.restoreHistory); const hasHistory = useSoundStore(state => !!state.history); const unselectAll = useSoundStore(state => state.unselectAll); const handleClick = () => { if (noSelected) return pause(); toggle(); }; useEffect(() => { if (isPlaying && noSelected) pause(); }, [isPlaying, pause, noSelected]); return (
); }