{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "chart-release-activity",
  "title": "Release activity",
  "description": "New installs and updates by release with count and share views.",
  "registryDependencies": [
    "@neumorphism-ui/chart",
    "@neumorphism-ui/select"
  ],
  "files": [
    {
      "path": "src/components/blocks/release-activity-chart.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { Area, AreaChart, CartesianGrid, XAxis, YAxis } from \"recharts\";\n\nimport { ChartContainer, ChartTooltip, ChartLegend } from \"@/components/ui/chart\";\nimport { Select, SelectItem } from \"@/components/ui/select\";\n\nconst copy = {\n  \"en\": {\n    \"title\": \"Release activity\",\n    \"description\": \"New installs and updates by release. Counts are events, not unique users.\",\n    \"total\": \"Total activity\",\n    \"updateShare\": \"Update share\",\n    \"empty\": \"No release activity.\",\n    \"view\": \"View\",\n    \"count\": \"Event counts\",\n    \"share\": \"Share per release\",\n    \"table\": \"View release data\",\n    \"caption\": \"Release activity data\",\n    \"release\": \"Release\",\n    \"installs\": \"New installs\",\n    \"updates\": \"Updates\"\n  },\n  \"ko\": {\n    \"title\": \"릴리스 활동\",\n    \"description\": \"릴리스별 신규 설치와 업데이트 건수입니다. 고유 사용자 수가 아닌 이벤트 수입니다.\",\n    \"total\": \"전체 활동\",\n    \"updateShare\": \"업데이트 비율\",\n    \"empty\": \"릴리스 활동이 없습니다.\",\n    \"view\": \"보기 방식\",\n    \"count\": \"이벤트 수\",\n    \"share\": \"릴리스별 비율\",\n    \"table\": \"릴리스 데이터 보기\",\n    \"caption\": \"릴리스 활동 데이터\",\n    \"release\": \"릴리스\",\n    \"installs\": \"신규 설치\",\n    \"updates\": \"업데이트\"\n  },\n  \"ja\": {\n    \"title\": \"リリースの利用状況\",\n    \"description\": \"リリース別の新規インストールと更新件数です。人数ではなくイベント数です。\",\n    \"total\": \"合計イベント\",\n    \"updateShare\": \"更新の割合\",\n    \"empty\": \"リリースの利用記録はありません。\",\n    \"view\": \"表示方法\",\n    \"count\": \"イベント数\",\n    \"share\": \"リリース別の割合\",\n    \"table\": \"リリースデータを表示\",\n    \"caption\": \"リリース利用状況データ\",\n    \"release\": \"リリース\",\n    \"installs\": \"新規インストール\",\n    \"updates\": \"更新\"\n  },\n  \"zh\": {\n    \"title\": \"版本活动\",\n    \"description\": \"各版本的新安装和更新次数。计数为事件数，而非独立用户数。\",\n    \"total\": \"总活动数\",\n    \"updateShare\": \"更新占比\",\n    \"empty\": \"暂无版本活动。\",\n    \"view\": \"显示方式\",\n    \"count\": \"事件数\",\n    \"share\": \"各版本占比\",\n    \"table\": \"查看版本数据\",\n    \"caption\": \"版本活动数据\",\n    \"release\": \"版本\",\n    \"installs\": \"新安装\",\n    \"updates\": \"更新\"\n  }\n} as const;\n\nexport type ReleaseActivityPoint = {\n  release: string;\n  installs: number;\n  updates: number;\n};\n\nexport function ReleaseActivityChart({\n  data,\n  locale = \"en\",\n}: {\n  data: readonly ReleaseActivityPoint[];\n  locale?: keyof typeof copy;\n}) {\n  const t = copy[locale];\n  const [view, setView] = React.useState<\"count\" | \"share\">(\"count\");\n  const installs = data.reduce((sum, row) => sum + row.installs, 0);\n  const updates = data.reduce((sum, row) => sum + row.updates, 0);\n  const total = installs + updates;\n\n  return (\n    <ChartContainer\n      data-chart=\"release-activity\"\n      title={t.title}\n      description={t.description}\n      summary={data.length ? `${t.total} ${total.toLocaleString(locale)} · ${t.updateShare} ${total ? ((updates / total) * 100).toFixed(1) : \"0.0\"}%` : t.empty}\n      actions={\n        <label className=\"grid gap-1.5 text-xs\">\n          {t.view}\n          <Select value={view} onChange={(event) => setView(event.target.value as typeof view)}>\n            <SelectItem value=\"count\">{t.count}</SelectItem>\n            <SelectItem value=\"share\">{t.share}</SelectItem>\n          </Select>\n        </label>\n      }\n      tableLabel={t.table}\n      emptyLabel={t.empty}\n      empty={!data.length}\n      table={\n        <table>\n          <caption className=\"sr-only\">{t.caption}</caption>\n          <thead><tr><th>{t.release}</th><th>{t.installs}</th><th>{t.updates}</th><th>{t.updateShare}</th></tr></thead>\n          <tbody>{data.map((row) => {\n            const rowTotal = row.installs + row.updates;\n            return <tr key={row.release}><th scope=\"row\">{row.release}</th><td>{row.installs}</td><td>{row.updates}</td><td>{rowTotal ? ((row.updates / rowTotal) * 100).toFixed(1) + \"%\" : \"—\"}</td></tr>;\n          })}</tbody>\n        </table>\n      }\n    >\n      <AreaChart data={data} stackOffset={view === \"share\" ? \"expand\" : \"none\"} accessibilityLayer margin={{ top: 12, right: 12, bottom: 4, left: 0 }}>\n        <CartesianGrid vertical={false} stroke=\"var(--border)\" strokeDasharray=\"3 4\" />\n        <XAxis dataKey=\"release\" tick={{ fill: \"var(--muted-foreground)\" }} tickLine={false} axisLine={false} />\n        <YAxis domain={view === \"share\" ? [0, 1] : [0, \"auto\"]} width={52} tickFormatter={(value: number) => view === \"share\" ? `${Math.round(value * 100)}%` : String(value)} tick={{ fill: \"var(--muted-foreground)\" }} tickLine={false} axisLine={false} />\n        <ChartLegend />\n        <ChartTooltip formatter={(value) => Number(value).toLocaleString(locale)} />\n        <Area dataKey=\"installs\" name={t.installs} legendType=\"plainline\" stackId=\"activity\" stroke=\"var(--foreground)\" fill=\"var(--primary)\" fillOpacity={0.22} strokeWidth={2} isAnimationActive={false} />\n        <Area dataKey=\"updates\" name={t.updates} legendType=\"plainline\" stackId=\"activity\" stroke=\"var(--muted-foreground)\" fill=\"var(--muted)\" fillOpacity={0.8} strokeWidth={2} strokeDasharray=\"6 4\" isAnimationActive={false} />\n      </AreaChart>\n    </ChartContainer>\n  );\n}\n\nconst exampleActivity: ReleaseActivityPoint[] = [\n  { release: \"R1\", installs: 148, updates: 62 },\n  { release: \"R2\", installs: 232, updates: 104 },\n  { release: \"R3\", installs: 196, updates: 88 },\n  { release: \"R4\", installs: 284, updates: 132 },\n  { release: \"R5\", installs: 341, updates: 176 },\n  { release: \"R6\", installs: 378, updates: 209 },\n];\n\nexport function ReleaseActivityExample({ locale = \"en\" }: { locale?: keyof typeof copy }) {\n  return <ReleaseActivityChart data={exampleActivity} locale={locale} />;\n}\n",
      "type": "registry:component",
      "target": "@components/blocks/release-activity-chart.tsx"
    }
  ],
  "categories": [
    "chart"
  ],
  "type": "registry:block"
}