Open History to see the last commit
1export interface FileBreadcrumb {
2 label: string;
3 path: string;
4 kind: "project" | "directory" | "file";
5}
6
7export function fileBreadcrumbs(projectName: string, relativePath: string): FileBreadcrumb[] {
8 const parts = relativePath.split("/").filter(Boolean);
9 return [
10 { label: projectName, path: "", kind: "project" },
11 ...parts.map((part, index) => ({
12 label: part,
13 path: parts.slice(0, index + 1).join("/"),
14 kind: index === parts.length - 1 ? ("file" as const) : ("directory" as const),
15 })),
16 ];
17}