import { motion } from 'motion/react'; import { useEffect, useRef, useState } from 'react'; import styles from './full-screen-visualizer.module.css'; import { usePlayerEvents } from '/@/renderer/features/player/audio-player/hooks/use-player-events'; import { usePlayerSong } from '/@/renderer/store/player.store'; import { Stack } from '/@/shared/components/stack/stack'; import { TextTitle } from '/@/shared/components/text-title/text-title'; import { Text } from '/@/shared/components/text/text'; export const FullScreenVisualizerSongInfo = () => { const currentSong = usePlayerSong(); const [showSongInfo, setShowSongInfo] = useState(false); const timeoutRef = useRef(undefined); usePlayerEvents( { onCurrentSongChange: () => { setShowSongInfo(true); if (timeoutRef.current) { clearTimeout(timeoutRef.current); } timeoutRef.current = setTimeout(() => { setShowSongInfo(false); }, 3000); }, }, [], ); useEffect(() => { return () => { if (timeoutRef.current) { clearTimeout(timeoutRef.current); } }; }, []); const overlayVariants = { hidden: { opacity: 0, transition: { duration: 1.5, ease: 'easeInOut' as const, }, }, visible: { opacity: 1, transition: { duration: 0.5, ease: 'easeInOut' as const, }, }, }; if (!currentSong) { return null; } return ( <> {currentSong.name} {currentSong.artistName && ( {currentSong.artistName} )} ); };