@@ -18,6 +18,7 @@ interface FileCardProps {
1818 onDragEnd ?: ( ) => void ;
1919 activeFolderId ?: number | null ;
2020 height ?: number ;
21+ onToggleSelection ?: ( ) => void ;
2122}
2223
2324// Check if file is an image type that can have a thumbnail
@@ -26,7 +27,7 @@ function isImageFile(filename: string): boolean {
2627 return [ 'jpg' , 'jpeg' , 'png' , 'gif' , 'webp' , 'bmp' ] . includes ( ext ) ;
2728}
2829
29- export function FileCard ( { file, onDelete, onDownload, onPreview, isSelected, onClick, onContextMenu, onDrop, onDragStart, onDragEnd, activeFolderId, height } : FileCardProps ) {
30+ export function FileCard ( { file, onDelete, onDownload, onPreview, isSelected, onClick, onContextMenu, onDrop, onDragStart, onDragEnd, activeFolderId, height, onToggleSelection } : FileCardProps ) {
3031 const isFolder = file . type === 'folder' ;
3132 const [ isDragOver , setIsDragOver ] = useState ( false ) ;
3233 const [ thumbnail , setThumbnail ] = useState < string | null > ( null ) ;
@@ -124,7 +125,13 @@ export function FileCard({ file, onDelete, onDownload, onPreview, isSelected, on
124125 ) }
125126
126127 { /* Selection Checkmark */ }
127- < div className = { `absolute top-2 left-2 w-5 h-5 rounded-full border flex items-center justify-center transition-all z-10 ${ isSelected ? 'bg-telegram-primary border-telegram-primary' : 'border-white/50 bg-black/30 opacity-0 group-hover:opacity-100' } ` } >
128+ < div
129+ onClick = { ( e ) => {
130+ e . stopPropagation ( ) ;
131+ if ( onToggleSelection ) onToggleSelection ( ) ;
132+ } }
133+ className = { `absolute top-2 left-2 w-5 h-5 rounded-full border flex items-center justify-center transition-all z-10 cursor-pointer ${ isSelected ? 'bg-telegram-primary border-telegram-primary' : 'border-white/50 bg-black/30 opacity-0 group-hover:opacity-100' } ` }
134+ >
128135 { isSelected && < div className = "w-1.5 h-1.5 bg-black rounded-full" /> }
129136 </ div >
130137
0 commit comments