From 09a049ce98769a75da91b058eab641567025a7b3 Mon Sep 17 00:00:00 2001 From: Ichsan Kurniawan Date: Thu, 15 Oct 2026 18:52:32 +0700 Subject: [PATCH] Add live milestone timelines to client views Show upcoming assignment milestones with grouped agenda details and status-based colors. Use API status counts for client stage summaries and align status indicators across project timelines. --- .../DevelopmentActivityLog.tsx | 16 +- .../ProjectMilestoneTimeline.tsx | 122 +++--- .../[project_id]/ProjectDetailComponent.tsx | 4 +- .../[project_id]/StatusTimeline.tsx | 15 +- .../task/component/UpdateTechnicalStatus.tsx | 8 +- .../task/component/client/ClientGrid.tsx | 20 +- .../task/component/client/ClientList.tsx | 86 +--- .../client/ClientMilestoneTimeline.tsx | 320 +++++++++++++++ app/(dashboard)/task/page.tsx | 1 + app/(dashboard)/task/types.ts | 115 +++--- .../task/utils/client-overview-helpers.ts | 377 +++++++++++------- 11 files changed, 727 insertions(+), 357 deletions(-) create mode 100644 app/(dashboard)/task/component/client/ClientMilestoneTimeline.tsx diff --git a/app/(dashboard)/task/client-detail/[client_id]/[assignment_id]/DevelopmentActivityLog.tsx b/app/(dashboard)/task/client-detail/[client_id]/[assignment_id]/DevelopmentActivityLog.tsx index dc5cf4c..ef6c5b1 100644 --- a/app/(dashboard)/task/client-detail/[client_id]/[assignment_id]/DevelopmentActivityLog.tsx +++ b/app/(dashboard)/task/client-detail/[client_id]/[assignment_id]/DevelopmentActivityLog.tsx @@ -35,12 +35,22 @@ export function DevelopmentActivityLog({ history = [] }: DevelopmentActivityLogP const getDotColor = (index: number, desc: string) => { const lower = desc.toLowerCase(); + // Technical status progression colors matching badge variants + if (lower.includes('development') || lower.includes('dev')) return 'bg-rose-400 dark:bg-rose-600'; + if (lower.includes('system integration') || lower.includes('sit')) return 'bg-orange-400 dark:bg-orange-600'; + if (lower.includes('user acceptance') || lower.includes('uat')) return 'bg-yellow-400 dark:bg-yellow-500'; + if (lower.includes('production trial') || lower.includes('ptr')) return 'bg-emerald-400 dark:bg-emerald-600'; + if (lower.includes('go-live') || lower.includes('go live')) return 'bg-cyan-400 dark:bg-cyan-600'; + if (lower.includes('bast') || lower.includes('handover')) return 'bg-violet-400 dark:bg-violet-600'; + if (lower.includes('warranty')) return 'bg-fuchsia-400 dark:bg-fuchsia-600'; + + // Administrative and other events if (lower.includes('create')) return 'bg-emerald-500'; if (lower.includes('assign')) return 'bg-sky-500'; if (lower.includes('status to active') || lower.includes('status to completed')) return 'bg-emerald-500'; - if (lower.includes('on hold') || lower.includes('issue')) return 'bg-rose-500'; - if (lower.includes('sit') || lower.includes('uat')) return 'bg-purple-500'; - const colors = ['bg-emerald-500', 'bg-sky-500', 'bg-rose-500', 'bg-amber-500', 'bg-indigo-500']; + if (lower.includes('on hold') || lower.includes('issue')) return 'bg-amber-500'; + + const colors = ['bg-rose-400', 'bg-orange-400', 'bg-yellow-400', 'bg-emerald-400', 'bg-cyan-400', 'bg-violet-400', 'bg-fuchsia-400']; return colors[index % colors.length]; }; diff --git a/app/(dashboard)/task/client-detail/[client_id]/[assignment_id]/ProjectMilestoneTimeline.tsx b/app/(dashboard)/task/client-detail/[client_id]/[assignment_id]/ProjectMilestoneTimeline.tsx index 16201dd..ef3fe3b 100644 --- a/app/(dashboard)/task/client-detail/[client_id]/[assignment_id]/ProjectMilestoneTimeline.tsx +++ b/app/(dashboard)/task/client-detail/[client_id]/[assignment_id]/ProjectMilestoneTimeline.tsx @@ -222,15 +222,15 @@ export function ProjectMilestoneTimeline({ {insertTodayAfter === 'start' && ( <> -
+
-
+
Today
-
+
-
+
{todayFormatted} @@ -240,23 +240,23 @@ export function ProjectMilestoneTimeline({ )} - {/* Continuous Red Line connecting Start to Development */} -
+ {/* Continuous Rose Line connecting Start to Development */} +
{/* 2. DEVELOPMENT SECTION */} {devDates.length > 0 ? ( devDates.map((dStr, idx) => (
- {idx > 0 &&
} + {idx > 0 &&
}
{idx === 0 && (
- + Development
)} -
+
{dStr} @@ -268,25 +268,25 @@ export function ProjectMilestoneTimeline({ ) : (
- + Development
-
+
)} {insertTodayAfter === 'dev' && ( <> -
+
-
+
Today
-
+
-
+
{todayFormatted} @@ -296,17 +296,17 @@ export function ProjectMilestoneTimeline({ )} - {/* Continuous Blue Line connecting to SIT */} -
+ {/* Continuous Orange Line connecting to SIT */} +
{/* 3. SIT NODE */}
- + SIT
-
+
{sitDateFormatted && (
@@ -318,15 +318,15 @@ export function ProjectMilestoneTimeline({ {insertTodayAfter === 'sit' && ( <> -
+
-
+
Today
-
+
-
+
{todayFormatted} @@ -336,17 +336,17 @@ export function ProjectMilestoneTimeline({ )} - {/* Continuous Purple Line connecting to UAT */} -
+ {/* Continuous Yellow Line connecting to UAT */} +
{/* 4. UAT NODE */}
- + UAT
-
+
{uatDateFormatted && (
@@ -358,15 +358,15 @@ export function ProjectMilestoneTimeline({ {insertTodayAfter === 'uat' && ( <> -
+
-
+
Today
-
+
-
+
{todayFormatted} @@ -376,17 +376,17 @@ export function ProjectMilestoneTimeline({ )} - {/* Continuous Teal Line connecting to PTR */} -
+ {/* Continuous Emerald Line connecting to PTR */} +
{/* 5. PTR NODE */}
- + PTR
-
+
{ptrDateFormatted && (
@@ -398,15 +398,15 @@ export function ProjectMilestoneTimeline({ {insertTodayAfter === 'ptr' && ( <> -
+
-
+
Today
-
+
-
+
{todayFormatted} @@ -416,17 +416,17 @@ export function ProjectMilestoneTimeline({ )} - {/* Continuous Green Line connecting to Go Live */} -
+ {/* Continuous Cyan Line connecting to Go Live */} +
{/* 6. GO LIVE NODE */}
- + Go Live
-
+
{goLiveDateFormatted && (
@@ -438,15 +438,15 @@ export function ProjectMilestoneTimeline({ {insertTodayAfter === 'golive' && ( <> -
+
-
+
Today
-
+
-
+
{todayFormatted} @@ -456,17 +456,17 @@ export function ProjectMilestoneTimeline({ )} - {/* Continuous Yellow Line connecting to BAST */} -
+ {/* Continuous Violet Line connecting to BAST */} +
{/* 7. BAST NODE */}
- + BAST
-
+
{bastDateFormatted && (
@@ -478,15 +478,15 @@ export function ProjectMilestoneTimeline({ {insertTodayAfter === 'bast' && ( <> -
+
-
+
Today
-
+
-
+
{todayFormatted} @@ -502,15 +502,15 @@ export function ProjectMilestoneTimeline({ {/* 8. WARRANTY CAPSULE TRACK */}
- + Warranty
- {/* Capsule with < ---- > indicator matching Sky Blue techWarranty */} -
- -
- + {/* Capsule with < ---- > indicator matching Fuchsia techWarranty */} +
+ +
+
{/* Dates below warranty: strictly empty if not set */} {(warrantyStart || warrantyEnd) && ( diff --git a/app/(dashboard)/task/client-detail/[client_id]/project-detail/[project_id]/ProjectDetailComponent.tsx b/app/(dashboard)/task/client-detail/[client_id]/project-detail/[project_id]/ProjectDetailComponent.tsx index f6957fb..1b25786 100644 --- a/app/(dashboard)/task/client-detail/[client_id]/project-detail/[project_id]/ProjectDetailComponent.tsx +++ b/app/(dashboard)/task/client-detail/[client_id]/project-detail/[project_id]/ProjectDetailComponent.tsx @@ -3,7 +3,7 @@ import { motion } from 'motion/react'; import { ArrowLeft, Briefcase, Calendar, CheckCircle2, History, AlertCircle } from 'lucide-react'; import { Button } from '@/components/ui/button'; -import { Card, CardContent, CardHeader, CardTitle, CardDescription, Card900 } from '@/components/ui/card'; +import { Card, CardContent, CardHeader, CardTitle, Card900 } from '@/components/ui/card'; import { Badge } from '@/components/ui/badge'; import { Separator } from '@/components/ui/separator'; import { Label } from '@/components/ui/label'; @@ -161,7 +161,7 @@ export default function ProjectDetailComponent({ client, project }: Props) {
- {history.project_assignment_status.name} + {new Date(history.updated_at!).toLocaleDateString()}
{/*

{history.status_remarks}

*/} diff --git a/app/(dashboard)/task/client-detail/[client_id]/project-detail/[project_id]/StatusTimeline.tsx b/app/(dashboard)/task/client-detail/[client_id]/project-detail/[project_id]/StatusTimeline.tsx index cd76aae..cf0465e 100644 --- a/app/(dashboard)/task/client-detail/[client_id]/project-detail/[project_id]/StatusTimeline.tsx +++ b/app/(dashboard)/task/client-detail/[client_id]/project-detail/[project_id]/StatusTimeline.tsx @@ -14,6 +14,19 @@ interface StatusTimelineProps { const TIMELINE_PREVIEW_LIMIT = 3; +function getStatusDotColor(name?: string | null): string { + if (!name) return 'bg-his'; + const lower = name.toLowerCase(); + if (lower.includes('development') || lower.includes('dev')) return 'bg-rose-400 dark:bg-rose-600'; + if (lower.includes('system integration') || lower.includes('sit')) return 'bg-orange-400 dark:bg-orange-600'; + if (lower.includes('user acceptance') || lower.includes('uat')) return 'bg-yellow-400 dark:bg-yellow-500'; + if (lower.includes('production trial') || lower.includes('ptr')) return 'bg-emerald-400 dark:bg-emerald-600'; + if (lower.includes('go-live') || lower.includes('go live')) return 'bg-cyan-400 dark:bg-cyan-600'; + if (lower.includes('bast') || lower.includes('handover')) return 'bg-violet-400 dark:bg-violet-600'; + if (lower.includes('warranty')) return 'bg-fuchsia-400 dark:bg-fuchsia-600'; + return 'bg-his'; +} + export default function StatusTimeline({ history }: StatusTimelineProps) { const [showAll, setShowAll] = useState(false); @@ -68,7 +81,7 @@ export default function StatusTimeline({ history }: StatusTimelineProps) { aria-hidden className={cn( 'absolute left-0 top-1 h-3.75 w-3.75 rounded-full border-[3px] border-card', - isCurrent ? 'bg-his' : 'bg-muted-foreground/40' + isCurrent ? getStatusDotColor(entry.project_assignment_status?.name) : 'bg-muted-foreground/40' )} />
diff --git a/app/(dashboard)/task/component/UpdateTechnicalStatus.tsx b/app/(dashboard)/task/component/UpdateTechnicalStatus.tsx index e261373..e1f463b 100644 --- a/app/(dashboard)/task/component/UpdateTechnicalStatus.tsx +++ b/app/(dashboard)/task/component/UpdateTechnicalStatus.tsx @@ -281,18 +281,18 @@ function EditTechnicalStatusModal({ assignmentId, data, onClose, onSuccess }: Ed - {description.length}/500 + {description.length}/250