{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "contributions-echarts-heatmap-chart",
  "description": "GitHub-style contribution graph with a yearly total and longest-streak summary",
  "dependencies": [
    "echarts",
    "motion"
  ],
  "registryDependencies": [
    "@evilcharts/echarts-heatmap-chart"
  ],
  "files": [
    {
      "path": "src/registry/blocks/echarts/b-contributions-echarts-heatmap-chart.tsx",
      "content": "\"use client\";\n\nimport {\n  EChartsHeatmapChart,\n  type ChartConfig,\n  type HeatmapDatum,\n} from \"@/registry/charts/echarts-heatmap-chart\";\n\n// A year of daily contributions, seeded so the block renders the same picture every time.\nfunction buildContributions(seed: number): HeatmapDatum[] {\n  let state = seed;\n  const random = () => {\n    state = (state * 1664525 + 1013904223) % 4294967296;\n    return state / 4294967296;\n  };\n  const end = Date.UTC(2025, 11, 31);\n  const data: HeatmapDatum[] = [];\n  for (let i = 364; i >= 0; i--) {\n    const day = new Date(end - i * 86_400_000);\n    const weekend = day.getUTCDay() === 0 || day.getUTCDay() === 6;\n    const sprint = Math.floor(i / 7) % 6 < 2;\n    const chance = (weekend ? 0.25 : 0.75) + (sprint ? 0.2 : 0);\n    if (random() >= chance) continue;\n    const value = Math.round(random() * (weekend ? 5 : sprint ? 22 : 12)) + 1;\n    data.push({ date: day.toISOString().slice(0, 10), value });\n  }\n  return data;\n}\n\nconst chartData = buildContributions(2024);\n\nconst chartConfig = {\n  contributions: {\n    label: \"Contributions\",\n    colors: {\n      light: [\"#9be9a8\", \"#40c463\", \"#30a14e\", \"#216e39\"],\n      dark: [\"#0e4429\", \"#006d32\", \"#26a641\", \"#39d353\"],\n    },\n  },\n} satisfies ChartConfig;\n\nconst TOTAL = chartData.reduce((sum, day) => sum + day.value, 0);\n\nconst LONGEST_STREAK = (() => {\n  const active = new Set(chartData.map((day) => day.date));\n  const end = Date.UTC(2025, 11, 31);\n  let best = 0;\n  let run = 0;\n  for (let i = 364; i >= 0; i--) {\n    const date = new Date(end - i * 86_400_000).toISOString().slice(0, 10);\n    run = active.has(date) ? run + 1 : 0;\n    if (run > best) best = run;\n  }\n  return best;\n})();\n\nexport function EChartsContributionsHeatmapChart() {\n  return (\n    <div className=\"flex h-full w-full flex-col p-4\">\n      <div className=\"flex items-baseline justify-between gap-4\">\n        <div className=\"flex flex-col gap-0.5\">\n          <span className=\"text-primary text-sm font-medium\">\n            {TOTAL.toLocaleString(\"en-US\")} contributions in the last year\n          </span>\n          <span className=\"text-muted-foreground text-[11px]\">\n            Longest streak {LONGEST_STREAK} days\n          </span>\n        </div>\n        <span className=\"text-muted-foreground font-mono text-[11px]\">2025</span>\n      </div>\n\n      <EChartsHeatmapChart\n        className=\"mt-3 min-h-0 w-full flex-1\"\n        data={chartData}\n        config={chartConfig}\n        range={2025}\n      >\n        <EChartsHeatmapChart.Cell dataKey=\"contributions\" radius={2} gap={3} />\n        <EChartsHeatmapChart.MonthLabel />\n        <EChartsHeatmapChart.DayLabel />\n        <EChartsHeatmapChart.Tooltip variant=\"frosted-glass\" />\n        <EChartsHeatmapChart.Legend />\n      </EChartsHeatmapChart>\n    </div>\n  );\n}\n",
      "type": "registry:block",
      "target": "components/evilcharts/blocks/contributions-echarts-heatmap-chart.tsx"
    }
  ],
  "type": "registry:block"
}