"use client"; import { useState } from 'react'; import { useRouter } from 'next/navigation'; import { Plus, Building2, FolderGit2, FileText, ClipboardClock } from 'lucide-react'; import { motion } from 'motion/react'; import { Button } from '@/components/ui/button'; import { Card900 } from '@/components/ui/card'; import dynamic from 'next/dynamic'; import FilterComponent from './FilterComponent'; const FormClient = dynamic(() => import('./client/FormClient'), { ssr: false }); import { IClient } from '../types'; import { calculateOverviewStats } from '../utils/client-overview-helpers'; interface HomeTaskProps { clients?: IClient[]; actions?: string[] } export default function HomeTask({ clients = [], actions }: 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: 'Projects', value: stats.activeProjects, icon: FolderGit2, trend: stats.projectsTrend, }, { title: 'Internal Memos', value: stats.activeInternalMemos, icon: ClipboardClock, trend: stats.personnelTrend, }, { title: '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.

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

{card.title}

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