@@ -16,7 +16,6 @@ import { bytesToReadable, durationToReadable, formatDate } from "@/lib/utils";
1616import useRouter from "@/hooks/usePRouter" ;
1717
1818import { Button } from "@/components/ui/button" ;
19- import { Card , CardHeader , CardTitle } from "@/components/ui/card" ;
2019import {
2120 ContextMenu ,
2221 ContextMenuContent ,
@@ -38,7 +37,6 @@ import {
3837 DropdownMenuTrigger ,
3938} from "@/components/ui/dropdown-menu" ;
4039import Icon , { type IconName } from "@/components/ui/icon" ;
41- import Image from "next/image" ;
4240
4341// import { GetMostRecentFileUpdate } from "@/actions/folder";
4442
@@ -320,7 +318,7 @@ const FileItemActions = ({
320318// =================================================================================================
321319// MAIN FILE ITEM COMPONENT
322320// =================================================================================================
323- export const FileItem = ( { data : file , layout } : Props ) => {
321+ export const FileItem = ( { data : file } : Props ) => {
324322 const router = useRouter ( ) ;
325323 const pathname = usePathname ( ) ;
326324 const [ isInfoModalOpen , setInfoModalOpen ] = useState ( false ) ;
@@ -371,85 +369,6 @@ export const FileItem = ({ data: file, layout }: Props) => {
371369 isFolder,
372370 } ;
373371
374- const renderGridItem = ( ) => (
375- < Card
376- className = "group relative cursor-pointer overflow-hidden transition-all duration-200 hover:shadow-sm"
377- onClick = { handleClick }
378- >
379- < div className = "relative flex h-32 w-full items-center justify-center bg-muted/30" >
380- { file . thumbnailLink && file . mimeType . includes ( "image" ) ? (
381- < Image
382- src = { `/api/thumb/${ file . encryptedId } ` }
383- alt = { file . name }
384- className = "h-full w-full object-cover transition-transform duration-300 group-hover:scale-105"
385- width = { 128 }
386- height = { 128 }
387- />
388- ) : (
389- < div className = "flex flex-col items-center justify-center" >
390- < div
391- className = "flex items-center justify-center w-16 h-16 rounded-xl mb-2 shadow-sm"
392- style = { {
393- backgroundColor : `${ fileColor } 15` ,
394- border : `2px solid ${ fileColor } 20` ,
395- } }
396- >
397- < Icon
398- name = { fileIcon }
399- className = "h-8 w-8 transition-colors"
400- style = { { color : fileColor } }
401- />
402- </ div >
403- { file . fileExtension && (
404- < div
405- className = "mt-1 px-2 py-1 rounded text-xs font-mono border transition-colors"
406- style = { {
407- backgroundColor : `${ fileColor } 10` ,
408- borderColor : `${ fileColor } 30` ,
409- color : fileColor ,
410- } }
411- >
412- { file . fileExtension . toUpperCase ( ) }
413- </ div >
414- ) }
415- </ div >
416- ) }
417- < div className = "absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity" >
418- < FileItemActions { ...actionProps } />
419- </ div >
420- </ div >
421- < CardHeader className = "p-3" >
422- < CardTitle className = "line-clamp-2 text-sm font-medium mb-2" >
423- { file . name }
424- </ CardTitle >
425- < div className = "flex items-center justify-between text-xs text-muted-foreground" >
426- < span className = "font-mono flex items-center gap-1" >
427- { isFolder ? (
428- < >
429- < div
430- className = "w-2 h-2 rounded-full"
431- style = { { backgroundColor : fileColor } }
432- > </ div >
433- < span > DIR</ span >
434- </ >
435- ) : (
436- < >
437- < div
438- className = "w-2 h-2 rounded-full"
439- style = { { backgroundColor : fileColor } }
440- > </ div >
441- < span > { bytesToReadable ( file . size ?? 0 ) } </ span >
442- </ >
443- ) }
444- </ span >
445- < span className = "font-mono" >
446- { formatDate ( file . modifiedTime ) . split ( " " ) [ 0 ] }
447- </ span >
448- </ div >
449- </ CardHeader >
450- </ Card >
451- ) ;
452-
453372 const renderListItem = ( ) => (
454373 < div
455374 className = "group flex cursor-pointer items-center gap-4 border-b border-border/30 p-3 transition-all duration-150 hover:bg-muted/30"
@@ -513,9 +432,7 @@ export const FileItem = ({ data: file, layout }: Props) => {
513432 return (
514433 < >
515434 < ContextMenu >
516- < ContextMenuTrigger >
517- { layout === "grid" ? renderGridItem ( ) : renderListItem ( ) }
518- </ ContextMenuTrigger >
435+ < ContextMenuTrigger > { renderListItem ( ) } </ ContextMenuTrigger >
519436 < ContextMenuContent className = "w-48" >
520437 < ContextMenuItem onSelect = { actionProps . onOpen } >
521438 < Icon name = "ArrowRight" className = "mr-2 h-4 w-4" />
0 commit comments