mirror of
https://github.com/ichsankurnia/hats-app.git
synced 2026-12-06 21:26:29 +00:00
Redesign project assignment list
This commit refreshes the client project assignment UI with a new dashboard summary, streamlined card layouts, and shared assignment overview helpers. It adds phase/progress tracking, delivery health indicators, and improved team/status calculations across the assignment grid and list views. It also updates the project assignment type definitions and bumps the app version.
This commit is contained in:
+108
@@ -0,0 +1,108 @@
|
||||
"use client";
|
||||
|
||||
import { useMemo } from 'react';
|
||||
import { motion } from 'motion/react';
|
||||
import { Briefcase, FileText, Users, TrendingUp, CheckCircle2, AlertTriangle } from 'lucide-react';
|
||||
import { Card900 } from '@/components/ui/card';
|
||||
import { IProjectAssignment } from '../../type.assignment';
|
||||
import { calculateDashboardStats } from '../../utils/assignment-overview-helpers';
|
||||
|
||||
interface ProjectAssignmentDashboardStatsProps {
|
||||
assignments: IProjectAssignment[];
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export default function ProjectAssignmentDashboardStats({
|
||||
assignments,
|
||||
className = '',
|
||||
}: ProjectAssignmentDashboardStatsProps) {
|
||||
const stats = useMemo(() => calculateDashboardStats(assignments), [assignments]);
|
||||
|
||||
return (
|
||||
<div className={`space-y-3.5 ${className}`}>
|
||||
<h2 className="text-xl sm:text-2xl font-bold tracking-tight text-foreground">
|
||||
Project Assignment Dashboard
|
||||
</h2>
|
||||
|
||||
<div className="grid grid-cols-2 sm:grid-cols-3 xl:grid-cols-6 gap-3 sm:gap-4">
|
||||
{/* 1. Total Projects */}
|
||||
<motion.div initial={{ opacity: 0, y: 6 }} animate={{ opacity: 1, y: 0 }} transition={{ duration: 0.2 }}>
|
||||
<Card900 className="p-3.5 sm:p-5 rounded-2xl border border-border/80 bg-card hover:border-blue-500/30 transition-all flex flex-row items-center gap-3 md:gap-3.5 min-w-0 shadow-2xs">
|
||||
<div className="h-10 w-10 sm:h-11 sm:w-11 rounded-xl bg-blue-500/10 dark:bg-blue-500/15 border border-blue-500/20 flex items-center justify-center shrink-0 text-blue-500 dark:text-blue-400">
|
||||
<FileText className="w-5 h-5" />
|
||||
</div>
|
||||
<div className="min-w-0 flex-1">
|
||||
<p className="text-xs text-muted-foreground truncate">Total Projects</p>
|
||||
<p className="text-lg sm:text-xl font-bold tracking-tight text-foreground">{stats.totalProjects}</p>
|
||||
</div>
|
||||
</Card900>
|
||||
</motion.div>
|
||||
|
||||
{/* 2. Active Work Orders */}
|
||||
<motion.div initial={{ opacity: 0, y: 6 }} animate={{ opacity: 1, y: 0 }} transition={{ duration: 0.2, delay: 0.03 }}>
|
||||
<Card900 className="p-3.5 sm:p-5 rounded-2xl border border-border/80 bg-card hover:border-amber-500/30 transition-all flex flex-row items-center gap-3 md:gap-3.5 min-w-0 shadow-2xs">
|
||||
<div className="h-10 w-10 sm:h-11 sm:w-11 rounded-xl bg-amber-500/10 dark:bg-amber-500/15 border border-amber-500/20 flex items-center justify-center shrink-0 text-amber-500 dark:text-amber-400">
|
||||
<Briefcase className="w-5 h-5" />
|
||||
</div>
|
||||
<div className="min-w-0 flex-1">
|
||||
<p className="text-xs text-muted-foreground truncate">Active Work Orders</p>
|
||||
<p className="text-lg sm:text-xl font-bold tracking-tight text-foreground">{stats.activeWorkOrders}</p>
|
||||
</div>
|
||||
</Card900>
|
||||
</motion.div>
|
||||
|
||||
{/* 3. Assigned People */}
|
||||
<motion.div initial={{ opacity: 0, y: 6 }} animate={{ opacity: 1, y: 0 }} transition={{ duration: 0.2, delay: 0.06 }}>
|
||||
<Card900 className="p-3.5 sm:p-5 rounded-2xl border border-border/80 bg-card hover:border-emerald-500/30 transition-all flex flex-row items-center gap-3 md:gap-3.5 min-w-0 shadow-2xs">
|
||||
<div className="h-10 w-10 sm:h-11 sm:w-11 rounded-xl bg-emerald-500/10 dark:bg-emerald-500/15 border border-emerald-500/20 flex items-center justify-center shrink-0 text-emerald-500 dark:text-emerald-400">
|
||||
<Users className="w-5 h-5" />
|
||||
</div>
|
||||
<div className="min-w-0 flex-1">
|
||||
<p className="text-xs text-muted-foreground truncate">Assigned People</p>
|
||||
<p className="text-lg sm:text-xl font-bold tracking-tight text-foreground">{stats.assignedPeople} people</p>
|
||||
</div>
|
||||
</Card900>
|
||||
</motion.div>
|
||||
|
||||
{/* 4. Average Progress */}
|
||||
<motion.div initial={{ opacity: 0, y: 6 }} animate={{ opacity: 1, y: 0 }} transition={{ duration: 0.2, delay: 0.09 }}>
|
||||
<Card900 className="p-3.5 sm:p-5 rounded-2xl border border-border/80 bg-card hover:border-orange-500/30 transition-all flex flex-row items-center gap-3 md:gap-3.5 min-w-0 shadow-2xs">
|
||||
<div className="h-10 w-10 sm:h-11 sm:w-11 rounded-xl bg-orange-500/10 dark:bg-orange-500/15 border border-orange-500/20 flex items-center justify-center shrink-0 text-orange-500 dark:text-orange-400">
|
||||
<TrendingUp className="w-5 h-5" />
|
||||
</div>
|
||||
<div className="min-w-0 flex-1">
|
||||
<p className="text-xs text-muted-foreground truncate">Average Progress</p>
|
||||
<p className="text-lg sm:text-xl font-bold tracking-tight text-foreground">{stats.averageProgress}%</p>
|
||||
</div>
|
||||
</Card900>
|
||||
</motion.div>
|
||||
|
||||
{/* 5. On-Time Projects */}
|
||||
<motion.div initial={{ opacity: 0, y: 6 }} animate={{ opacity: 1, y: 0 }} transition={{ duration: 0.2, delay: 0.12 }}>
|
||||
<Card900 className="p-3.5 sm:p-5 rounded-2xl border border-border/80 bg-card hover:border-emerald-500/30 transition-all flex flex-row items-center gap-3 md:gap-3.5 min-w-0 shadow-2xs">
|
||||
<div className="h-10 w-10 sm:h-11 sm:w-11 rounded-xl bg-emerald-500/10 dark:bg-emerald-500/15 border border-emerald-500/20 flex items-center justify-center shrink-0 text-emerald-500 dark:text-emerald-400">
|
||||
<CheckCircle2 className="w-5 h-5" />
|
||||
</div>
|
||||
<div className="min-w-0 flex-1">
|
||||
<p className="text-xs text-muted-foreground truncate">On-Time Projects</p>
|
||||
<p className="text-lg sm:text-xl font-bold tracking-tight text-foreground">{stats.onTimeRatio}</p>
|
||||
</div>
|
||||
</Card900>
|
||||
</motion.div>
|
||||
|
||||
{/* 6. At Risk / Delayed */}
|
||||
<motion.div initial={{ opacity: 0, y: 6 }} animate={{ opacity: 1, y: 0 }} transition={{ duration: 0.2, delay: 0.15 }}>
|
||||
<Card900 className="p-3.5 sm:p-5 rounded-2xl border border-border/80 bg-card hover:border-rose-500/30 transition-all flex flex-row items-center gap-3 md:gap-3.5 min-w-0 shadow-2xs">
|
||||
<div className="h-10 w-10 sm:h-11 sm:w-11 rounded-xl bg-rose-500/10 dark:bg-rose-500/15 border border-rose-500/20 flex items-center justify-center shrink-0 text-rose-500 dark:text-rose-400">
|
||||
<AlertTriangle className="w-5 h-5" />
|
||||
</div>
|
||||
<div className="min-w-0 flex-1">
|
||||
<p className="text-xs text-muted-foreground truncate">At Risk / Delayed</p>
|
||||
<p className="text-lg sm:text-xl font-bold tracking-tight text-foreground">{stats.atRiskDelayed}</p>
|
||||
</div>
|
||||
</Card900>
|
||||
</motion.div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user