diff --git a/app/(dashboard)/career-goals/page.tsx b/app/(dashboard)/career-goals/page.tsx index f85a143..d680340 100644 --- a/app/(dashboard)/career-goals/page.tsx +++ b/app/(dashboard)/career-goals/page.tsx @@ -1,4 +1,4 @@ -"use client" +"use client" import { useState, useEffect, useCallback, useRef, useMemo } from "react" import { Button } from "@/components/ui/button" @@ -64,7 +64,6 @@ interface Goal { category: string categoryId: string status: "Not started" | "In progress" | "Completed" - /** ISO date string (YYYY-MM-DD) of last update — used for staleness badge */ updatedAt: string } @@ -78,140 +77,208 @@ interface AchievementRow { const goalStatuses = ["Not started", "In progress", "Completed"] +function calculateGoalDistribution(goals: Goal[], categories: string[]): { [key: string]: number } { + const distribution: { [key: string]: number } = {} + categories.forEach(cat => { distribution[cat] = 0 }) + goals.forEach(goal => { distribution[goal.category] = (distribution[goal.category] || 0) + 1 }) + return distribution +} + +function GoalsTable({ goals, setter, categories, updateGoal, deleteGoal, stalenessBadge }: { + goals: Goal[] + term: 'short_term' | 'mid_term' | 'long_term' + setter: React.Dispatch> + categories: string[] + updateGoal: (setter: React.Dispatch>, goals: Goal[], id: string, field: keyof Goal, value: string) => void + deleteGoal: (setter: React.Dispatch>, goals: Goal[], id: string) => void + stalenessBadge: (updatedAt: string, status: Goal['status']) => React.ReactNode +}) { + return ( +
+ + + + + + + + + + + + {goals.map((goal) => ( + +
GoalTypeCategoryStatus
+