17 lines · 536 B · TypeScript
RawDownload
export interface FileBreadcrumb {  label: string;  path: string;  kind: "project" | "directory" | "file";} export function fileBreadcrumbs(projectName: string, relativePath: string): FileBreadcrumb[] {  const parts = relativePath.split("/").filter(Boolean);  return [    { label: projectName, path: "", kind: "project" },    ...parts.map((part, index) => ({      label: part,      path: parts.slice(0, index + 1).join("/"),      kind: index === parts.length - 1 ? ("file" as const) : ("directory" as const),    })),  ];}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t