import { useDemoTimeline } from "~/hooks/use-demo-timeline"; import { cn } from "~/utils/cn"; import { DemoWindow } from "../DemoWindow"; const TYPED = " if (!query) return items;"; const CHARS_PER_STEP = 3; const STEPS = Math.ceil(TYPED.length / CHARS_PER_STEP); const INTERVAL_MS = 160; const TREE = [ { name: "src/", depth: 0 }, { name: "palette/", depth: 1 }, { name: "rank.ts", depth: 2, active: true }, { name: "fuzzy.ts", depth: 2, agent: true }, { name: "README.md", depth: 0 }, ] as const; const BEFORE = ['import { fuzzy } from "./fuzzy";', "", "export function rank(items: Item[], query: string) {"]; const AFTER = [" return [...exact(items, query), ...fuzzy(items, query)];", "}"]; const INDENT = ["pl-2", "pl-5", "pl-8"] as const; export function EditorDemo({ className }: { className?: string }) { const step = useDemoTimeline(STEPS, INTERVAL_MS); const typed = TYPED.slice(0, step * CHARS_PER_STEP); return (
{BEFORE.map((line, index) => (

{index + 1} {line || " "}

))}

{BEFORE.length + 1} {typed} you

{AFTER.map((line, index) => (

{BEFORE.length + 2 + index} {line}

))}

● agent is editing fuzzy.ts

); }