{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "file-browser",
  "title": "Station file browser",
  "description": "Explore the ferry desk’s folders and inspect the source for each route and shift file.",
  "registryDependencies": [
    "https://www.cyberspec.dev/r/recipe-layout.json",
    "https://www.cyberspec.dev/r/code-block.json",
    "https://www.cyberspec.dev/r/tree.json"
  ],
  "files": [
    {
      "path": "registry/cyber/recipes/file-browser.tsx",
      "content": "\"use client\"\n\nimport { useState } from \"react\"\nimport { CodeBlock } from \"@/registry/cyber/ui/code-block\"\nimport { Tree } from \"@/registry/cyber/ui/tree\"\nimport \"./recipe-layout.css\"\n\nconst folders = [\n  { value: \"routes\", label: \"routes\", files: [\n    { name: \"ferry.json\", content: '{\\n  \"dock\": \"Glasswater\",\\n  \"first_departure\": \"05:40\"\\n}' },\n    { name: \"footbridge.json\", content: '{\\n  \"crossing\": \"South span\",\\n  \"clearance_m\": 12\\n}' },\n  ] },\n  { value: \"shifts\", label: \"shifts\", files: [\n    { name: \"night.json\", content: '{\\n  \"lead\": \"Ilya Brandt\",\\n  \"handoff\": \"05:15\"\\n}' },\n    { name: \"day.json\", content: '{\\n  \"lead\": \"Mara Voss\",\\n  \"handoff\": \"17:15\"\\n}' },\n  ] },\n]\nconst tree = folders.map(folder => ({\n  value: folder.value, label: folder.label,\n  children: folder.files.map(file => ({ value: file.name, label: file.name })),\n}))\nconst files = folders.flatMap(folder => folder.files)\n\nexport default function FileBrowser() {\n  const [selection, setSelection] = useState(files[0].name)\n  const file = files.find(entry => entry.name === selection)\n  const folder = folders.find(entry => entry.value === selection)\n\n  return (\n    <div className=\"sink-stack\">\n      <Tree label=\"Station files\" items={tree} defaultExpanded={[\"routes\"]} value={selection}\n        onValueChange={next => { if (next) setSelection(next) }} />\n      {file ? <CodeBlock language=\"json\" filename={file.name} label={`Contents of ${file.name}`}\n        code={file.content} numbers={false} /> :\n        <p className=\"sink-note\">{folder?.label} contains {folder?.files.length} files. Open a file to inspect its contents.</p>}\n    </div>\n  )\n}\n",
      "type": "registry:component",
      "target": "@components/recipes/file-browser.tsx"
    }
  ],
  "categories": [
    "recipe",
    "workspace"
  ],
  "type": "registry:component"
}
