{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "margin-note-latency-demo",
  "type": "registry:block",
  "title": "Margin Note: Incident Read",
  "description": "Annotated Line Chart example, Incident Read: A day of p95 latency on an API. The reader stops at the morning peak, the deploy that sent it to 842 ms and the rollback that brought it down. A take on the chart (graph). Fits stats and app UI sections.",
  "author": "KeyframeUI <https://keyframeui.com>",
  "categories": [
    "stats",
    "app-ui",
    "chart",
    "annotation",
    "data",
    "ai"
  ],
  "docs": "Live preview, examples and props: https://keyframeui.com/components/margin-note#margin-note-latency-demo",
  "registryDependencies": [
    "https://keyframeui.com/r/margin-note.json"
  ],
  "files": [
    {
      "path": "components/margin-note-latency-demo.tsx",
      "type": "registry:component",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nimport { MarginNote, type MarginNoteNote } from \"@/components/ui/margin-note\";\n\nconst HOURS = Array.from({ length: 24 }, (_, h) => `${String(h).padStart(2, \"0\")}:00`);\nconst P95 = [182, 176, 171, 169, 172, 180, 196, 214, 229, 238, 231, 224, 219, 221, 842, 516, 207, 199, 194, 190, 188, 185, 183, 181];\n\nconst NOTES: MarginNoteNote[] = [\n  { at: 9, title: \"Morning peak\", body: \"EU traffic tops out; p95 stays under 240 ms.\", delta: \"238 ms\" },\n  { at: 14, title: \"Deploy 4812\", body: \"An N+1 query in /orders sent p95 to 842 ms.\", delta: \"+281%\" },\n  { at: 15, to: 16, title: \"Rolled back to 4811\", body: \"Under 210 ms again by 16:00.\", delta: \"−75%\" },\n];\n\nexport function MarginNoteLatencyDemo() {\n  const [run, setRun] = React.useState(0);\n  return (\n    <div className=\"w-full max-w-3xl overflow-hidden rounded-2xl bg-white text-zinc-900 shadow-sm ring-1 ring-zinc-950/[0.08] dark:bg-zinc-950 dark:text-zinc-100 dark:ring-white/10\">\n      <div className=\"flex items-center justify-between gap-3 border-b border-zinc-950/[0.06] px-5 py-3 dark:border-white/[0.08]\">\n        <div className=\"flex min-w-0 items-center gap-2.5\">\n          <span className=\"size-2 shrink-0 rounded-full bg-emerald-500\" />\n          <p className=\"truncate font-mono text-xs text-zinc-600 dark:text-zinc-400\">\n            api.harbor.dev <span className=\"text-zinc-400 dark:text-zinc-600\">/</span> p95 latency{\" \"}\n            <span className=\"text-zinc-400 dark:text-zinc-600\">/</span> today\n          </p>\n        </div>\n        <div className=\"flex shrink-0 items-center gap-2\">\n          <span className=\"hidden rounded-full bg-emerald-500/10 px-2 py-0.5 text-[11px] font-medium text-emerald-700 sm:inline dark:text-emerald-400\">\n            Resolved 16:04\n          </span>\n          <button\n            type=\"button\"\n            onClick={() => setRun((r) => r + 1)}\n            className=\"rounded-md px-2 py-1 font-mono text-[11px] text-zinc-500 transition-colors hover:bg-zinc-100 hover:text-zinc-900 focus-visible:outline-2 focus-visible:outline-zinc-950 dark:hover:bg-white/10 dark:hover:text-white dark:focus-visible:outline-white\"\n          >\n            replay\n          </button>\n        </div>\n      </div>\n      <div className=\"p-5 sm:p-6\">\n        <MarginNote\n          key={run}\n          label=\"p95 latency for api.harbor.dev today\"\n          data={P95}\n          labels={HOURS}\n          notes={NOTES}\n          summary=\"One deploy cost two slow hours at checkout. Rolling it back fixed it.\"\n          format={(value) => `${Math.round(value)} ms`}\n          className=\"[--margin-note-accent:#e11d48] dark:[--margin-note-accent:#fb7185]\"\n        />\n      </div>\n    </div>\n  );\n}\n"
    }
  ]
}