2025-07-14 23:07:09 +00:00
|
|
|
import { Suspense } from "react";
|
|
|
|
|
import { getBrowseParamsFromPathParam } from "../hooks/utils";
|
2025-06-06 19:38:16 +00:00
|
|
|
import { CodePreviewPanel } from "./components/codePreviewPanel";
|
2025-07-14 23:07:09 +00:00
|
|
|
import { Loader2 } from "lucide-react";
|
2025-06-06 19:38:16 +00:00
|
|
|
import { TreePreviewPanel } from "./components/treePreviewPanel";
|
2025-05-28 23:08:42 +00:00
|
|
|
|
2025-07-14 23:07:09 +00:00
|
|
|
interface BrowsePageProps {
|
|
|
|
|
params: {
|
|
|
|
|
path: string[];
|
|
|
|
|
domain: string;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default async function BrowsePage({ params: { path: _rawPath, domain } }: BrowsePageProps) {
|
|
|
|
|
const rawPath = decodeURIComponent(_rawPath.join('/'));
|
|
|
|
|
const { repoName, revisionName, path, pathType } = getBrowseParamsFromPathParam(rawPath);
|
|
|
|
|
|
2025-01-07 18:27:42 +00:00
|
|
|
return (
|
2025-06-06 19:38:16 +00:00
|
|
|
<div className="flex flex-col h-full">
|
2025-07-14 23:07:09 +00:00
|
|
|
<Suspense fallback={
|
|
|
|
|
<div className="flex flex-col w-full min-h-full items-center justify-center">
|
|
|
|
|
<Loader2 className="w-4 h-4 animate-spin" />
|
|
|
|
|
Loading...
|
|
|
|
|
</div>
|
|
|
|
|
}>
|
|
|
|
|
{pathType === 'blob' ? (
|
|
|
|
|
<CodePreviewPanel
|
|
|
|
|
path={path}
|
|
|
|
|
repoName={repoName}
|
|
|
|
|
revisionName={revisionName}
|
|
|
|
|
domain={domain}
|
|
|
|
|
/>
|
|
|
|
|
) : (
|
|
|
|
|
<TreePreviewPanel
|
|
|
|
|
path={path}
|
|
|
|
|
repoName={repoName}
|
|
|
|
|
revisionName={revisionName}
|
|
|
|
|
domain={domain}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
</Suspense>
|
2025-06-06 19:38:16 +00:00
|
|
|
</div>
|
2025-01-07 18:27:42 +00:00
|
|
|
)
|
2025-05-28 23:08:42 +00:00
|
|
|
}
|
2025-06-06 19:38:16 +00:00
|
|
|
|