2025-12-03 21:56:50 +00:00
|
|
|
/**
|
|
|
|
|
* Composant MiniPlayer
|
|
|
|
|
* Version compacte du player avec position fixe et toggle
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import { ChevronUp, X } from 'lucide-react';
|
|
|
|
|
import { cn } from '@/lib/utils';
|
feat(ui): tooltip adoption + search highlighting & skeleton loading
Tooltip adoption (18 conversions across 11 files):
- Player controls: shuffle, repeat, mute, expand, close, lyrics, auto-scroll
- Navbar: theme toggle
- File browser: download, add tag, AI auto-tag, watermark, process with AI
- Notifications: mark as read
- Share links: open link, revoke link
- Chat: scroll to bottom
Search polish:
- New highlightMatch utility — wraps matching text in <mark> with primary color
- Applied to track titles, artist names, playlist names in SearchPageResults
- Applied to suggestion dropdown titles and subtitles
- Replaced spinner loading state with content-aware SearchPageSkeleton
- Skeleton matches actual results layout (tab bar, track cards, artist circles)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-09 22:14:00 +00:00
|
|
|
import { Tooltip } from '@/components/ui/tooltip';
|
2025-12-03 21:56:50 +00:00
|
|
|
import { usePlayer } from '../hooks/usePlayer';
|
|
|
|
|
import { TrackInfo } from './TrackInfo';
|
|
|
|
|
import { PlayPauseButton } from './PlayPauseButton';
|
|
|
|
|
import { NextPreviousButtons } from './NextPreviousButtons';
|
|
|
|
|
import { ProgressBar } from './ProgressBar';
|
|
|
|
|
import { VolumeControl } from './VolumeControl';
|
|
|
|
|
|
|
|
|
|
export interface MiniPlayerProps {
|
|
|
|
|
isVisible: boolean;
|
|
|
|
|
onToggle: () => void;
|
|
|
|
|
onClose?: () => void;
|
|
|
|
|
className?: string;
|
|
|
|
|
position?: 'bottom' | 'top';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function MiniPlayer({
|
|
|
|
|
isVisible,
|
|
|
|
|
onToggle,
|
|
|
|
|
onClose,
|
|
|
|
|
className,
|
|
|
|
|
position = 'bottom',
|
|
|
|
|
}: MiniPlayerProps) {
|
|
|
|
|
const player = usePlayer();
|
|
|
|
|
|
|
|
|
|
if (!isVisible || !player.currentTrack) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handlePlayPause = () => {
|
|
|
|
|
if (player.isPlaying) {
|
|
|
|
|
player.pause();
|
|
|
|
|
} else {
|
|
|
|
|
player.resume();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2025-12-13 02:34:34 +00:00
|
|
|
const canGoNext =
|
|
|
|
|
player.queue.length > 0 && player.currentIndex < player.queue.length - 1;
|
2025-12-03 21:56:50 +00:00
|
|
|
const canGoPrevious = player.queue.length > 0 && player.currentIndex > 0;
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div
|
|
|
|
|
className={cn(
|
2026-02-07 14:33:31 +00:00
|
|
|
'fixed left-0 right-0 z-50 bg-card border-t border-border shadow-lg',
|
feat(web): UI premium Discord/Spotify-like — tokens, shadows, focus, layout
Plan UI premium 6–8 semaines (design system, shell, Storybook, a11y):
- Design system: DESIGN_TOKENS.md, APP_SHELL.md, FULL_LAYOUT_PAGE.md. Single source
for layout/shell (index.css), shadows (design-system.css), durations/easing.
- Tokens: shadow-cover-depth, shadow-gold-glow, shadow-fab-glow; layout max-height
(max-h-layout-drawer, max-h-layout-panel, max-h-layout-list). All duration-200/300/500
replaced by --duration-fast/normal/slow. Arbitrary shadows replaced by token classes.
- Shell & player: Sidebar, Header, GlobalPlayer, MiniPlayer, PlayerQueue, PlayerControls,
AudioPlayer use tokens; focus-visible on Sidebar, PlayerQueue, DropdownMenuTrigger/Item,
TabsTrigger. Typography: text-[10px]/[9px] → text-xs where applicable.
- ESLint: no-restricted-syntax (warn) for w-/h-/rounded-/shadow-/text-/spacing arbitrary.
- Scripts: report-arbitrary-values.mjs, capture/compare/generate visual; visual-complete.spec.ts.
- Stories full layout: Dashboard, Playlists, Library, Settings, Profile in DashboardLayout.stories.
- .cursorrules + README: DESIGN_TOKENS, APP_SHELL, visual commands, no arbitrary without justification.
- apps/web/.gitignore: e2e test artifacts (test-results-visual, playwright-report-visual).
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-08 16:15:58 +00:00
|
|
|
'transition-transform duration-[var(--duration-normal)] ease-in-out',
|
2025-12-03 21:56:50 +00:00
|
|
|
position === 'bottom' ? 'bottom-0' : 'top-0',
|
2025-12-13 02:34:34 +00:00
|
|
|
className,
|
2025-12-03 21:56:50 +00:00
|
|
|
)}
|
|
|
|
|
role="region"
|
|
|
|
|
aria-label="Mini lecteur audio"
|
|
|
|
|
>
|
|
|
|
|
<div className="container mx-auto px-4 py-2">
|
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">
|
2025-12-03 21:56:50 +00:00
|
|
|
{/* Track Info - Compact */}
|
|
|
|
|
<div className="flex-1 min-w-0">
|
|
|
|
|
<TrackInfo
|
|
|
|
|
track={player.currentTrack}
|
|
|
|
|
showCover={true}
|
|
|
|
|
coverSize="sm"
|
|
|
|
|
showMetadata={false}
|
|
|
|
|
className="p-0"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* Progress Bar - Compact */}
|
|
|
|
|
<div className="hidden md:flex flex-1 max-w-xs">
|
|
|
|
|
<ProgressBar
|
|
|
|
|
currentTime={player.currentTime}
|
|
|
|
|
duration={player.duration}
|
|
|
|
|
onSeek={player.seek}
|
|
|
|
|
className="h-1"
|
|
|
|
|
showTooltip={false}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* Controls */}
|
|
|
|
|
<div className="flex items-center gap-2">
|
|
|
|
|
<NextPreviousButtons
|
|
|
|
|
onNext={player.next}
|
|
|
|
|
onPrevious={player.previous}
|
|
|
|
|
canGoNext={canGoNext}
|
|
|
|
|
canGoPrevious={canGoPrevious}
|
|
|
|
|
size="sm"
|
|
|
|
|
variant="ghost"
|
|
|
|
|
disabled={!player.currentTrack}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<PlayPauseButton
|
|
|
|
|
isPlaying={player.isPlaying}
|
|
|
|
|
onClick={handlePlayPause}
|
|
|
|
|
size="sm"
|
|
|
|
|
variant="default"
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<div className="hidden sm:block">
|
|
|
|
|
<VolumeControl
|
|
|
|
|
volume={player.volume}
|
|
|
|
|
muted={player.muted}
|
|
|
|
|
onVolumeChange={player.setVolume}
|
|
|
|
|
onMuteToggle={player.toggleMute}
|
|
|
|
|
showValue={false}
|
|
|
|
|
showSlider={true}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* Toggle Button */}
|
feat(ui): tooltip adoption + search highlighting & skeleton loading
Tooltip adoption (18 conversions across 11 files):
- Player controls: shuffle, repeat, mute, expand, close, lyrics, auto-scroll
- Navbar: theme toggle
- File browser: download, add tag, AI auto-tag, watermark, process with AI
- Notifications: mark as read
- Share links: open link, revoke link
- Chat: scroll to bottom
Search polish:
- New highlightMatch utility — wraps matching text in <mark> with primary color
- Applied to track titles, artist names, playlist names in SearchPageResults
- Applied to suggestion dropdown titles and subtitles
- Replaced spinner loading state with content-aware SearchPageSkeleton
- Skeleton matches actual results layout (tab bar, track cards, artist circles)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-09 22:14:00 +00:00
|
|
|
<Tooltip content="Agrandir le lecteur">
|
2025-12-03 21:56:50 +00:00
|
|
|
<button
|
|
|
|
|
type="button"
|
feat(ui): tooltip adoption + search highlighting & skeleton loading
Tooltip adoption (18 conversions across 11 files):
- Player controls: shuffle, repeat, mute, expand, close, lyrics, auto-scroll
- Navbar: theme toggle
- File browser: download, add tag, AI auto-tag, watermark, process with AI
- Notifications: mark as read
- Share links: open link, revoke link
- Chat: scroll to bottom
Search polish:
- New highlightMatch utility — wraps matching text in <mark> with primary color
- Applied to track titles, artist names, playlist names in SearchPageResults
- Applied to suggestion dropdown titles and subtitles
- Replaced spinner loading state with content-aware SearchPageSkeleton
- Skeleton matches actual results layout (tab bar, track cards, artist circles)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-09 22:14:00 +00:00
|
|
|
onClick={onToggle}
|
2025-12-03 21:56:50 +00:00
|
|
|
className={cn(
|
2026-02-07 14:33:31 +00:00
|
|
|
'p-2 rounded-lg text-muted-foreground',
|
|
|
|
|
'hover:bg-muted',
|
2025-12-03 21:56:50 +00:00
|
|
|
'focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2',
|
2025-12-13 02:34:34 +00:00
|
|
|
'transition-colors',
|
2025-12-03 21:56:50 +00:00
|
|
|
)}
|
feat(ui): tooltip adoption + search highlighting & skeleton loading
Tooltip adoption (18 conversions across 11 files):
- Player controls: shuffle, repeat, mute, expand, close, lyrics, auto-scroll
- Navbar: theme toggle
- File browser: download, add tag, AI auto-tag, watermark, process with AI
- Notifications: mark as read
- Share links: open link, revoke link
- Chat: scroll to bottom
Search polish:
- New highlightMatch utility — wraps matching text in <mark> with primary color
- Applied to track titles, artist names, playlist names in SearchPageResults
- Applied to suggestion dropdown titles and subtitles
- Replaced spinner loading state with content-aware SearchPageSkeleton
- Skeleton matches actual results layout (tab bar, track cards, artist circles)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-09 22:14:00 +00:00
|
|
|
aria-label="Agrandir le lecteur"
|
2025-12-03 21:56:50 +00:00
|
|
|
>
|
feat(ui): tooltip adoption + search highlighting & skeleton loading
Tooltip adoption (18 conversions across 11 files):
- Player controls: shuffle, repeat, mute, expand, close, lyrics, auto-scroll
- Navbar: theme toggle
- File browser: download, add tag, AI auto-tag, watermark, process with AI
- Notifications: mark as read
- Share links: open link, revoke link
- Chat: scroll to bottom
Search polish:
- New highlightMatch utility — wraps matching text in <mark> with primary color
- Applied to track titles, artist names, playlist names in SearchPageResults
- Applied to suggestion dropdown titles and subtitles
- Replaced spinner loading state with content-aware SearchPageSkeleton
- Skeleton matches actual results layout (tab bar, track cards, artist circles)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-09 22:14:00 +00:00
|
|
|
<ChevronUp className="h-5 w-5" aria-hidden="true" />
|
|
|
|
|
<span className="sr-only">Agrandir le lecteur</span>
|
2025-12-03 21:56:50 +00:00
|
|
|
</button>
|
feat(ui): tooltip adoption + search highlighting & skeleton loading
Tooltip adoption (18 conversions across 11 files):
- Player controls: shuffle, repeat, mute, expand, close, lyrics, auto-scroll
- Navbar: theme toggle
- File browser: download, add tag, AI auto-tag, watermark, process with AI
- Notifications: mark as read
- Share links: open link, revoke link
- Chat: scroll to bottom
Search polish:
- New highlightMatch utility — wraps matching text in <mark> with primary color
- Applied to track titles, artist names, playlist names in SearchPageResults
- Applied to suggestion dropdown titles and subtitles
- Replaced spinner loading state with content-aware SearchPageSkeleton
- Skeleton matches actual results layout (tab bar, track cards, artist circles)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-09 22:14:00 +00:00
|
|
|
</Tooltip>
|
|
|
|
|
|
|
|
|
|
{/* Close Button (optional) */}
|
|
|
|
|
{onClose && (
|
|
|
|
|
<Tooltip content="Fermer le mini lecteur">
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
onClick={onClose}
|
|
|
|
|
className={cn(
|
|
|
|
|
'p-2 rounded-lg text-muted-foreground',
|
|
|
|
|
'hover:bg-muted',
|
|
|
|
|
'focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2',
|
|
|
|
|
'transition-colors',
|
|
|
|
|
)}
|
|
|
|
|
aria-label="Fermer le mini lecteur"
|
|
|
|
|
>
|
|
|
|
|
<X className="h-5 w-5" aria-hidden="true" />
|
|
|
|
|
<span className="sr-only">Fermer le mini lecteur</span>
|
|
|
|
|
</button>
|
|
|
|
|
</Tooltip>
|
2025-12-03 21:56:50 +00:00
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default MiniPlayer;
|