2026-01-07 09:31:02 +00:00
|
|
|
import React, { useState } from 'react';
|
2026-01-13 18:47:57 +00:00
|
|
|
import {
|
|
|
|
|
Play,
|
|
|
|
|
Pause,
|
|
|
|
|
SkipBack,
|
|
|
|
|
SkipForward,
|
|
|
|
|
Shuffle,
|
|
|
|
|
Repeat,
|
|
|
|
|
Volume2,
|
|
|
|
|
VolumeX,
|
|
|
|
|
Gauge,
|
|
|
|
|
SlidersHorizontal,
|
|
|
|
|
} from 'lucide-react';
|
2026-01-07 09:31:02 +00:00
|
|
|
import { useAudio } from '../../context/AudioContext';
|
|
|
|
|
import { PlaybackSpeedModal } from './PlaybackSpeedModal';
|
|
|
|
|
import { VisualizerSettingsModal } from './VisualizerSettingsModal';
|
|
|
|
|
|
|
|
|
|
interface PlayerControlsProps {
|
|
|
|
|
layout?: 'compact' | 'full';
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-13 18:47:57 +00:00
|
|
|
export const PlayerControls: React.FC<PlayerControlsProps> = ({
|
|
|
|
|
layout = 'compact',
|
|
|
|
|
}) => {
|
|
|
|
|
const {
|
|
|
|
|
isPlaying,
|
|
|
|
|
togglePlay,
|
|
|
|
|
nextTrack,
|
|
|
|
|
prevTrack,
|
|
|
|
|
shuffle,
|
|
|
|
|
toggleShuffle,
|
|
|
|
|
repeatMode,
|
|
|
|
|
toggleRepeat,
|
|
|
|
|
volume,
|
|
|
|
|
setVolume,
|
|
|
|
|
isMuted,
|
|
|
|
|
toggleMute,
|
|
|
|
|
playbackRate: _playbackRate,
|
2026-01-07 09:31:02 +00:00
|
|
|
} = useAudio();
|
|
|
|
|
|
|
|
|
|
const [showSpeed, setShowSpeed] = useState(false);
|
|
|
|
|
const [showVisualizer, setShowVisualizer] = useState(false);
|
|
|
|
|
|
|
|
|
|
return (
|
2026-01-13 18:47:57 +00:00
|
|
|
<div
|
|
|
|
|
className={`flex items-center ${layout === 'full' ? 'justify-between w-full max-w-4xl' : 'justify-center gap-4'}`}
|
|
|
|
|
>
|
2026-01-07 09:31:02 +00:00
|
|
|
{/* 1. Playback Modifiers */}
|
|
|
|
|
<div className="flex items-center gap-4 relative">
|
2026-01-13 18:47:57 +00:00
|
|
|
<button
|
2026-01-16 00:59:31 +00:00
|
|
|
className={`transition-colors hover:text-white ${shuffle ? 'text-kodo-cyan' : 'text-kodo-content-dim'}`}
|
2026-01-13 18:47:57 +00:00
|
|
|
onClick={toggleShuffle}
|
|
|
|
|
title="Shuffle"
|
|
|
|
|
>
|
|
|
|
|
<Shuffle className={layout === 'full' ? 'w-5 h-5' : 'w-4 h-4'} />
|
|
|
|
|
</button>
|
|
|
|
|
<button
|
2026-01-16 00:59:31 +00:00
|
|
|
className={`transition-colors hover:text-white relative ${repeatMode !== 'off' ? 'text-kodo-cyan' : 'text-kodo-content-dim'}`}
|
2026-01-13 18:47:57 +00:00
|
|
|
onClick={toggleRepeat}
|
|
|
|
|
title="Repeat"
|
|
|
|
|
>
|
|
|
|
|
<Repeat className={layout === 'full' ? 'w-5 h-5' : 'w-4 h-4'} />
|
|
|
|
|
{repeatMode === 'one' && (
|
|
|
|
|
<span className="absolute -top-1 -right-1 text-[8px] font-bold">
|
|
|
|
|
1
|
|
|
|
|
</span>
|
|
|
|
|
)}
|
|
|
|
|
</button>
|
2026-01-07 09:31:02 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* 2. Main Transport */}
|
|
|
|
|
<div className="flex items-center gap-6">
|
2026-01-13 18:47:57 +00:00
|
|
|
<button
|
aesthetic-improvements: remove excessive hover effects from high-priority files
- Removed scale transforms (hover:scale-[1.02], hover:scale-110, group-hover:scale-110/105) from cards and images
- Removed decorative shadow/glow effects (hover:shadow-neon-cyan/20, hover:shadow-lg) from cards
- Removed hover-lift class (translateY + shadow) from base Card and Button components
- Replaced excessive effects with subtle hover:bg-white/5 or hover:opacity-90
- Preserved functional hover states (group-hover:opacity-100 for play overlays, hover:bg-accent/50 for interactive feedback)
- Updated 14 files: ProductCard, TrackCard, CourseCard, EquipmentCard, PostCard, ProfileView, card.tsx, SearchPage, PlayerControls, OrderSummary, DiscoverView, PlaylistCard, Sidebar, button.tsx
- Effects are now subtle and purposeful, aligning with Surgical Minimalism
- Action 11.4.1.3 complete
2026-01-16 09:34:41 +00:00
|
|
|
className="text-kodo-content-dim hover:text-white transition-colors"
|
2026-01-13 18:47:57 +00:00
|
|
|
onClick={prevTrack}
|
|
|
|
|
>
|
|
|
|
|
<SkipBack
|
|
|
|
|
className={
|
|
|
|
|
layout === 'full'
|
|
|
|
|
? 'w-8 h-8 fill-current'
|
|
|
|
|
: 'w-5 h-5 fill-current'
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
onClick={togglePlay}
|
aesthetic-improvements: remove excessive hover effects from high-priority files
- Removed scale transforms (hover:scale-[1.02], hover:scale-110, group-hover:scale-110/105) from cards and images
- Removed decorative shadow/glow effects (hover:shadow-neon-cyan/20, hover:shadow-lg) from cards
- Removed hover-lift class (translateY + shadow) from base Card and Button components
- Replaced excessive effects with subtle hover:bg-white/5 or hover:opacity-90
- Preserved functional hover states (group-hover:opacity-100 for play overlays, hover:bg-accent/50 for interactive feedback)
- Updated 14 files: ProductCard, TrackCard, CourseCard, EquipmentCard, PostCard, ProfileView, card.tsx, SearchPage, PlayerControls, OrderSummary, DiscoverView, PlaylistCard, Sidebar, button.tsx
- Effects are now subtle and purposeful, aligning with Surgical Minimalism
- Action 11.4.1.3 complete
2026-01-16 09:34:41 +00:00
|
|
|
className={`${layout === 'full' ? 'w-14 h-14' : 'w-10 h-10'} rounded-full bg-white text-black flex items-center justify-center transition-opacity duration-200 hover:opacity-90`}
|
2026-01-13 18:47:57 +00:00
|
|
|
>
|
|
|
|
|
{isPlaying ? (
|
|
|
|
|
<Pause
|
|
|
|
|
className={
|
|
|
|
|
layout === 'full'
|
|
|
|
|
? 'w-6 h-6 fill-current'
|
|
|
|
|
: 'w-5 h-5 fill-current'
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
) : (
|
|
|
|
|
<Play
|
|
|
|
|
className={
|
|
|
|
|
layout === 'full'
|
|
|
|
|
? 'w-6 h-6 fill-current ml-1'
|
|
|
|
|
: 'w-5 h-5 fill-current ml-1'
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
</button>
|
|
|
|
|
<button
|
aesthetic-improvements: remove excessive hover effects from high-priority files
- Removed scale transforms (hover:scale-[1.02], hover:scale-110, group-hover:scale-110/105) from cards and images
- Removed decorative shadow/glow effects (hover:shadow-neon-cyan/20, hover:shadow-lg) from cards
- Removed hover-lift class (translateY + shadow) from base Card and Button components
- Replaced excessive effects with subtle hover:bg-white/5 or hover:opacity-90
- Preserved functional hover states (group-hover:opacity-100 for play overlays, hover:bg-accent/50 for interactive feedback)
- Updated 14 files: ProductCard, TrackCard, CourseCard, EquipmentCard, PostCard, ProfileView, card.tsx, SearchPage, PlayerControls, OrderSummary, DiscoverView, PlaylistCard, Sidebar, button.tsx
- Effects are now subtle and purposeful, aligning with Surgical Minimalism
- Action 11.4.1.3 complete
2026-01-16 09:34:41 +00:00
|
|
|
className="text-kodo-content-dim hover:text-white transition-colors"
|
2026-01-13 18:47:57 +00:00
|
|
|
onClick={nextTrack}
|
|
|
|
|
>
|
|
|
|
|
<SkipForward
|
|
|
|
|
className={
|
|
|
|
|
layout === 'full'
|
|
|
|
|
? 'w-8 h-8 fill-current'
|
|
|
|
|
: 'w-5 h-5 fill-current'
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
</button>
|
2026-01-07 09:31:02 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* 3. Volume & Speed */}
|
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 items-center gap-4 relative">
|
2026-01-13 18:47:57 +00:00
|
|
|
{layout === 'full' && (
|
|
|
|
|
<>
|
|
|
|
|
<button
|
2026-01-16 00:59:31 +00:00
|
|
|
className={`text-kodo-content-dim hover:text-kodo-gold transition-colors ${showSpeed ? 'text-kodo-gold' : ''}`}
|
2026-01-13 18:47:57 +00:00
|
|
|
onClick={() => {
|
|
|
|
|
setShowSpeed(!showSpeed);
|
|
|
|
|
setShowVisualizer(false);
|
|
|
|
|
}}
|
|
|
|
|
title="Playback Speed"
|
|
|
|
|
>
|
|
|
|
|
<Gauge className="w-5 h-5" />
|
2026-01-07 09:31:02 +00:00
|
|
|
</button>
|
2026-01-13 18:47:57 +00:00
|
|
|
<button
|
2026-01-16 09:59:09 +00:00
|
|
|
className={`text-kodo-content-dim hover:text-white transition-colors ${showVisualizer ? 'text-kodo-cyan' : ''}`}
|
2026-01-13 18:47:57 +00:00
|
|
|
onClick={() => {
|
|
|
|
|
setShowVisualizer(!showVisualizer);
|
|
|
|
|
setShowSpeed(false);
|
|
|
|
|
}}
|
|
|
|
|
title="Visualizer Settings"
|
|
|
|
|
>
|
|
|
|
|
<SlidersHorizontal className="w-5 h-5" />
|
|
|
|
|
</button>
|
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
{/* Volume */}
|
|
|
|
|
<div className="flex items-center gap-2 group w-24">
|
|
|
|
|
<button
|
|
|
|
|
onClick={toggleMute}
|
2026-01-16 00:59:31 +00:00
|
|
|
className="text-kodo-content-dim hover:text-white"
|
2026-01-13 18:47:57 +00:00
|
|
|
>
|
|
|
|
|
{isMuted || volume === 0 ? (
|
|
|
|
|
<VolumeX className="w-4 h-4" />
|
|
|
|
|
) : (
|
|
|
|
|
<Volume2 className="w-4 h-4" />
|
|
|
|
|
)}
|
|
|
|
|
</button>
|
|
|
|
|
<div
|
|
|
|
|
className="flex-1 h-1 bg-kodo-steel rounded-full cursor-pointer relative"
|
|
|
|
|
onClick={(e) => {
|
|
|
|
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
|
|
|
setVolume(((e.clientX - rect.left) / rect.width) * 100);
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<div
|
|
|
|
|
className={`absolute top-0 left-0 h-full bg-white rounded-full ${isMuted ? 'opacity-50' : 'opacity-100'}`}
|
|
|
|
|
style={{ width: `${isMuted ? 0 : volume}%` }}
|
|
|
|
|
></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2026-01-07 09:31:02 +00:00
|
|
|
|
2026-01-13 18:47:57 +00:00
|
|
|
{/* Modals Positioned Relative */}
|
|
|
|
|
{showSpeed && (
|
|
|
|
|
<PlaybackSpeedModal onClose={() => setShowSpeed(false)} />
|
|
|
|
|
)}
|
|
|
|
|
{showVisualizer && (
|
|
|
|
|
<VisualizerSettingsModal onClose={() => setShowVisualizer(false)} />
|
|
|
|
|
)}
|
2026-01-07 09:31:02 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|