From 7d884099aa2c7e581ff670b9656835fb70f191ca Mon Sep 17 00:00:00 2001 From: Simone Cavalli Date: Fri, 19 Jun 2026 12:05:05 +0200 Subject: [PATCH] chore(18-01): remove forecast route, sidebar entry, and revalidatePath calls (CLEAN-01) - Remove Forecast NAV_ITEMS entry and TrendingUp import from AdminSidebar - Delete src/app/admin/forecast/page.tsx and empty directory - Remove revalidatePath("/admin/forecast") from assignOfferToProject, removeProjectOffer, updateProjectOfferTotal --- src/app/admin/forecast/page.tsx | 75 ----------------------- src/app/admin/projects/project-actions.ts | 3 - src/components/admin/AdminSidebar.tsx | 2 - 3 files changed, 80 deletions(-) delete mode 100644 src/app/admin/forecast/page.tsx diff --git a/src/app/admin/forecast/page.tsx b/src/app/admin/forecast/page.tsx deleted file mode 100644 index d974191..0000000 --- a/src/app/admin/forecast/page.tsx +++ /dev/null @@ -1,75 +0,0 @@ -import { getRevenueForecast12Months } from "@/lib/forecast-queries"; - -export const revalidate = 0; - -export default async function ForecastPage() { - const forecast = await getRevenueForecast12Months(); - const totalForecast = forecast.reduce((sum, m) => sum + m.total, 0); - - return ( -
-

Revenue Forecast

-

- Proiezione 12 mesi basata sulle offerte attive, i loro accepted_total e le durate in mesi. - Ogni offerta distribuisce il suo totale equamente per i mesi di durata a partire dalla data di inizio. -

- -
- - - - - - - - - - {forecast.map((month) => { - const maxTotal = Math.max(...forecast.map((m) => m.total), 1); - const pct = Math.round((month.total / maxTotal) * 100); - return ( - - - - - - ); - })} - - - - - - - -
- Mese - - Fatturato previsto - - Barra -
{month.label} - {month.total > 0 ? `€${month.total.toFixed(2)}` : } - - {month.total > 0 && ( -
-
-
- )} -
Totale 12 mesi - €{totalForecast.toFixed(2)} - -
-
- - {forecast.every((m) => m.total === 0) && ( -

- Nessuna offerta con accepted_total trovata. Assegna micro-offerte ai progetti e imposta il totale accettato. -

- )} -
- ); -} diff --git a/src/app/admin/projects/project-actions.ts b/src/app/admin/projects/project-actions.ts index f030cc9..6c628ad 100644 --- a/src/app/admin/projects/project-actions.ts +++ b/src/app/admin/projects/project-actions.ts @@ -135,14 +135,12 @@ export async function assignOfferToProject(formData: FormData) { : null, }); revalidatePath(`/admin/projects/${parsed.data.project_id}`); - revalidatePath("/admin/forecast"); } export async function removeProjectOffer(projectOfferId: string, projectId: string) { await requireAdmin(); await db.delete(project_offers).where(eq(project_offers.id, projectOfferId)); revalidatePath(`/admin/projects/${projectId}`); - revalidatePath("/admin/forecast"); } export async function updateProjectOfferTotal( @@ -158,5 +156,4 @@ export async function updateProjectOfferTotal( .set({ accepted_total: amount.toFixed(2) }) .where(eq(project_offers.id, projectOfferId)); revalidatePath(`/admin/projects/${projectId}`); - revalidatePath("/admin/forecast"); } \ No newline at end of file diff --git a/src/components/admin/AdminSidebar.tsx b/src/components/admin/AdminSidebar.tsx index f0e29a7..3f46294 100644 --- a/src/components/admin/AdminSidebar.tsx +++ b/src/components/admin/AdminSidebar.tsx @@ -8,7 +8,6 @@ import { Users, FolderOpen, Tag, - TrendingUp, BookOpen, Settings, LogOut, @@ -21,7 +20,6 @@ const NAV_ITEMS = [ { href: "/admin/leads", label: "Lead", icon: Zap }, { href: "/admin/projects", label: "Progetti", icon: FolderOpen }, { href: "/admin/offers", label: "Offerte", icon: Tag }, - { href: "/admin/forecast", label: "Forecast", icon: TrendingUp }, { href: "/admin/catalog", label: "Catalogo", icon: BookOpen }, { href: "/admin/impostazioni", label: "Impostazioni", icon: Settings }, ];