diff --git a/app/components/FileItem.tsx b/app/components/FileItem.tsx index a72418d..907e335 100644 --- a/app/components/FileItem.tsx +++ b/app/components/FileItem.tsx @@ -3,6 +3,14 @@ import { useState, useRef } from "react"; import { getFileIcon, formatFileSize, formatDate, type FileType } from "../lib/helpers"; import FileItemMenu from "./FileItemMenu"; +import { + Item, + ItemActions, + ItemContent, + ItemDescription, + ItemMedia, + ItemTitle, +} from "@/components/ui/item"; export type { FileType }; @@ -61,7 +69,7 @@ export default function FileItem({ } clickCountRef.current += 1; - + if (clickCountRef.current === 1) { clickTimeoutRef.current = setTimeout(() => { if (clickCountRef.current === 1) { @@ -88,13 +96,13 @@ export default function FileItem({ setTimeout(() => { touchHandledRef.current = false; }, 400); - + const currentTime = new Date().getTime(); const tapLength = currentTime - lastTapRef.current; - + if (tapLength < 300 && tapLength > 0) { // Double tap detected - + if (clickTimeoutRef.current) { clearTimeout(clickTimeoutRef.current); clickTimeoutRef.current = null; @@ -112,18 +120,26 @@ export default function FileItem({ clickTimeoutRef.current = null; }, 300); } - + lastTapRef.current = currentTime; }; + const secondaryLabel = + file.lastModified + ? formatDate(file.lastModified) + : file.type === "folder" + ? "Folder" + : file.size + ? formatFileSize(file.size) + : "File"; + if (view === "grid") { return ( -
setIsHovered(true)} onMouseLeave={() => setIsHovered(false)} onClick={handleClick} @@ -138,34 +154,42 @@ export default function FileItem({ }} > {isHovered && ( - + + + )} -
+ {getFileIcon(file.type, file.mimeType)} -
-

- {file.name} -

-
+ + + + {file.name} + + + {secondaryLabel} + + + ); } // List view return ( -
setIsHovered(true)} onMouseLeave={() => setIsHovered(false)} onClick={handleClick} @@ -179,32 +203,39 @@ export default function FileItem({ onContextMenu?.(file, event); }} > -
+ {getFileIcon(file.type, file.mimeType)} -
-
-

{file.name}

-
-
- {file.lastModified && formatDate(file.lastModified)} -
-
- {file.size && formatFileSize(file.size)} -
+ + + + {file.name} + + {secondaryLabel} + + + + + + {file.size ? formatFileSize(file.size) : file.type === "folder" ? "—" : ""} + + + {isHovered && ( - + + + )} -
+ ); } diff --git a/app/components/FileList.tsx b/app/components/FileList.tsx index 8c58d55..014ac82 100644 --- a/app/components/FileList.tsx +++ b/app/components/FileList.tsx @@ -4,6 +4,7 @@ import { useState, useEffect } from "react"; import FileItem, { FileItemData } from "./FileItem"; import Toolbar from "./shared/Toolbar"; import EmptyState from "./shared/EmptyState"; +import { ItemGroup } from "@/components/ui/item"; interface FileListProps { files: FileItemData[]; @@ -60,7 +61,7 @@ export default function FileList({ {files.length === 0 ? ( ) : view === "grid" ? ( -
+ {files.map((file) => ( ))} -
+ ) : ( -
+ {files.map((file) => ( ))} -
+ )} diff --git a/app/components/shared/Toolbar.tsx b/app/components/shared/Toolbar.tsx index 312e304..98c8935 100644 --- a/app/components/shared/Toolbar.tsx +++ b/app/components/shared/Toolbar.tsx @@ -18,8 +18,8 @@ export default function Toolbar({ actions, }: ToolbarProps) { return ( -
-