diff --git a/components/analytics/RevenueChart.tsx b/components/analytics/RevenueChart.tsx
index 3757076..a272606 100644
--- a/components/analytics/RevenueChart.tsx
+++ b/components/analytics/RevenueChart.tsx
@@ -7,7 +7,7 @@ import { Skeleton } from "@/components/ui/skeleton";
import { TrendingUp, DollarSign } from "lucide-react";
import { getRevenueTrendsWithStore, type RevenueData } from "@/lib/services/analytics-service";
import { formatGBP } from "@/utils/format";
-import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer, BarChart, Bar } from 'recharts';
+import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer, AreaChart, Area } from 'recharts';
import { ChartSkeleton } from './SkeletonLoaders';
interface RevenueChartProps {
@@ -61,9 +61,9 @@ export default function RevenueChart({ timeRange, hideNumbers = false }: Revenue
date: date.toISOString().split('T')[0], // YYYY-MM-DD format
revenue: item.revenue || 0,
orders: item.orders || 0,
- formattedDate: date.toLocaleDateString('en-GB', {
+ formattedDate: date.toLocaleDateString('en-GB', {
weekday: 'short',
- month: 'short',
+ month: 'short',
day: 'numeric',
timeZone: 'UTC'
})
@@ -79,12 +79,12 @@ export default function RevenueChart({ timeRange, hideNumbers = false }: Revenue
// Function to mask sensitive numbers
const maskValue = (value: string): string => {
if (!hideNumbers) return value;
-
+
// For currency values (£X.XX), show £***
if (value.includes('£')) {
return '£***';
}
-
+
// For regular numbers, replace with asterisks
return '***';
};
@@ -110,7 +110,7 @@ export default function RevenueChart({ timeRange, hideNumbers = false }: Revenue
if (isLoading) {
return (
-
-
-
-
+
+
+
+
+
+
+
+
- hideNumbers ? '***' : `£${(value / 1000).toFixed(0)}k`}
/>
- } />
- } cursor={{ fill: "transparent", stroke: "hsl(var(--muted-foreground))", strokeDasharray: "3 3" }} />
+
-
+
-
+
{/* Summary stats */}
diff --git a/lib/services/analytics-service.ts b/lib/services/analytics-service.ts
index 8dace69..9bd1513 100644
--- a/lib/services/analytics-service.ts
+++ b/lib/services/analytics-service.ts
@@ -494,15 +494,18 @@ export const getStockPredictions = async (
* @param daysAhead Number of days to predict ahead (default: 7)
* @param period Historical period in days (default: 30)
* @param storeId Optional storeId for staff users
+ * @param simulation Simulation factor (e.g. 0.1 for +10%)
*/
export const getPredictionsOverview = async (
daysAhead: number = 7,
period: number = 30,
storeId?: string,
+ simulation: number = 0,
): Promise
=> {
const params = new URLSearchParams({
daysAhead: daysAhead.toString(),
period: period.toString(),
+ simulation: simulation.toString(),
});
if (storeId) params.append("storeId", storeId);
@@ -538,7 +541,8 @@ export const getStockPredictionsWithStore = async (
export const getPredictionsOverviewWithStore = async (
daysAhead: number = 7,
period: number = 30,
+ simulation: number = 0,
): Promise => {
const storeId = getStoreIdForUser();
- return getPredictionsOverview(daysAhead, period, storeId);
+ return getPredictionsOverview(daysAhead, period, storeId, simulation);
};