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';
|
2026-02-12 20:55:25 +00:00
|
|
|
import { useTranslation } from '@/hooks/useTranslation';
|
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) {
|
2026-02-12 20:55:25 +00:00
|
|
|
const { t } = useTranslation();
|
2025-12-03 21:56:50 +00:00
|
|
|
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(
|
fix: UI remediation Phase 1 (S0-S5) + Phase 2 Sprint 6 shadow system
Phase 1:
- S0: Fix open redirect (safeNavigate), delete AuthContext/legacy auth, encrypt API keys, gitignore .env files
- S1: Split client.ts god object into 5 modules, unify toast system, delete unused Sidebar
- S2: Add glass button variant, migrate 32 z-index to SUMI tokens, fix card dark mode
- S3: Skip nav link, aria-hidden on icons, focus-visible ring fixes, alt attrs, aria-live regions
- S4: React.memo on list items, fix key={index}, loading=lazy on images
- S5: Branded loading screen, page transitions respect reduced-motion, LikeButton micro-interaction, i18n sidebar/header
Phase 2 Sprint 6:
- Wire Tailwind shadow utilities to SUMI tokens in @theme block (fixes 50+ files)
- Define shadow-card/shadow-card-hover tokens
- Remove dark:shadow-none workarounds from card.tsx (SUMI handles per-theme shadows)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 09:13:44 +00:00
|
|
|
'fixed left-0 right-0 z-[var(--sumi-z-sticky)] bg-[var(--sumi-glass-bg)] backdrop-blur-[16px] border-t border-[var(--sumi-border-faint)] shadow-[var(--sumi-shadow-lg)]',
|
refactor: Phase 5 — Migrate layout shell to SUMI tokens
- Sidebar: bg-raised, border-faint tokens
- Header: glass bg + backdrop-blur-12px, z-200 sticky, SUMI durations
- PlayerBarGlass: glass-bg + blur-16px, accent colors, remove glow
- PlayerBarProgress: solid accent fill, SUMI border tokens
- PlayerBarRight/TrackInfo: text-foreground, SUMI border tokens
- MiniPlayer: glass-bg, border-faint, z-200, SUMI shadows
- GlobalPlayer: SUMI z-index and duration tokens
- DashboardLayout: SUMI z-raised, duration tokens
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 01:01:39 +00:00
|
|
|
'transition-transform duration-[var(--sumi-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"
|
2026-02-12 20:55:25 +00:00
|
|
|
aria-label={t('player.miniPlayerAriaLabel')}
|
2025-12-03 21:56:50 +00:00
|
|
|
>
|
|
|
|
|
<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 */}
|
2026-02-12 20:55:25 +00:00
|
|
|
<div className="flex-1 min-w-0" aria-live="polite">
|
2025-12-03 21:56:50 +00:00
|
|
|
<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 */}
|
2026-02-12 20:55:25 +00:00
|
|
|
<Tooltip content={t('player.expandPlayer')}>
|
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',
|
refactor: Phase 5 — Migrate layout shell to SUMI tokens
- Sidebar: bg-raised, border-faint tokens
- Header: glass bg + backdrop-blur-12px, z-200 sticky, SUMI durations
- PlayerBarGlass: glass-bg + blur-16px, accent colors, remove glow
- PlayerBarProgress: solid accent fill, SUMI border tokens
- PlayerBarRight/TrackInfo: text-foreground, SUMI border tokens
- MiniPlayer: glass-bg, border-faint, z-200, SUMI shadows
- GlobalPlayer: SUMI z-index and duration tokens
- DashboardLayout: SUMI z-raised, duration tokens
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 01:01:39 +00:00
|
|
|
'focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2',
|
|
|
|
|
'transition-colors duration-[var(--sumi-duration-fast)]',
|
2025-12-03 21:56:50 +00:00
|
|
|
)}
|
2026-02-12 20:55:25 +00:00
|
|
|
aria-label={t('player.expandPlayer')}
|
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" />
|
2026-02-12 20:55:25 +00:00
|
|
|
<span className="sr-only">{t('player.expandPlayer')}</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 && (
|
2026-02-12 20:55:25 +00:00
|
|
|
<Tooltip content={t('player.closeMiniPlayer')}>
|
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
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
onClick={onClose}
|
|
|
|
|
className={cn(
|
|
|
|
|
'p-2 rounded-lg text-muted-foreground',
|
|
|
|
|
'hover:bg-muted',
|
refactor: Phase 5 — Migrate layout shell to SUMI tokens
- Sidebar: bg-raised, border-faint tokens
- Header: glass bg + backdrop-blur-12px, z-200 sticky, SUMI durations
- PlayerBarGlass: glass-bg + blur-16px, accent colors, remove glow
- PlayerBarProgress: solid accent fill, SUMI border tokens
- PlayerBarRight/TrackInfo: text-foreground, SUMI border tokens
- MiniPlayer: glass-bg, border-faint, z-200, SUMI shadows
- GlobalPlayer: SUMI z-index and duration tokens
- DashboardLayout: SUMI z-raised, duration tokens
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 01:01:39 +00:00
|
|
|
'focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2',
|
|
|
|
|
'transition-colors duration-[var(--sumi-duration-fast)]',
|
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
|
|
|
)}
|
2026-02-12 20:55:25 +00:00
|
|
|
aria-label={t('player.closeMiniPlayer')}
|
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
|
|
|
>
|
|
|
|
|
<X className="h-5 w-5" aria-hidden="true" />
|
2026-02-12 20:55:25 +00:00
|
|
|
<span className="sr-only">{t('player.closeMiniPlayer')}</span>
|
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
|
|
|
</button>
|
|
|
|
|
</Tooltip>
|
2025-12-03 21:56:50 +00:00
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default MiniPlayer;
|