import { useMemo } from "react"; import { Target } from "@phosphor-icons/react"; import type { GoalRecord, SectionId, TaskRecord } from "@shared/types"; export function GoalProgress({ goals, tasks, onNavigate }: { goals: GoalRecord[]; tasks: TaskRecord[]; onNavigate: (section: SectionId) => void }) { const activeGoals = useMemo(() => goals.filter((g) => g.status === "active"), [goals]); if (activeGoals.length === 0) return null; return (
{activeGoals.slice(0, 5).map((goal) => { const goalTasks = tasks.filter((t) => t.goalId === goal.id); const done = goalTasks.filter((t) => t.status === "done").length; const total = goalTasks.length; const pct = total === 0 ? 0 : Math.round((done / total) * 100); return ( ); })}
); }