From 8e591a3d88b340b47b23fbdbc4276d86f29038de Mon Sep 17 00:00:00 2001
From: NotII <46204250+NotII@users.noreply.github.com>
Date: Sun, 31 Aug 2025 18:56:52 +0100
Subject: [PATCH] Refactor and relocate customer insights in order details
Moved the customer insights section from a separate card to the customer history area within the order details page. Simplified the display and removed unused icon imports for a cleaner UI.
---
app/dashboard/orders/[id]/page.tsx | 115 +++++++++++------------------
public/git-info.json | 4 +-
2 files changed, 45 insertions(+), 74 deletions(-)
diff --git a/app/dashboard/orders/[id]/page.tsx b/app/dashboard/orders/[id]/page.tsx
index 65a0220..0b7886c 100644
--- a/app/dashboard/orders/[id]/page.tsx
+++ b/app/dashboard/orders/[id]/page.tsx
@@ -22,7 +22,7 @@ import {
CardHeader,
CardTitle,
} from "@/components/ui/card";
-import { Clipboard, Truck, Package, ArrowRight, ChevronDown, AlertTriangle, Copy, Loader2, RefreshCw, Users, TrendingUp, Calendar, DollarSign } from "lucide-react";
+import { Clipboard, Truck, Package, ArrowRight, ChevronDown, AlertTriangle, Copy, Loader2, RefreshCw } from "lucide-react";
import { useRouter } from "next/navigation";
import { toast } from "sonner";
import {
@@ -691,77 +691,7 @@ export default function OrderDetailsPage() {
)}
- {/* Customer Insights */}
- {customerInsights && order?.telegramUsername && (
-
-
-
-
- Customer Insights - @{order.telegramUsername}
-
-
-
-
-
-
- {customerInsights.totalOrders}
-
-
Total Orders
-
- {customerInsights.paidOrders} paid
-
-
-
-
-
- £{customerInsights.totalSpent.toFixed(2)}
-
-
Total Spent
-
- £{customerInsights.averageOrderValue.toFixed(2)} avg
-
-
-
-
-
- {customerInsights.paymentSuccessRate.toFixed(1)}%
-
-
Success Rate
-
- {customerInsights.completionRate.toFixed(1)}% completed
-
-
-
-
-
- {customerInsights.customerSince}
-
-
Days as Customer
-
- {customerInsights.firstOrder ?
- new Date(customerInsights.firstOrder).toLocaleDateString('en-GB', {
- day: '2-digit',
- month: 'short',
- year: 'numeric'
- }) : 'N/A'
- }
-
-
-
-
- {customerInsights.cancellationRate > 20 && (
-
-
-
-
- High cancellation rate: {customerInsights.cancellationRate.toFixed(1)}%
-
-
-
- )}
-
-
- )}
+
{/* Left Column - Order Details */}
@@ -862,6 +792,47 @@ export default function OrderDetailsPage() {
)}
+ {/* Customer History */}
+ {customerInsights && (
+
+
+
+
+ Total Orders
+ {customerInsights.totalOrders}
+
+
+ Total Spent
+ £{customerInsights.totalSpent.toFixed(2)}
+
+
+ Success Rate
+ {customerInsights.paymentSuccessRate.toFixed(1)}%
+
+
+ Customer Since
+
+ {customerInsights.firstOrder ?
+ new Date(customerInsights.firstOrder).toLocaleDateString('en-GB', {
+ day: '2-digit',
+ month: 'short',
+ year: 'numeric'
+ }) : 'N/A'
+ }
+
+
+
+ {customerInsights.cancellationRate > 20 && (
+
+
+
+
High cancellation rate: {customerInsights.cancellationRate.toFixed(1)}%
+
+
+ )}
+
+ )}
+
diff --git a/public/git-info.json b/public/git-info.json
index 563928d..0fab168 100644
--- a/public/git-info.json
+++ b/public/git-info.json
@@ -1,4 +1,4 @@
{
- "commitHash": "9cf2265",
- "buildTime": "2025-08-31T17:30:00.225Z"
+ "commitHash": "a10b9e0",
+ "buildTime": "2025-08-31T17:56:33.446Z"
}
\ No newline at end of file