+
{data.formattedDate || label}
{isDualAxis ? (
-
-
- Orders: {data.orders}
-
-
- Revenue:{" "}
- {formatGBP(data.revenue)}
-
+
+
+ Orders
+ {data.orders}
+
+
+ Revenue
+ {formatGBP(data.revenue)}
+
{data.avgOrderValue !== undefined && data.avgOrderValue > 0 && (
-
- Avg Order Value:{" "}
-
- {formatGBP(data.avgOrderValue)}
-
-
+
+ Avg Order Value
+ {formatGBP(data.avgOrderValue)}
+
)}
) : (
-
- {isAmount
- ? formatGBP(data.value || data.amount || 0)
- : `${data.value || data.count || 0}`}
-
+
+
+ {isAmount ? "Revenue" : "Count"}
+
+
+ {isAmount
+ ? formatGBP(data.value || data.amount || 0)
+ : `${data.value || data.count || 0}`}
+
+
)}
);
@@ -449,7 +455,7 @@ export default function AdminAnalytics() {
};
// Calculate best month from daily data (for YTD, full year, or previous years)
- const calculateBestMonth = () => {
+ const calculateBestMonth = (): { month: string; revenue: number; orders: number } | null => {
// Show best month for YTD, full year view, or when viewing previous years
const showBestMonth =
dateRange === "ytd" || dateRange === "year" || !isViewingCurrentYear;
@@ -734,16 +740,30 @@ export default function AdminAnalytics() {
analyticsData.orders.dailyOrders.length > 0 ? (
-
-
- } cursor={{ fill: 'transparent' }} />
-
+
+
+
+
+
+
+
+ } cursor={{ stroke: 'rgba(255,255,255,0.1)', strokeWidth: 1 }} />
+
) : (
@@ -788,16 +808,30 @@ export default function AdminAnalytics() {
analyticsData.revenue.dailyRevenue.length > 0 ? (
-
-
- } cursor={{ fill: 'transparent' }} />
-
+
+
+
+
+
+
+
+ } cursor={{ stroke: 'rgba(255,255,255,0.1)', strokeWidth: 1 }} />
+
) : (
@@ -844,16 +878,30 @@ export default function AdminAnalytics() {
analyticsData.vendors.dailyGrowth.length > 0 ? (
-
-
- } cursor={{ fill: 'transparent' }} />
-
+
+
+
+
+
+
+
+ } cursor={{ stroke: 'rgba(255,255,255,0.1)', strokeWidth: 1 }} />
+
) : (
diff --git a/middleware.ts b/middleware.ts
index 77e3cff..b54dfa4 100644
--- a/middleware.ts
+++ b/middleware.ts
@@ -4,12 +4,19 @@ import type { NextRequest } from 'next/server';
export function middleware(request: NextRequest) {
const { pathname } = request.nextUrl;
- // Protect dashboard routes
if (pathname.startsWith('/dashboard')) {
const authToken = request.cookies.get('Authorization')?.value;
+ const isPrefetch =
+ request.headers.get('Next-Router-Prefetch') === '1' ||
+ request.headers.get('purpose') === 'prefetch';
+
if (!authToken) {
- // Redirect to login if no token is found
+ if (isPrefetch) {
+ // Let prefetch requests through so caching works
+ return NextResponse.next();
+ }
+
const loginUrl = new URL('/auth/login', request.url);
loginUrl.searchParams.set('redirectUrl', pathname);
return NextResponse.redirect(loginUrl);
@@ -19,7 +26,6 @@ export function middleware(request: NextRequest) {
return NextResponse.next();
}
-// See "Matching Paths" below to learn more
export const config = {
matcher: ['/dashboard/:path*'],
};
diff --git a/public/git-info.json b/public/git-info.json
index c6ce719..408c62e 100644
--- a/public/git-info.json
+++ b/public/git-info.json
@@ -1,4 +1,4 @@
{
- "commitHash": "a6e6cd0",
- "buildTime": "2026-01-13T04:57:00.870Z"
+ "commitHash": "4c15f43",
+ "buildTime": "2026-01-13T05:27:43.269Z"
}
\ No newline at end of file