"use client"; import React from "react"; import { Activity, Flame, Calendar } from "lucide-react"; interface ActivityHeatmapProps { title?: string; subtitle?: string; data?: Array<{ date?: string; month?: string; count: number; level?: number }>; className?: string; } // Generate 12 months of activity data const generateMonthlyData = () => { const months = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ]; return months.map((month, i) => ({ month, count: Math.floor(Math.random() * 100) + 20, level: Math.floor(Math.random() * 4), // 0-3 intensity })); }; const LEVEL_COLORS = [ "var(--border-color-subtle)", // level 0 - no activity "rgba(255, 159, 10, 0.15)", // level 1 - light "rgba(255, 159, 10, 0.4)", // level 2 - medium "var(--color-primary)", // level 3 - heavy ]; export function ActivityHeatmap({ title = "Activity Overview", subtitle = "Activity over the last 12 months", data, className, }: ActivityHeatmapProps) { const heatmapData = data || generateMonthlyData(); const maxCount = Math.max(...heatmapData.map((d) => d.count), 1); return (

{title}

{subtitle}

{/* Heatmap grid */}
{heatmapData.map((item, i) => (
{(item as { month?: string; date?: string }).month ?? (item as { month?: string; date?: string }).date ?? ""}
))}
{/* Legend */}
Low •
High
{/* Stats summary */}
{heatmapData.reduce((sum, d) => sum + d.count, 0)}
Total Activities
{Math.round( heatmapData.reduce((sum, d) => sum + d.count, 0) / heatmapData.length )}
Avg per Month
{heatmapData[heatmapData.length - 1]?.count}
This Month
); }