From 401873b8bb0ca04eb5d7205e78d2ffb6d6552782 Mon Sep 17 00:00:00 2001 From: NotII <46204250+NotII@users.noreply.github.com> Date: Mon, 30 Jun 2025 18:38:51 +0100 Subject: [PATCH] fix up --- app/dashboard/analytics/page.tsx | 8 ++-- components/analytics/AnalyticsDashboard.tsx | 47 ------------------- .../analytics/ProductPerformanceChart.tsx | 7 +-- 3 files changed, 7 insertions(+), 55 deletions(-) diff --git a/app/dashboard/analytics/page.tsx b/app/dashboard/analytics/page.tsx index 8849f96..8189982 100644 --- a/app/dashboard/analytics/page.tsx +++ b/app/dashboard/analytics/page.tsx @@ -27,12 +27,15 @@ interface User { export default async function AnalyticsPage({ searchParams, }: { - searchParams: { storeId?: string }; + searchParams: Promise<{ storeId?: string }>; }) { const startTime = performance.now(); + // Await searchParams as required by Next.js 15+ + const resolvedSearchParams = await searchParams; + // Check for storeId in query parameters (for staff users) - const storeId = searchParams.storeId; + const storeId = resolvedSearchParams?.storeId; // Check for storeId in cookies (alternative method for staff users) const cookieStore = await cookies(); @@ -74,7 +77,6 @@ export default async function AnalyticsPage({ - {/* Footer with version info */}
diff --git a/components/analytics/AnalyticsDashboard.tsx b/components/analytics/AnalyticsDashboard.tsx index 98f1c86..a08df86 100644 --- a/components/analytics/AnalyticsDashboard.tsx +++ b/components/analytics/AnalyticsDashboard.tsx @@ -133,29 +133,6 @@ export default function AnalyticsDashboard({ initialData }: AnalyticsDashboardPr {/* Analytics Tabs */}
- {/* Global Date Selector */} -
-
-

Analytics Dashboard

-

- Detailed insights into your business performance -

-
-
- Time period: - -
-
- @@ -177,42 +154,18 @@ export default function AnalyticsDashboard({ initialData }: AnalyticsDashboardPr -
-

Revenue Trends

-

- Track your revenue performance over the selected time period -

-
-
-

Product Performance

-

- Analyze which products are performing best (all-time data) -

-
-
-

Customer Insights

-

- Understand your customer base and behavior (all-time data) -

-
-
-

Order Analytics

-

- Order status distribution for the selected time period -

-
diff --git a/components/analytics/ProductPerformanceChart.tsx b/components/analytics/ProductPerformanceChart.tsx index e8e3dac..1b14dc3 100644 --- a/components/analytics/ProductPerformanceChart.tsx +++ b/components/analytics/ProductPerformanceChart.tsx @@ -131,7 +131,7 @@ export default function ProductPerformanceChart() { Product - Sold + Units Sold Revenue Orders Avg Price @@ -152,14 +152,11 @@ export default function ProductPerformanceChart() { />
{product.name}
-
- {product.unitType} -
- {product.totalSold.toFixed(2)} + {parseInt(product.totalSold.toFixed(0)).toLocaleString()} {product.unitType} {formatGBP(product.totalRevenue)}