11/** biome-ignore-all lint/a11y/useButtonType: <explanation> */
22
33import { ChevronDownIcon , Disc3 , ListMusic , MoreHorizontal , User , X } from "lucide-react"
4- import { memo , useCallback , useState } from "react"
4+ import { memo , useCallback , useEffect , useState } from "react"
55import { useNavigate } from "react-router-dom"
66import { Badge } from "@/components/ui/badge"
77import { Button } from "@/components/ui/button"
@@ -13,14 +13,24 @@ import {
1313} from "@/components/ui/dropdown-menu"
1414import { Sheet , SheetContent } from "@/components/ui/sheet"
1515import { usePlayerStore } from "@/stores/playerStore"
16+ import DesktopQueuePanel from "./DesktopQueuePanel"
1617import NowPlayingTab from "./NowPlayingTab"
1718import QueueTab from "./QueueTab"
1819
1920const PlayerSheet = memo ( ( { isOpen, onClose, currentSong, onOpenModal } ) => {
20- const [ queueOpen , setQueueOpen ] = useState ( false )
21+ const [ mobileQueueOpen , setMobileQueueOpen ] = useState ( false )
22+ const [ queueReady , setQueueReady ] = useState ( false )
2123 const playlistLength = usePlayerStore ( ( s ) => s . playlist . length )
2224 const navigate = useNavigate ( )
2325
26+ useEffect ( ( ) => {
27+ if ( isOpen ) {
28+ const timer = setTimeout ( ( ) => setQueueReady ( true ) , 500 )
29+ return ( ) => clearTimeout ( timer )
30+ }
31+ setQueueReady ( false )
32+ } , [ isOpen ] )
33+
2434 const handleGoToAlbum = useCallback (
2535 ( e ) => {
2636 e . stopPropagation ( )
@@ -51,11 +61,9 @@ const PlayerSheet = memo(({ isOpen, onClose, currentSong, onOpenModal }) => {
5161 side = "bottom"
5262 className = "h-full w-full p-0 overflow-hidden border-0 bg-black"
5363 >
54- { /* Full-screen Now Playing - all screen sizes */ }
5564 < div className = "h-full w-full relative" >
5665 < NowPlayingTab currentSong = { currentSong } onOpenModal = { onOpenModal } isDesktop />
5766
58- { /* Floating controls overlay */ }
5967 < div className = "absolute top-4 left-4 right-4 flex items-center justify-between z-30" >
6068 < Button
6169 variant = "ghost"
@@ -70,8 +78,8 @@ const PlayerSheet = memo(({ isOpen, onClose, currentSong, onOpenModal }) => {
7078 < Button
7179 variant = "ghost"
7280 size = "icon"
73- onClick = { ( ) => setQueueOpen ( true ) }
74- className = "h-10 w-10 bg-white/10 hover:bg-white/20 rounded-full transition-colors duration-300 relative"
81+ onClick = { ( ) => setMobileQueueOpen ( true ) }
82+ className = "lg:hidden h-10 w-10 bg-white/10 hover:bg-white/20 rounded-full transition-colors duration-300 relative"
7583 >
7684 < ListMusic className = "h-5 w-5 text-white" />
7785 < span className = "absolute -top-1 -right-1 min-w-[18px] h-[18px] rounded-full bg-white/25 text-[10px] text-white font-semibold flex items-center justify-center px-1" >
@@ -115,16 +123,21 @@ const PlayerSheet = memo(({ isOpen, onClose, currentSong, onOpenModal }) => {
115123 </ div >
116124 </ div >
117125
118- { /* Queue slide-over panel */ }
126+ { /* Desktop: always-visible queue panel, content delayed */ }
127+ < div className = "hidden lg:block" >
128+ < DesktopQueuePanel ready = { queueReady } />
129+ </ div >
130+
131+ { /* Mobile: full-screen slide-over queue */ }
119132 < div
120- className = { `absolute inset-0 z-40 transition-all duration-500 ease-out ${ queueOpen ? "pointer-events-auto" : "pointer-events-none" } ` }
133+ className = { `lg:hidden absolute inset-0 z-40 transition-all duration-500 ease-out ${ mobileQueueOpen ? "pointer-events-auto" : "pointer-events-none" } ` }
121134 >
122135 < div
123- className = { `absolute inset-0 bg-black/70 transition-opacity duration-500 ${ queueOpen ? "opacity-100" : "opacity-0" } ` }
124- onClick = { ( ) => setQueueOpen ( false ) }
136+ className = { `absolute inset-0 bg-black/70 transition-opacity duration-500 ${ mobileQueueOpen ? "opacity-100" : "opacity-0" } ` }
137+ onClick = { ( ) => setMobileQueueOpen ( false ) }
125138 />
126139 < div
127- className = { `absolute top-0 right-0 bottom-0 w-full sm:w-[420px] bg-[#0a0a0a]/95 transition-transform duration-500 ease-out flex flex-col ${ queueOpen ? "translate-x-0" : "translate-x-full" } ` }
140+ className = { `absolute top-0 right-0 bottom-0 w-full sm:w-105 bg-black/10 backdrop-blur-xl transition-transform duration-500 ease-out flex flex-col border-l border-white/4 ${ mobileQueueOpen ? "translate-x-0" : "translate-x-full" } ` }
128141 >
129142 < div className = "h-16 px-5 flex items-center justify-between shrink-0" >
130143 < div className = "flex items-center gap-3" >
@@ -140,7 +153,7 @@ const PlayerSheet = memo(({ isOpen, onClose, currentSong, onOpenModal }) => {
140153 < Button
141154 variant = "ghost"
142155 size = "icon"
143- onClick = { ( ) => setQueueOpen ( false ) }
156+ onClick = { ( ) => setMobileQueueOpen ( false ) }
144157 className = "h-9 w-9 bg-white/10 hover:bg-white/20 rounded-full transition-colors duration-300"
145158 >
146159 < X className = "h-4 w-4 text-white" />
0 commit comments