'use client' import { Habit } from '@/lib/types' import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer } from 'recharts' interface HabitStreakProps { habits: Habit[] } export default function HabitStreak({ habits }: HabitStreakProps) { // Get the last 30 days of data const dates = Array.from({ length: 30 }, (_, i) => { const d = new Date() d.setDate(d.getDate() - i) return d.toISOString().split('T')[0] }).reverse() // Count completed habits per day const completions = dates.map(date => ({ date: new Date(date).toLocaleDateString(), completed: habits.filter(habit => habit.completions.includes(date) ).length })) return ( Daily Habit Completion Streak
[`${value} habits`, 'Completed']} />
) }