'use client' import { motion } from 'motion/react' import { cn } from '@/lib/utils' import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' import { Activity, AlertTriangle, CheckCircle2, Clock, TrendingUp } from 'lucide-react' import type { ProjectHealth } from '@/types/design-thinking' interface HealthWidgetProps { health: ProjectHealth className?: string } function HealthRing({ value, size = 120, strokeWidth = 8 }: { value: number; size?: number; strokeWidth?: number }) { const radius = (size - strokeWidth) / 2 const circumference = radius * 2 * Math.PI const offset = circumference - (value / 100) * circumference const getColor = (v: number) => { if (v >= 80) return 'stroke-emerald-500' if (v >= 60) return 'stroke-amber-500' return 'stroke-red-500' } return (
{value} Health Score
) } export function HealthWidget({ health, className }: HealthWidgetProps) { const metrics = [ { label: 'Velocity', value: health.velocity, icon: TrendingUp, color: health.velocity >= 80 ? 'text-emerald-500' : health.velocity >= 60 ? 'text-amber-500' : 'text-red-500' }, { label: 'Completion', value: health.completion_rate, icon: CheckCircle2, color: health.completion_rate >= 80 ? 'text-emerald-500' : health.completion_rate >= 60 ? 'text-amber-500' : 'text-red-500', suffix: '%' }, { label: 'Blockers', value: health.blockers, icon: AlertTriangle, color: health.blockers === 0 ? 'text-emerald-500' : health.blockers <= 2 ? 'text-amber-500' : 'text-red-500', inverse: true }, { label: 'Overdue', value: health.overdue, icon: Clock, color: health.overdue === 0 ? 'text-emerald-500' : health.overdue <= 2 ? 'text-amber-500' : 'text-red-500', inverse: true } ] return ( Project Health
{metrics.map((metric) => (
{metric.label}

{metric.value}{metric.suffix || ''}

))}
) }