diff --git a/src/components/Player/PlayerBar.jsx b/src/components/Player/PlayerBar.jsx new file mode 100644 index 0000000..7ed03f7 --- /dev/null +++ b/src/components/Player/PlayerBar.jsx @@ -0,0 +1,146 @@ +import { useState } from 'react' +import { motion, AnimatePresence } from 'framer-motion' +import Waveform3D from './Waveform3D' + +export default function PlayerBar({ currentTrack, isPlaying, progress, volume, onToggle, onNext, onPrev, onSeek, onVolume }) { + const [liked, setLiked] = useState(false) + const [shuffled, setShuffled] = useState(false) + const [repeated, setRepeated] = useState(false) + + if (!currentTrack) return null + + const pct = `${(progress * 100).toFixed(1)}%` + + return ( + + +
+ + {/* ── Track info ──────────────────── */} +
+
+ {currentTrack.title} + {isPlaying && ( +
+ )} +
+
+

{currentTrack.title}

+

{currentTrack.artist}

+
+ setLiked(l => !l)} + className="flex-shrink-0 transition-colors" + style={{ color: liked ? 'var(--gold)' : 'var(--text-muted)' }} + > + + + + +
+ + {/* ── Centre: controls + progress ─ */} +
+ {/* Control buttons */} +
+ {/* Shuffle */} + setShuffled(s => !s)} + style={{ color: shuffled ? 'var(--gold)' : 'var(--text-muted)' }} + className="hidden sm:block transition-colors"> + + + + + + {/* Prev */} + + + + + + + {/* Play/Pause */} + + {isPlaying + ? + : + } + + + {/* Next */} + + + + + + + {/* Repeat */} + setRepeated(r => !r)} + style={{ color: repeated ? 'var(--gold)' : 'var(--text-muted)' }} + className="hidden sm:block transition-colors"> + + + + +
+ + {/* Progress bar */} +
+ 0:00 +
{ + const r = e.currentTarget.getBoundingClientRect() + onSeek((e.clientX - r.left) / r.width) + }}> +
+
+
+
+ {currentTrack.duration} +
+
+ + {/* ── Right: waveform + volume ─────── */} +
+
+ +
+
+ + + + onVolume(parseFloat(e.target.value))} + className="w-20" style={{ accentColor: 'var(--gold)' }} /> +
+
+
+ + + ) +}