2026-01-07 09:31:02 +00:00
|
|
|
import React from 'react';
|
|
|
|
|
import { X, Activity } from 'lucide-react';
|
|
|
|
|
import { useAudio, VisualizerSettings } from '../../context/AudioContext';
|
|
|
|
|
|
|
|
|
|
interface VisualizerSettingsModalProps {
|
|
|
|
|
onClose: () => void;
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-13 18:47:57 +00:00
|
|
|
export const VisualizerSettingsModal: React.FC<
|
|
|
|
|
VisualizerSettingsModalProps
|
|
|
|
|
> = ({ onClose }) => {
|
2026-01-07 09:31:02 +00:00
|
|
|
const { visualizerSettings, setVisualizerSettings } = useAudio();
|
|
|
|
|
|
|
|
|
|
const updateSetting = (key: keyof VisualizerSettings, value: any) => {
|
2026-01-13 18:47:57 +00:00
|
|
|
setVisualizerSettings({ ...visualizerSettings, [key]: value });
|
2026-01-07 09:31:02 +00:00
|
|
|
};
|
|
|
|
|
|
2026-02-12 00:54:47 +00:00
|
|
|
const colors = ['#7c9dd6', '#a8a4a0', '#7a9e6c', '#c9a84c', '#d4634a'];
|
2026-01-07 09:31:02 +00:00
|
|
|
|
|
|
|
|
return (
|
2026-02-07 14:33:31 +00:00
|
|
|
<div className="absolute bottom-20 right-0 md:right-auto md:left-1/2 md:-translate-x-1/2 w-72 bg-card border border-border rounded-xl shadow-2xl z-50 animate-fadeIn overflow-hidden">
|
|
|
|
|
<div className="p-4 border-b border-border bg-muted flex justify-between items-center">
|
2026-02-12 01:09:29 +00:00
|
|
|
<h3 className="font-bold text-foreground flex items-center gap-2 text-sm">
|
2026-02-07 14:33:31 +00:00
|
|
|
<Activity className="w-4 h-4 text-muted-foreground" /> Visualizer
|
2026-01-07 09:31:02 +00:00
|
|
|
</h3>
|
2026-01-13 18:47:57 +00:00
|
|
|
<button onClick={onClose}>
|
2026-02-12 01:09:29 +00:00
|
|
|
<X className="w-4 h-4 text-muted-foreground hover:text-foreground" />
|
2026-01-13 18:47:57 +00:00
|
|
|
</button>
|
2026-01-07 09:31:02 +00:00
|
|
|
</div>
|
|
|
|
|
|
aesthetic-improvements: align spacing to 8px grid (Action 11.2.1.3)
- Created automated script (scripts/align-8px-grid.py) to align all spacing to 8px grid
- Replaced non-8px-aligned spacing: gap-3/p-3/m-3 (12px) → gap-4/p-4/m-4 (16px), gap-5/p-5/m-5 (20px) → gap-6/p-6/m-6 (24px), gap-10/p-10/m-10 (40px) → gap-12/p-12/m-12 (48px), gap-20/p-20/m-20 (80px) → gap-24/p-24/m-24 (96px)
- Preserved: 4px values (gap-1, p-1, m-1) as they may be intentional fine-tuning, responsive breakpoints (sm:, md:, lg:), test files, documentation
- Modified files across all components to ensure consistent 8px grid alignment
- Action 11.2.1.3: Align all elements to 8px grid - COMPLETE
2026-01-16 10:50:46 +00:00
|
|
|
<div className="p-6 space-y-6">
|
2026-01-07 09:31:02 +00:00
|
|
|
{/* Mode */}
|
|
|
|
|
<div>
|
2026-02-07 14:33:31 +00:00
|
|
|
<label className="block text-xs font-bold text-muted-foreground uppercase mb-2">
|
2026-01-13 18:47:57 +00:00
|
|
|
Display Mode
|
|
|
|
|
</label>
|
|
|
|
|
<div className="grid grid-cols-2 gap-2">
|
|
|
|
|
{['waveform', 'spectrogram', 'bars', 'off'].map((mode) => (
|
|
|
|
|
<button
|
|
|
|
|
key={mode}
|
|
|
|
|
onClick={() => updateSetting('mode', mode)}
|
2026-02-07 15:01:56 +00:00
|
|
|
className={`px-2 py-1.5 rounded text-xs font-bold capitalize transition-all border ${visualizerSettings.mode === mode ? 'bg-primary/10 border-primary text-primary' : 'bg-muted border-transparent text-muted-foreground hover:text-foreground'}`}
|
2026-01-13 18:47:57 +00:00
|
|
|
>
|
|
|
|
|
{mode}
|
|
|
|
|
</button>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
2026-01-07 09:31:02 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* Sensitivity */}
|
|
|
|
|
<div>
|
2026-02-07 14:33:31 +00:00
|
|
|
<div className="flex justify-between text-xs text-muted-foreground mb-1">
|
2026-01-13 18:47:57 +00:00
|
|
|
<span>Sensitivity</span>
|
|
|
|
|
<span>{visualizerSettings.sensitivity}%</span>
|
|
|
|
|
</div>
|
|
|
|
|
<input
|
|
|
|
|
type="range"
|
|
|
|
|
min="0"
|
|
|
|
|
max="100"
|
|
|
|
|
value={visualizerSettings.sensitivity}
|
|
|
|
|
onChange={(e) =>
|
|
|
|
|
updateSetting('sensitivity', Number(e.target.value))
|
|
|
|
|
}
|
2026-02-07 15:01:56 +00:00
|
|
|
className="w-full h-1 bg-muted rounded-lg appearance-none cursor-pointer [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3 [&::-webkit-slider-thumb]:bg-primary [&::-webkit-slider-thumb]:rounded-full"
|
2026-01-13 18:47:57 +00:00
|
|
|
/>
|
2026-01-07 09:31:02 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* Color */}
|
|
|
|
|
<div>
|
2026-02-07 14:33:31 +00:00
|
|
|
<label className="block text-xs font-bold text-muted-foreground uppercase mb-2">
|
2026-01-13 18:47:57 +00:00
|
|
|
Accent Color
|
|
|
|
|
</label>
|
aesthetic-improvements: align spacing to 8px grid (Action 11.2.1.3)
- Created automated script (scripts/align-8px-grid.py) to align all spacing to 8px grid
- Replaced non-8px-aligned spacing: gap-3/p-3/m-3 (12px) → gap-4/p-4/m-4 (16px), gap-5/p-5/m-5 (20px) → gap-6/p-6/m-6 (24px), gap-10/p-10/m-10 (40px) → gap-12/p-12/m-12 (48px), gap-20/p-20/m-20 (80px) → gap-24/p-24/m-24 (96px)
- Preserved: 4px values (gap-1, p-1, m-1) as they may be intentional fine-tuning, responsive breakpoints (sm:, md:, lg:), test files, documentation
- Modified files across all components to ensure consistent 8px grid alignment
- Action 11.2.1.3: Align all elements to 8px grid - COMPLETE
2026-01-16 10:50:46 +00:00
|
|
|
<div className="flex gap-4">
|
2026-01-13 18:47:57 +00:00
|
|
|
{colors.map((c) => (
|
|
|
|
|
<div
|
|
|
|
|
key={c}
|
|
|
|
|
onClick={() => updateSetting('color', c)}
|
2026-02-07 14:33:31 +00:00
|
|
|
className={`w-6 h-6 rounded-full cursor-pointer transition-opacity hover:opacity-80 ${visualizerSettings.color === c ? 'ring-2 ring-white ring-offset-2 ring-offset-background' : ''}`}
|
2026-01-13 18:47:57 +00:00
|
|
|
style={{ backgroundColor: c }}
|
|
|
|
|
></div>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
2026-01-07 09:31:02 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|