import { useDemoTimeline } from "~/hooks/use-demo-timeline"; import { Avatar } from "~/ui/Avatar"; import { Badge } from "~/ui/Badge"; import { cn } from "~/utils/cn"; import { DemoWindow } from "../DemoWindow"; const STEPS = 3; const INTERVAL_MS = 1500; const LINES = [ { kind: "ctx", n: 41, text: "export function rank(items: Item[], query: string) {" }, { kind: "del", n: 42, text: " return items.filter((item) => item.name.includes(query));" }, { kind: "add", n: 42, text: " return items.filter((item) => fuzzy(item.name, query));" }, { kind: "ctx", n: 43, text: "}" }, ] as const; const LINE_STYLES = { ctx: "text-kumo-subtle", del: "bg-danger-950/40 text-kumo-danger", add: "bg-success-950/40 text-kumo-success", } as const; const SIGN = { ctx: " ", del: "-", add: "+" } as const; export function ReviewDemo({ className }: { className?: string }) { const step = useDemoTimeline(STEPS, INTERVAL_MS); return (
{LINES.map((line) => (
{line.n} {SIGN[line.kind]} {line.text}
))}
= 1 ? "opacity-100" : "opacity-0", )} >

devon Keep the exact match first so short queries stay predictable.

= 2 ? "opacity-100" : "opacity-0", )} >

Suggested change

+ return [...exact(items, query), ...fuzzy(items, query)];

= STEPS ? "opacity-100" : "opacity-0")}> Suggestion applied by mara in 3f9a21c
); }