import { Suspense } from "react"; import { getDashboardStats } from "@/lib/dashboard-queries"; import { FollowUpWidget } from "@/components/admin/dashboard/FollowUpWidget"; import { InboxBand } from "@/components/admin/dashboard/InboxBand"; import { getAnalyticsByYear, getTotalTrackedHours, getClientProfitability, } from "@/lib/analytics-queries"; import { getRevenueForecast12Months, getOffersSoldBreakdown } from "@/lib/forecast-queries"; import { YearSelector } from "@/components/admin/YearSelector"; import { ForecastChart } from "@/components/admin/ForecastChart"; import { OffersSoldChart } from "@/components/admin/OffersSoldChart"; import { ClientProfitability } from "@/components/admin/dashboard/ClientProfitability"; import { MetricCard, fmtEur0 } from "@/components/admin/MetricCard"; export const revalidate = 0; export default async function AdminDashboard({ searchParams, }: { searchParams: Promise<{ year?: string }>; }) { const { year: yearParam } = await searchParams; const year = parseInt(yearParam ?? "") || new Date().getFullYear(); const { kpi } = await getDashboardStats(); const [data, totalHours, profitability, forecast, offersSold] = await Promise.all([ getAnalyticsByYear(year), getTotalTrackedHours(year), getClientProfitability(year), getRevenueForecast12Months(), getOffersSoldBreakdown(), ]); const collectedPct = data.contracted > 0 ? Math.round((data.collected / data.contracted) * 100) : 0; return (