2026-01-26 18:18:52 +00:00
|
|
|
import { Play, Pause, SkipBack, SkipForward, Shuffle, Repeat } 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';
|
2026-01-26 18:18:52 +00:00
|
|
|
|
|
|
|
|
export interface PlayerControlsProps {
|
|
|
|
|
isPlaying: boolean;
|
|
|
|
|
onPlayPause: () => void;
|
|
|
|
|
onNext: () => void;
|
|
|
|
|
onPrevious: () => void;
|
|
|
|
|
onShuffle: () => void;
|
|
|
|
|
onRepeat: () => void;
|
|
|
|
|
shuffle: boolean;
|
|
|
|
|
repeat: 'off' | 'track' | 'playlist';
|
|
|
|
|
isExpanded?: boolean;
|
2026-02-10 21:51:51 +00:00
|
|
|
/** Compact sizing for the bar (smaller buttons so everything fits in one row) */
|
|
|
|
|
compact?: boolean;
|
2026-01-26 18:18:52 +00:00
|
|
|
}
|
|
|
|
|
|
2026-02-12 01:09:29 +00:00
|
|
|
const iconBtnClass = "flex items-center justify-center rounded-full flex-shrink-0 transition-all duration-[var(--sumi-duration-normal)] active:scale-95";
|
2026-02-10 21:51:51 +00:00
|
|
|
|
2026-01-26 18:18:52 +00:00
|
|
|
export function PlayerControls({
|
|
|
|
|
isPlaying,
|
|
|
|
|
onPlayPause,
|
|
|
|
|
onNext,
|
|
|
|
|
onPrevious,
|
|
|
|
|
onShuffle,
|
|
|
|
|
onRepeat,
|
|
|
|
|
shuffle,
|
|
|
|
|
repeat,
|
2026-02-10 21:51:51 +00:00
|
|
|
isExpanded = false,
|
|
|
|
|
compact = false
|
2026-01-26 18:18:52 +00:00
|
|
|
}: PlayerControlsProps) {
|
2026-02-10 21:51:51 +00:00
|
|
|
const size = compact ? "w-8 h-8" : "w-10 h-10";
|
|
|
|
|
const playSize = isExpanded ? "w-16 h-16" : compact ? "w-10 h-10" : "w-12 h-12";
|
|
|
|
|
const iconSize = isExpanded ? "w-6 h-6" : compact ? "w-4 h-4" : "w-5 h-5";
|
|
|
|
|
const playIconSize = isExpanded ? "w-8 h-8" : compact ? "w-5 h-5" : "w-6 h-6";
|
|
|
|
|
const gapClass = compact ? "gap-1.5" : isExpanded ? "gap-6" : "gap-2 sm:gap-3 md:gap-4";
|
|
|
|
|
|
2026-01-26 18:18:52 +00:00
|
|
|
return (
|
2026-02-10 21:51:51 +00:00
|
|
|
<div className={cn("flex items-center justify-center", gapClass)}>
|
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="Shuffle">
|
|
|
|
|
<button
|
|
|
|
|
onClick={onShuffle}
|
|
|
|
|
className={cn(
|
2026-02-10 21:51:51 +00:00
|
|
|
iconBtnClass,
|
|
|
|
|
size,
|
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
|
|
|
shuffle
|
|
|
|
|
? "text-primary bg-primary/10 shadow-queue-item-current"
|
refactor: Phase 6 — Migrate feature modules to SUMI tokens
- auth: Replace gray-* with muted/border tokens, text-foreground
- settings: TwoFactorSettings + NotificationSettings text-foreground
- chat: ChatInput, ConversationItem, ChatPage — text-foreground,
remove kodo references
- player: PlayerExpanded, PlayerQueue, PlayerControls — text-foreground,
remove cyan/magenta gradients
- playlists: All components — text-foreground for badges/headings
- tracks: TrackCard, TrackListRow — text-foreground, remove glow effects
- studio: FileGridCard — text-foreground
- library: LibraryPageGrid — remove hover-glow-cyan, shadow-card-glow-cyan
- profile: UserProfilePageHeader — text-foreground
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 01:06:28 +00:00
|
|
|
: "text-muted-foreground hover:text-foreground hover:bg-white/5"
|
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
|
|
|
)}
|
|
|
|
|
>
|
|
|
|
|
<Shuffle className={cn("w-4 h-4", isExpanded && "w-5 h-5")} />
|
|
|
|
|
</button>
|
|
|
|
|
</Tooltip>
|
2026-01-26 18:18:52 +00:00
|
|
|
|
|
|
|
|
<button
|
|
|
|
|
onClick={onPrevious}
|
refactor: Phase 6 — Migrate feature modules to SUMI tokens
- auth: Replace gray-* with muted/border tokens, text-foreground
- settings: TwoFactorSettings + NotificationSettings text-foreground
- chat: ChatInput, ConversationItem, ChatPage — text-foreground,
remove kodo references
- player: PlayerExpanded, PlayerQueue, PlayerControls — text-foreground,
remove cyan/magenta gradients
- playlists: All components — text-foreground for badges/headings
- tracks: TrackCard, TrackListRow — text-foreground, remove glow effects
- studio: FileGridCard — text-foreground
- library: LibraryPageGrid — remove hover-glow-cyan, shadow-card-glow-cyan
- profile: UserProfilePageHeader — text-foreground
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 01:06:28 +00:00
|
|
|
className={cn(iconBtnClass, size, "text-foreground hover:text-primary hover:bg-white/5")}
|
2026-01-26 18:18:52 +00:00
|
|
|
>
|
2026-02-10 21:51:51 +00:00
|
|
|
<SkipBack className={cn(iconSize, "fill-current")} />
|
2026-01-26 18:18:52 +00:00
|
|
|
</button>
|
|
|
|
|
|
|
|
|
|
<button
|
|
|
|
|
onClick={onPlayPause}
|
|
|
|
|
className={cn(
|
2026-02-12 01:09:29 +00:00
|
|
|
"flex items-center justify-center rounded-full bg-primary text-black flex-shrink-0 active:scale-95 transition-all shadow-sm",
|
2026-02-10 21:51:51 +00:00
|
|
|
playSize
|
2026-01-26 18:18:52 +00:00
|
|
|
)}
|
|
|
|
|
>
|
|
|
|
|
{isPlaying ? (
|
2026-02-10 21:51:51 +00:00
|
|
|
<Pause className={cn(playIconSize, "fill-current")} />
|
2026-01-26 18:18:52 +00:00
|
|
|
) : (
|
2026-02-10 21:51:51 +00:00
|
|
|
<Play className={cn(playIconSize, "fill-current ml-0.5")} />
|
2026-01-26 18:18:52 +00:00
|
|
|
)}
|
|
|
|
|
</button>
|
|
|
|
|
|
|
|
|
|
<button
|
|
|
|
|
onClick={onNext}
|
refactor: Phase 6 — Migrate feature modules to SUMI tokens
- auth: Replace gray-* with muted/border tokens, text-foreground
- settings: TwoFactorSettings + NotificationSettings text-foreground
- chat: ChatInput, ConversationItem, ChatPage — text-foreground,
remove kodo references
- player: PlayerExpanded, PlayerQueue, PlayerControls — text-foreground,
remove cyan/magenta gradients
- playlists: All components — text-foreground for badges/headings
- tracks: TrackCard, TrackListRow — text-foreground, remove glow effects
- studio: FileGridCard — text-foreground
- library: LibraryPageGrid — remove hover-glow-cyan, shadow-card-glow-cyan
- profile: UserProfilePageHeader — text-foreground
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 01:06:28 +00:00
|
|
|
className={cn(iconBtnClass, size, "text-foreground hover:text-primary hover:bg-white/5")}
|
2026-01-26 18:18:52 +00:00
|
|
|
>
|
2026-02-10 21:51:51 +00:00
|
|
|
<SkipForward className={cn(iconSize, "fill-current")} />
|
2026-01-26 18:18:52 +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 content="Repeat">
|
|
|
|
|
<button
|
|
|
|
|
onClick={onRepeat}
|
|
|
|
|
className={cn(
|
2026-02-10 21:51:51 +00:00
|
|
|
iconBtnClass,
|
|
|
|
|
size,
|
|
|
|
|
"relative",
|
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
|
|
|
repeat !== 'off'
|
|
|
|
|
? "text-primary bg-primary/10 shadow-queue-item-current"
|
refactor: Phase 6 — Migrate feature modules to SUMI tokens
- auth: Replace gray-* with muted/border tokens, text-foreground
- settings: TwoFactorSettings + NotificationSettings text-foreground
- chat: ChatInput, ConversationItem, ChatPage — text-foreground,
remove kodo references
- player: PlayerExpanded, PlayerQueue, PlayerControls — text-foreground,
remove cyan/magenta gradients
- playlists: All components — text-foreground for badges/headings
- tracks: TrackCard, TrackListRow — text-foreground, remove glow effects
- studio: FileGridCard — text-foreground
- library: LibraryPageGrid — remove hover-glow-cyan, shadow-card-glow-cyan
- profile: UserProfilePageHeader — text-foreground
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 01:06:28 +00:00
|
|
|
: "text-muted-foreground hover:text-foreground hover:bg-white/5"
|
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
|
|
|
)}
|
|
|
|
|
>
|
|
|
|
|
<Repeat className={cn("w-4 h-4", isExpanded && "w-5 h-5")} />
|
|
|
|
|
{repeat === 'track' && (
|
2026-02-10 21:51:51 +00:00
|
|
|
<span className="absolute -top-0.5 -right-0.5 text-[8px] font-bold bg-primary text-black px-1 rounded-full">1</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>
|
2026-01-26 18:18:52 +00:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|