diff --git a/components/analytics/PredictionsChart.tsx b/components/analytics/PredictionsChart.tsx index e8c7dc1..7949323 100644 --- a/components/analytics/PredictionsChart.tsx +++ b/components/analytics/PredictionsChart.tsx @@ -26,7 +26,9 @@ import { RefreshCw, Calendar, BarChart3, - Sparkles, + Brain, + Layers, + Zap, } from "lucide-react"; import { useToast } from "@/hooks/use-toast"; import { Skeleton } from "@/components/ui/skeleton"; @@ -46,6 +48,15 @@ import { TableRow, } from "@/components/ui/table"; import { format } from "date-fns"; +import { + AreaChart, + Area, + XAxis, + YAxis, + CartesianGrid, + Tooltip, + ResponsiveContainer, +} from "recharts"; interface PredictionsChartProps { timeRange?: number; @@ -163,9 +174,6 @@ export default function PredictionsChart({ Predictions & Forecasting - {predictions.sales.aiModel?.used && ( - - )} {predictions.sales.aiModel?.used @@ -292,36 +300,6 @@ export default function PredictionsChart({ orders )} - {predictions.sales.confidenceIntervals && ( -
-
- Range: {formatGBP(predictions.sales.confidenceIntervals.lower)} -{" "} - {formatGBP(predictions.sales.confidenceIntervals.upper)} -
-
- 95% confidence interval -
- {predictions.sales.confidenceIntervals.confidenceScore !== undefined && ( -
- {predictions.sales.confidenceIntervals.avgModelAccuracy !== undefined && ( -
- Model Accuracy: {Math.round(predictions.sales.confidenceIntervals.avgModelAccuracy * 100)}% -
- )} - {predictions.sales.confidenceIntervals.modelAgreement !== undefined && ( -
- Agreement: {Math.round(predictions.sales.confidenceIntervals.modelAgreement * 100)}% -
- )} - {predictions.sales.confidenceIntervals.dataConsistency !== undefined && ( -
- Data Quality: {Math.round(predictions.sales.confidenceIntervals.dataConsistency * 100)}% -
- )} -
- )} -
- )} {!predictions.sales.confidenceIntervals && predictions.sales.minPrediction && predictions.sales.maxPrediction && ( @@ -340,51 +318,42 @@ export default function PredictionsChart({ + {/* Model Intelligence Card */} - - Demand Prediction + + Model Intelligence - {predictions.demand.predictedDaily !== null ? ( -
-
- {predictions.demand.predictedDaily.toFixed(1)} units/day -
-
- - {getConfidenceLabel(predictions.demand.confidence)} Confidence - -
- {predictions.demand.predictedWeekly && ( -
- ~{predictions.demand.predictedWeekly.toFixed(0)} units/week -
- )} - {predictions.demand.predictedMonthly && ( -
- ~{predictions.demand.predictedMonthly.toFixed(0)} units/month -
- )} - {predictions.demand.confidenceIntervals && ( -
- Range: {predictions.demand.confidenceIntervals.lower.toFixed(1)} -{" "} - {predictions.demand.confidenceIntervals.upper.toFixed(1)} units/day -
- )} +
+
+ Architecture + + + Hybrid Ensemble (Deep Learning) +
- ) : ( -
- {predictions.demand.message || - "Insufficient data for prediction"} + {stockPredictions?.predictions && ( +
+ Features + + Multi-Feature Enabled + +
+ )} +
+ Optimization + + + Performance Tuned +
- )} +
+ Model automatically retrains with new sales data. +
+
@@ -399,28 +368,59 @@ export default function PredictionsChart({ -
- {predictions.sales.dailyPredictions.map((day) => ( -
+ + ({ + ...d, + formattedDate: format(new Date(d.date), "MMM d"), + value: d.predicted + }))} + margin={{ + top: 5, + right: 10, + left: 0, + bottom: 0, + }} > -
- -
-
- Day {day.day} -
-
- {format(new Date(day.date), "MMM d, yyyy")} -
-
-
-
- {formatGBP(day.predicted)} -
-
- ))} + + + + + + + + + `£${value}`} + /> + [formatGBP(value), "Revenue"]} + /> + + +