/**
* MiniWaveform — pure SVG component for rendering waveform_peaks_mini.
*
* Renders pre-computed 100-point peaks as vertical bars. No WaveSurfer dependency —
* lightweight enough to use in library/song list views for every song card.
*
* Props:
* peaks — array of 0-1 normalized peak values (ideally 100 points), or null
* width — SVG width in px
* height — SVG height in px
* color — bar fill color (default: teal accent)
*/
interface MiniWaveformProps {
peaks: number[] | null;
width: number;
height: number;
color?: string;
}
export function MiniWaveform({
peaks,
width,
height,
color = "#14b8a6",
}: MiniWaveformProps) {
const isEmpty = !peaks || peaks.length === 0;
if (isEmpty) {
return (
);
}
const barCount = peaks.length;
const gap = 1;
const barWidth = Math.max(1, (width - gap * (barCount - 1)) / barCount);
const midY = height / 2;
return (
);
}