From 12ca95b427ac0651e6a267adf2101f65431992d3 Mon Sep 17 00:00:00 2001 From: kenneth Date: Wed, 17 Sep 2025 22:47:55 +0000 Subject: [PATCH] feat: impl file path breadcrumb nav --- packages/web/src/files/files-page.tsx | 51 ++++++++++++++++++--------- 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/packages/web/src/files/files-page.tsx b/packages/web/src/files/files-page.tsx index 7b2e180..a8c097c 100644 --- a/packages/web/src/files/files-page.tsx +++ b/packages/web/src/files/files-page.tsx @@ -1,7 +1,7 @@ import { api } from "@fileone/convex/_generated/api" -import { splitPath } from "@fileone/path" +import { baseName, splitPath } from "@fileone/path" import { useMutation } from "@tanstack/react-query" -import { useParams } from "@tanstack/react-router" +import { Link } from "@tanstack/react-router" import { useMutation as useConvexMutation } from "convex/react" import { useSetAtom } from "jotai" import { @@ -23,6 +23,7 @@ import { TextFileIcon } from "../components/icons/text-file-icon" import { Breadcrumb, BreadcrumbItem, + BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, @@ -35,21 +36,7 @@ export function FilesPage({ path }: { path: string }) { return ( <>
- - - - All Files - - {splitPath(path).map((p) => ( - - - - {p} - - - ))} - - +
@@ -62,6 +49,36 @@ export function FilesPage({ path }: { path: string }) { ) } +function FilePathBreadcrumb({ path }: { path: string }) { + const pathComponents = splitPath(path) + const base = baseName(path) + return ( + + + + + All Files + + + {pathComponents.map((p) => ( + + + {p === base ? ( + {p} + ) : ( + + + {p} + + + )} + + ))} + + + ) +} + // tags: upload, uploadfile, uploadfilebutton, fileupload, fileuploadbutton function UploadFileButton() { const generateUploadUrl = useConvexMutation(api.files.generateUploadUrl)