"use client"; import { useState } from 'react'; import { useRouter } from 'next/navigation'; import { Plus, Building2, FolderGit2, Users, FileText, TrendingUp } from 'lucide-react'; import { motion } from 'motion/react'; import { Button } from '@/components/ui/button'; import { Card900 } from '@/components/ui/card'; import FormClient from './client/FormClient'; import FilterComponent from './FilterComponent'; import { IClient } from '../types'; import { calculateOverviewStats } from '../utils/client-overview-helpers'; interface HomeTaskProps { clients?: IClient[]; } export default function HomeTask({ clients = [] }: HomeTaskProps) { const router = useRouter(); const [showForm, setShowForm] = useState(false); const stats = calculateOverviewStats(clients); const statCards = [ { title: 'Total Clients', value: stats.totalClients, icon: Building2, trend: null, }, { title: 'Active Projects', value: stats.activeProjects, icon: FolderGit2, trend: stats.projectsTrend, }, { title: 'Assigned Personnel', value: stats.assignedPersonnel, icon: Users, trend: stats.personnelTrend, }, { title: 'Active Work Orders', value: stats.activeWorkOrders, icon: FileText, trend: stats.workOrdersTrend, }, ]; return (
{/* Header: Title + Subtitle + Action Button */}

Client Overview

Complete overview of all clients, projects, personnel and work orders in one place.

{/* Top Stat Cards (4 Cards Grid) */}
{statCards.map((card, idx) => { const IconComponent = card.icon; return (

{card.title}

{card.value} {card.trend && (
↑ {card.trend} vs last month
)}
); })}
{/* Filter and View Toggle */} {showForm && ( setShowForm(false)} onSuccess={() => { setShowForm(false); router.refresh(); }} /> )}
); }