Architecture: - Feature-sliced directory: entities/, shared/, features/, widgets/ - Consolidated API client (shared/api/client.ts) — all endpoints in one file - Single WebSocket manager (shared/ws/socket.ts) with typed event bus - Extracted hooks: useAudioPlayback, useAudioTransmit, useLocalStorage, useUIState - UI primitives moved to shared/ui/ with barrel export - Added Skeleton, Toast, MobileTabBar components Bug fixes (8/8): 1. useMemo→useEffect in RecordingsSubPanel (async side-effect anti-pattern) 2. ArrayBuffer.slice() before WebSocket send (shared buffer bug) 3. Proper useEffect dependency arrays throughout 4. Stable React keys (no index fallbacks) 5. onReanalyze properly awaited (Promise<void> return) 6. monitorGuild memoized with useMemo 7. localStorage validation with shape checking 8. Deleted duplicate socket logic (ws/client.ts removed) UI polish: - Glass-morphism design tokens (backdrop-blur, translucent cards) - Gradient mesh background with subtle radial overlays - Expandable sidebar + mobile bottom tab bar - Skeleton loading placeholders - Audio visualizer with CSS pulse animation Deleted: src/api/, src/components/, src/hooks/, src/types/, src/ws/, src/lib/ Added: 40 new files across feature-sliced structure Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
47 lines
1.9 KiB
TypeScript
47 lines
1.9 KiB
TypeScript
import type { MediaItem } from "../../../shared/api/client";
|
|
import { Badge } from "../../../shared/ui";
|
|
import { Music2, MonitorUp } from "lucide-react";
|
|
|
|
interface NowPlayingProps {
|
|
current: MediaItem | null;
|
|
queue: MediaItem[];
|
|
}
|
|
|
|
export function NowPlaying({ current, queue }: NowPlayingProps) {
|
|
if (!current) return null;
|
|
|
|
return (
|
|
<div className="rounded-2xl border border-border bg-card shadow-sm">
|
|
<div className="p-4">
|
|
<div className="flex items-center gap-3">
|
|
<div className="flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-primary/15 text-primary">
|
|
{current.mode === "screen" ? <MonitorUp className="h-5 w-5" /> : <Music2 className="h-5 w-5" />}
|
|
</div>
|
|
<div className="min-w-0 flex-1">
|
|
<div className="truncate font-medium">{current.title}</div>
|
|
<div className="truncate text-xs text-muted-foreground">{current.source}</div>
|
|
</div>
|
|
<Badge variant={current.mode === "screen" ? "warning" : "success"}>{current.mode ?? "music"}</Badge>
|
|
</div>
|
|
</div>
|
|
|
|
{queue.length > 0 && (
|
|
<div className="border-t border-border p-4">
|
|
<div className="mb-2 text-sm font-medium">Queue ({queue.length})</div>
|
|
<div className="space-y-1.5">
|
|
{queue.map((item, i) => (
|
|
<div key={`${item.source}-${i}`} className="flex items-center gap-3 rounded-lg border border-border bg-background/60 p-2.5 text-sm">
|
|
<span className="flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-muted text-xs font-medium text-muted-foreground">{i + 1}</span>
|
|
<div className="min-w-0">
|
|
<div className="truncate font-medium">{item.title}</div>
|
|
<div className="truncate text-xs text-muted-foreground">{item.source}</div>
|
|
</div>
|
|
</div>
|
|
))}
|
|
</div>
|
|
</div>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|