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"; 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 = await getRepository(username, repoName); if (!repo) { notFound(); } const [fileTree, branches] = await Promise.all([ getRepoFileTree(username, repoName, branch, dirPath), getRepoBranches(username, repoName), ]); if (!fileTree) { notFound(); } const pathParts = dirPath.split("/").filter(Boolean); return (
{username} / {repoName} {repo.visibility === "private" ? ( <> Private ) : ( <> Public )}
); }