File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ export function ContextMenu ( {
2+ x,
3+ y,
4+ asset,
5+ onClose,
6+ onCopy,
7+ onDelete,
8+ onRename,
9+ } : {
10+ x : number ;
11+ y : number ;
12+ asset : string ;
13+ onClose : ( ) => void ;
14+ onCopy : ( path : string ) => void ;
15+ onDelete ?: ( path : string ) => void ;
16+ onRename ?: ( oldPath : string , newPath : string ) => void ;
17+ } ) {
18+ return (
19+ < div
20+ className = "fixed inset-0 z-[200]"
21+ onClick = { onClose }
22+ onContextMenu = { ( e ) => {
23+ e . preventDefault ( ) ;
24+ onClose ( ) ;
25+ } }
26+ >
27+ < div
28+ className = "absolute bg-neutral-900 border border-neutral-700 rounded-lg shadow-xl py-1 min-w-[140px] text-xs"
29+ style = { { left : x , top : y } }
30+ >
31+ < button
32+ onClick = { ( e ) => {
33+ e . stopPropagation ( ) ;
34+ onCopy ( asset ) ;
35+ onClose ( ) ;
36+ } }
37+ className = "w-full text-left px-3 py-1.5 text-neutral-300 hover:bg-neutral-800 transition-colors"
38+ >
39+ Copy path
40+ </ button >
41+ { onRename && (
42+ < button
43+ onClick = { ( e ) => {
44+ e . stopPropagation ( ) ;
45+ onClose ( ) ;
46+ } }
47+ className = "w-full text-left px-3 py-1.5 text-neutral-300 hover:bg-neutral-800 transition-colors"
48+ >
49+ Rename
50+ </ button >
51+ ) }
52+ { onDelete && (
53+ < button
54+ onClick = { ( e ) => {
55+ e . stopPropagation ( ) ;
56+ onDelete ( asset ) ;
57+ onClose ( ) ;
58+ } }
59+ className = "w-full text-left px-3 py-1.5 text-red-400 hover:bg-neutral-800 transition-colors"
60+ >
61+ Delete
62+ </ button >
63+ ) }
64+ </ div >
65+ </ div >
66+ ) ;
67+ }
68+
69+ export function DeleteConfirm ( {
70+ name,
71+ onConfirm,
72+ onCancel,
73+ } : {
74+ name : string ;
75+ onConfirm : ( ) => void ;
76+ onCancel : ( ) => void ;
77+ } ) {
78+ return (
79+ < div className = "px-2 py-1.5 bg-red-950/30 border-l-2 border-red-500 flex items-center justify-between gap-2" >
80+ < span className = "text-[10px] text-red-400 truncate" > Delete { name } ?</ span >
81+ < div className = "flex items-center gap-1 flex-shrink-0" >
82+ < button
83+ onClick = { onConfirm }
84+ className = "px-2 py-0.5 text-[10px] rounded bg-red-600 text-white hover:bg-red-500 transition-colors"
85+ >
86+ Delete
87+ </ button >
88+ < button
89+ onClick = { onCancel }
90+ className = "px-2 py-0.5 text-[10px] rounded text-neutral-400 hover:text-neutral-200 transition-colors"
91+ >
92+ Cancel
93+ </ button >
94+ </ div >
95+ </ div >
96+ ) ;
97+ }
You can’t perform that action at this time.
0 commit comments