@@ -6,10 +6,9 @@ interface PadMenuProps {
66 padIndex : number ;
77 isOpen : boolean ;
88 onClose : ( ) => void ;
9- anchorRect ?: DOMRect ;
109}
1110
12- export const PadMenu : React . FC < PadMenuProps > = ( { padIndex, isOpen, onClose, anchorRect } ) => {
11+ export const PadMenu : React . FC < PadMenuProps > = ( { padIndex, isOpen, onClose } ) => {
1312 const { pads, currentChannel, toggleMute, toggleSolo, clearPad, setCloneMode } = usePadStore ( ) ;
1413 const pad = pads [ `${ currentChannel } -${ padIndex } ` ] ;
1514 const menuRef = useRef < HTMLDivElement > ( null ) ;
@@ -28,60 +27,62 @@ export const PadMenu: React.FC<PadMenuProps> = ({ padIndex, isOpen, onClose, anc
2827
2928 if ( ! isOpen || ! pad ) return null ;
3029
31- const menuStyle : React . CSSProperties = {
32- position : 'fixed' ,
33- top : anchorRect ? anchorRect . bottom + 8 : '50%' ,
34- left : anchorRect ? anchorRect . left : '50%' ,
35- transform : anchorRect ? 'none' : 'translate(-50%, -50%)' ,
36- zIndex : 1000 ,
37- } ;
38-
3930 return (
40- < div
41- ref = { menuRef }
42- style = { menuStyle }
43- className = "bg-zinc-900 border border-zinc-800 rounded-lg shadow-2xl p-1 min-w-[160px] animate-in fade-in zoom-in duration-200"
44- >
45- < div className = "flex items-center justify-between px-3 py-2 border-b border-zinc-800 mb-1" >
46- < span className = "text-[10px] font-bold text-zinc-500 uppercase tracking-widest" > Pad { padIndex + 1 } Options</ span >
47- < button onClick = { onClose } className = "text-zinc-500 hover:text-white transition-colors" >
48- < X size = { 14 } />
49- </ button >
50- </ div >
51-
52- < button
53- onClick = { ( ) => { toggleSolo ( padIndex ) ; onClose ( ) ; } }
54- className = { `w-full flex items-center gap-3 px-3 py-2 text-xs font-bold transition-all rounded ${ pad . solo ? 'bg-amber-500/20 text-amber-500' : 'text-zinc-300 hover:bg-white/5 hover:text-white' } ` }
31+ < div className = "fixed inset-0 z-[100] bg-black/80 backdrop-blur-sm flex items-center justify-center p-4 animate-in fade-in duration-200" onClick = { ( e ) => { if ( e . target === e . currentTarget ) onClose ( ) ; } } >
32+ < div
33+ ref = { menuRef }
34+ className = "w-full max-w-xs bg-zinc-900 border border-white/10 rounded-2xl shadow-2xl overflow-hidden animate-in zoom-in-95 duration-200"
5535 >
56- < Music size = { 16 } className = { pad . solo ? 'animate-pulse' : '' } />
57- < span > { pad . solo ? 'Unsolo Pad' : 'Solo Pad' } </ span >
58- </ button >
36+ < div className = "flex items-center justify-between px-4 py-3 border-b border-white/5 bg-zinc-800/50" >
37+ < span className = "text-[10px] font-extrabold text-zinc-400 uppercase tracking-widest" > Pad { padIndex + 1 } Options</ span >
38+ < button onClick = { onClose } className = "text-zinc-500 hover:text-white transition-colors p-1" >
39+ < X size = { 18 } />
40+ </ button >
41+ </ div >
5942
60- < button
61- onClick = { ( ) => { toggleMute ( padIndex ) ; onClose ( ) ; } }
62- className = { `w-full flex items-center gap-3 px-3 py-2 text-xs font-bold transition-all rounded ${ pad . mute ? 'bg-retro-accent/20 text-retro-accent' : 'text-zinc-300 hover:bg-white/5 hover:text-white' } ` }
63- >
64- { pad . mute ? < Volume2 size = { 16 } /> : < VolumeX size = { 16 } /> }
65- < span > { pad . mute ? 'Unmute Pad' : 'Mute Pad' } </ span >
66- </ button >
43+ < div className = "p-2 space-y-1" >
44+ < button
45+ onClick = { ( ) => { toggleSolo ( padIndex ) ; onClose ( ) ; } }
46+ className = { `w-full flex items-center gap-3 px-4 py-3 text-xs font-bold uppercase transition-all rounded-xl ${ pad . solo ? 'bg-amber-500/20 text-amber-500' : 'text-zinc-300 hover:bg-white/5 hover:text-white' } ` }
47+ >
48+ < Music size = { 18 } className = { pad . solo ? 'animate-pulse' : '' } />
49+ < span > { pad . solo ? 'Unsolo Pad' : 'Solo Pad' } </ span >
50+ </ button >
6751
68- < button
69- onClick = { ( ) => { setCloneMode ( ` ${ currentChannel } - ${ padIndex } ` ) ; onClose ( ) ; } }
70- className = " w-full flex items-center gap-3 px-3 py-2 text-xs font-bold text-zinc-300 hover:bg-white/5 hover:text-white transition-all rounded"
71- >
72- < Copy size = { 16 } />
73- < span > Clone Pad</ span >
74- </ button >
52+ < button
53+ onClick = { ( ) => { toggleMute ( padIndex ) ; onClose ( ) ; } }
54+ className = { ` w-full flex items-center gap-3 px-4 py-3 text-xs font-bold uppercase transition-all rounded-xl ${ pad . mute ? 'bg-retro-accent/20 text-retro-accent' : 'text- zinc-300 hover:bg-white/5 hover:text-white' } ` }
55+ >
56+ { pad . mute ? < Volume2 size = { 18 } /> : < VolumeX size = { 18 } /> }
57+ < span > { pad . mute ? 'Unmute Pad' : 'Mute Pad' } </ span >
58+ </ button >
7559
76- < div className = "h-px bg-zinc-800 my-1 mx-2" />
60+ < button
61+ onClick = { ( ) => { setCloneMode ( `${ currentChannel } -${ padIndex } ` ) ; onClose ( ) ; } }
62+ className = "w-full flex items-center gap-3 px-4 py-3 text-xs font-bold uppercase text-zinc-300 hover:bg-white/5 hover:text-white transition-all rounded-xl"
63+ >
64+ < Copy size = { 18 } />
65+ < span > Clone Pad</ span >
66+ </ button >
7767
78- < button
79- onClick = { ( ) => { if ( confirm ( `Clear Pad ${ padIndex + 1 } ?` ) ) { clearPad ( padIndex ) ; onClose ( ) ; } } }
80- className = "w-full flex items-center gap-3 px-3 py-2 text-xs font-bold text-red-400 hover:bg-red-400/10 transition-all rounded"
81- >
82- < Trash2 size = { 16 } />
83- < span > Clear Pad</ span >
84- </ button >
68+ < div className = "h-px bg-white/5 my-1 mx-2" />
69+
70+ < button
71+ onClick = { ( ) => { if ( confirm ( `Clear Pad ${ padIndex + 1 } ?` ) ) { clearPad ( padIndex ) ; onClose ( ) ; } } }
72+ className = "w-full flex items-center gap-3 px-4 py-3 text-xs font-bold uppercase text-red-500 hover:bg-red-500/10 transition-all rounded-xl"
73+ >
74+ < Trash2 size = { 18 } />
75+ < span > Clear Pad</ span >
76+ </ button >
77+ </ div >
78+
79+ < button
80+ onClick = { onClose }
81+ className = "w-full py-4 bg-zinc-800/80 text-zinc-400 font-extrabold uppercase tracking-widest text-[10px] hover:text-white transition-colors"
82+ >
83+ Close
84+ </ button >
85+ </ div >
8586 </ div >
8687 ) ;
8788} ;
0 commit comments