diff --git a/src/app/admin/page.tsx b/src/app/admin/page.tsx index cf98a62..9fe831a 100644 --- a/src/app/admin/page.tsx +++ b/src/app/admin/page.tsx @@ -1,5 +1,7 @@ +import { Suspense } from "react"; import { getDashboardStats } from "@/lib/dashboard-queries"; import { Users, FolderOpen, Euro, Clock } from "lucide-react"; +import { FollowUpWidget } from "@/components/admin/dashboard/FollowUpWidget"; export const revalidate = 0; @@ -56,11 +58,11 @@ export default async function AdminDashboard() { const { kpi, activity } = await getDashboardStats(); return ( -
+

Dashboard

- {/* KPI cards */} -
+ {/* KPI cards + Follow-up Widget */} +
+ Loading...
}> + +
{/* Activity feed */} diff --git a/src/components/admin/dashboard/FollowUpWidget.tsx b/src/components/admin/dashboard/FollowUpWidget.tsx new file mode 100644 index 0000000..dd782ea --- /dev/null +++ b/src/components/admin/dashboard/FollowUpWidget.tsx @@ -0,0 +1,49 @@ +import { getLeadsNeedingFollowUp } from "@/lib/lead-service"; +import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; +import { Button } from "@/components/ui/button"; +import { AlertCircle } from "lucide-react"; +import Link from "next/link"; + +export async function FollowUpWidget() { + const leadsNeedingFollowUp = await getLeadsNeedingFollowUp(7); // 7 days + + return ( + + + + + Richiesta Follow-up + + + + {leadsNeedingFollowUp.length > 0 ? ( + <> +

+ {leadsNeedingFollowUp.length} lead + {leadsNeedingFollowUp.length !== 1 ? "s" : ""} da contattare +

+
    + {leadsNeedingFollowUp.slice(0, 3).map((lead) => ( +
  • + {lead.name} + +
  • + ))} +
+ {leadsNeedingFollowUp.length > 3 && ( + + )} + + ) : ( +

Tutti i lead sono aggiornati!

+ )} +
+
+ ); +} diff --git a/src/components/admin/leads/LeadDetail.tsx b/src/components/admin/leads/LeadDetail.tsx index a5fe2b5..4279e8b 100644 --- a/src/components/admin/leads/LeadDetail.tsx +++ b/src/components/admin/leads/LeadDetail.tsx @@ -7,6 +7,8 @@ import { Button } from "@/components/ui/button"; import { formatDistanceToNow, format } from "date-fns"; import { it } from "date-fns/locale"; import { EditLeadModal } from "./LeadForm"; +import { LogActivityModal } from "./LogActivityModal"; +import { SendQuoteModal } from "./SendQuoteModal"; const ACTIVITY_ICON: Record = { call: "📞", @@ -43,7 +45,8 @@ export function LeadDetail({
- + +