From 40cac8e2e34bdbcbe8f235a1335b3f56e107862e Mon Sep 17 00:00:00 2001 From: dwindown Date: Fri, 21 Nov 2025 00:43:15 +0700 Subject: [PATCH] refactor(customers): Use VerticalTabForm for better desktop/mobile layout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changed from horizontal Tabs to VerticalTabForm component: Layout Changes: Desktop (≥768px): ✅ Vertical tabs on left side ✅ Content on right side ✅ Better use of wide screens ✅ Reduces horizontal scrolling ✅ More compact, professional look Mobile (<768px): ✅ Horizontal tabs at top ✅ Scrollable tabs if needed ✅ Full-width content below ✅ Touch-friendly navigation Structure: [Customer Info Card] [Tabs] [Content Area] │ ├─ Overview (Stats + Contact) ├─ Orders (Full history) └─ Address (Billing + Shipping) Benefits: ✅ Consistent with form pages (Products, Coupons, Customers edit) ✅ Better desktop experience (vertical tabs) ✅ Better mobile experience (horizontal tabs) ✅ Responsive by default ✅ Clean, organized layout ✅ No wasted space on wide screens Technical: - Uses VerticalTabForm component - FormSection for each tab content - Automatic scroll spy - Mobile horizontal tabs (lg:hidden) - Desktop vertical tabs (hidden lg:block) Result: Customer detail page now has proper responsive tab layout matching form pages! --- admin-spa/src/routes/Customers/Detail.tsx | 41 +++++++++++------------ 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/admin-spa/src/routes/Customers/Detail.tsx b/admin-spa/src/routes/Customers/Detail.tsx index 177ea1e..c361bec 100644 --- a/admin-spa/src/routes/Customers/Detail.tsx +++ b/admin-spa/src/routes/Customers/Detail.tsx @@ -10,7 +10,7 @@ import { ErrorCard } from '@/components/ErrorCard'; import { Skeleton } from '@/components/ui/skeleton'; import { Card } from '@/components/ui/card'; import { Button } from '@/components/ui/button'; -import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; +import { VerticalTabForm, FormSection } from '@/components/VerticalTabForm'; import { ArrowLeft, Edit, Mail, Calendar, ShoppingBag, DollarSign, User, MapPin } from 'lucide-react'; import { formatMoney } from '@/lib/currency'; @@ -18,7 +18,6 @@ export default function CustomerDetail() { const { id } = useParams<{ id: string }>(); const navigate = useNavigate(); const customerId = parseInt(id || '0', 10); - const [activeTab, setActiveTab] = React.useState('overview'); // Fetch customer data const customerQuery = useQuery({ @@ -113,18 +112,18 @@ export default function CustomerDetail() { - {/* Tabs */} - - - {__('Overview')} - {__('Orders')} - {__('Address')} - - - {/* Overview Tab */} - + {/* Vertical Tabs */} + + {/* Overview Section */} + {/* Stats Grid */} -
+
@@ -177,10 +176,10 @@ export default function CustomerDetail() { )}
- + - {/* Orders Tab */} - + {/* Orders Section */} +

{__('Order History')}

@@ -238,10 +237,10 @@ export default function CustomerDetail() {
)}
-
+ - {/* Address Tab */} - + {/* Address Section */} +
{/* Billing Address */} @@ -309,8 +308,8 @@ export default function CustomerDetail() { )}
-
- + +
); }