'use client'; import { TrendingUp, Clock, Flame, BarChart3, PieChart as PieChartIcon, } from 'lucide-react'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { LineChart, Line, BarChart, Bar, PieChart, Pie, Cell, AreaChart, Area, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer, } from 'recharts'; interface TimeData { date: string; tasks: number; habits: number; time: number; } interface DomainData { name: string; value: number; color: string; } interface HabitData { name: string; streak: number; score: number; consistency: number; } const COLORS = ['#3b82f6', '#10b981', '#f59e0b', '#8b5cf6', '#ef4444', '#06b6d4']; const chartTooltipStyle = { backgroundColor: 'hsl(var(--card))', border: '1px solid hsl(var(--border))', borderRadius: '0.5rem', }; interface AnalyticsChartsProps { timeData: TimeData[]; domainData: DomainData[]; habitData: HabitData[]; activeTab: string; } export function AnalyticsCharts({ timeData, domainData, habitData, activeTab, }: AnalyticsChartsProps) { if (activeTab === 'trends') { return (
{/* Productivity trend */} {/* Time tracked trend */}
); } if (activeTab === 'habits') { return (
{/* Habit streaks */} {habitData.length === 0 ? (

No habits tracked

) : ( )}
{/* Habit scores */} Habit Scores {habitData.length === 0 ? (

No habits tracked

) : (
{habitData.map((habit) => (
{habit.name} {habit.score}/100
))}
)}
); } if (activeTab === 'time') { return (
{/* Time by domain */} {domainData.length === 0 ? (

No time tracked

) : (
`${name}: ${((percent || 0) * 100).toFixed(0)}%` } outerRadius={100} fill="#8884d8" dataKey="value" > {domainData.map((entry, index) => ( ))}
)}
{/* Daily breakdown */}
); } return null; }