mirror of
https://github.com/get-drexa/drive.git
synced 2025-12-06 00:01:40 +00:00
refactor: top level dir + moved route
create a root directory entry in table for each user and move file browser under /directories/$id
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { createFileRoute, Outlet } from "@tanstack/react-router"
|
||||
import { useQuery as useConvexQuery } from "convex/react"
|
||||
import { SidebarInset, SidebarProvider } from "@/components/ui/sidebar"
|
||||
import { Toaster } from "@/components/ui/sonner"
|
||||
import { DashboardSidebar } from "@/dashboard/dashboard-sidebar"
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
import { api } from "@fileone/convex/_generated/api"
|
||||
import { createFileRoute } from "@tanstack/react-router"
|
||||
import { useQuery as useConvexQuery } from "convex/react"
|
||||
import { DirectoryPageContext } from "@/directories/directory-page/context"
|
||||
import { DirectoryPage } from "@/directories/directory-page/directory-page"
|
||||
import { DirectoryPageSkeleton } from "@/directories/directory-page/directory-page-skeleton"
|
||||
|
||||
export const Route = createFileRoute(
|
||||
"/_authenticated/_sidebar-layout/directories/$directoryId",
|
||||
)({
|
||||
component: RouteComponent,
|
||||
})
|
||||
|
||||
function RouteComponent() {
|
||||
const { directoryId } = Route.useParams()
|
||||
const directory = useConvexQuery(api.files.fetchDirectory, {
|
||||
directoryId,
|
||||
})
|
||||
const directoryContent = useConvexQuery(api.files.fetchDirectoryContent, {
|
||||
directoryId,
|
||||
})
|
||||
|
||||
if (!directory || !directoryContent) {
|
||||
return <DirectoryPageSkeleton />
|
||||
}
|
||||
|
||||
return (
|
||||
<DirectoryPageContext value={{ directory, directoryContent }}>
|
||||
<DirectoryPage />
|
||||
</DirectoryPageContext>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user