Player2 provides a visual interface for viewing and managing your Spotify playback queue. The queue drawer displays upcoming tracks with album artwork, artist information, and interactive controls.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/scoboslor/player2/llms.txt
Use this file to discover all available pages before exploring further.
Architecture
The queue management system is built with:- Framer Motion Reorder - Drag-and-drop functionality
- Context Menu - Right-click options for track actions
- Real-time Updates - Automatic queue synchronization
- Animated Transitions - Smooth enter/exit animations
Queue Fetching
The queue is fetched from Spotify’s API and stored in theSpotifyContext:
src/contexts/SpotifyContext.tsx
Only tracks are included in the queue. Other content types (like podcasts) are filtered out.
Queue Drawer Component
TheQueueDrawer displays all tracks in the current queue:
src/components/QueueDrawer.tsx
- Syncs local state with the global queue
- Uses
Reorder.Groupfor drag-and-drop - Wraps items in
AnimatePresencefor exit animations
Individual Queue Items
Each track in the queue is rendered as an interactive item:src/components/QueueDrawer.tsx
Animation System
Staggered Entry
Queue items animate in with a staggered delay:src/components/QueueDrawer.tsx
Animation Sequence
- Item starts 10px below final position with 0 opacity
- Each subsequent item has 0.5s additional delay
- Items fade in and slide up to final position
- Animation takes 0s once started (instant after delay)
Exit Animation
When items are removed, they smoothly collapse:src/components/QueueDrawer.tsx
Artist Parsing & Navigation
Artist names are clickable and open the artist detail view:src/components/QueueDrawer.tsx
- Multiple artists separated by commas
- Hover underline for visual feedback
- Click opens artist drawer
- Each artist retains their Spotify ID for API calls
Context Menu Integration
Right-clicking (or long-pressing) a queue item opens a context menu with track actions:src/components/QueueDrawer.tsx
The
ContextMenuDemo component wraps the track display and provides actions like “Add to playlist”, “Go to album”, “Go to artist”, etc.Drag and Drop Reordering
Tracks can be reordered by dragging (currently visual only):src/components/QueueDrawer.tsx
src/components/QueueDrawer.tsx
Queue Refresh
The queue automatically refreshes when:- The current track changes
- The user manually triggers a refresh
Usage
Performance Optimizations
Efficient Re-renders
Efficient Re-renders
The component only re-renders when the queue changes, not on every playback update.
Image Loading
Image Loading
Album artwork uses the smallest image size (10x10 rem) for faster loading.
Lazy Animations
Lazy Animations
Framer Motion’s AnimatePresence only animates items that are being added or removed.
Pointer Events
Pointer Events
Album artwork has
pointer-events-none to prevent accidental interaction during dragging.