import { Suspense } from "react"; import { notFound } from "next/navigation"; import Link from "next/link"; import { getRepository, getRepoFileTree, getRepoBranches } from "@/actions/repositories"; import { FileTree } from "@/components/file-tree"; import { BranchSelector } from "@/components/branch-selector"; import { Badge } from "@/components/ui/badge"; import { Lock, Globe, ChevronRight, Home } from "lucide-react"; async function TreeContent({ username, repoName, branch, dirPath }: { username: string; repoName: string; branch: string; dirPath: string }) { const fileTree = await getRepoFileTree(username, repoName, branch, dirPath); if (!fileTree) { notFound(); } return ; } function TreeSkeleton() { return (
{[...Array(5)].map((_, i) => (
))}
); } export default async function TreePage({ params }: { params: Promise<{ username: string; repo: string; path: string[] }> }) { const { username, repo: repoName, path: pathSegments } = await params; const branch = pathSegments[0]; const dirPath = pathSegments.slice(1).join("/"); const [repo, branches] = await Promise.all([getRepository(username, repoName), getRepoBranches(username, repoName)]); if (!repo) { notFound(); } const pathParts = dirPath.split("/").filter(Boolean); return (
{username} / {repoName} {repo.visibility === "private" ? ( <> Private ) : ( <> Public )}
}>
); }