@burdenoff/microfe-subscriberbot 2026.625.1 → 2026.626.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/subscriberbot/pages/HomePage.js +19 -14
- package/dist/subscriberbot/pages/HomePage.js.map +1 -1
- package/dist/subscriberbot/pages/admin/AdminAnalyticsPage.js +66 -60
- package/dist/subscriberbot/pages/admin/AdminAnalyticsPage.js.map +1 -1
- package/dist/subscriberbot/pages/admin/AdminDashboard.js +83 -44
- package/dist/subscriberbot/pages/admin/AdminDashboard.js.map +1 -1
- package/dist/subscriberbot/pages/admin/AdminFinancialPage.js +38 -32
- package/dist/subscriberbot/pages/admin/AdminFinancialPage.js.map +1 -1
- package/dist/subscriberbot/pages/admin/AdminOrdersPage.js +226 -221
- package/dist/subscriberbot/pages/admin/AdminOrdersPage.js.map +1 -1
- package/dist/subscriberbot/pages/admin/AdminProfilePage.js +127 -125
- package/dist/subscriberbot/pages/admin/AdminProfilePage.js.map +1 -1
- package/dist/subscriberbot/pages/admin/AdminSettingsPage.js +235 -230
- package/dist/subscriberbot/pages/admin/AdminSettingsPage.js.map +1 -1
- package/dist/subscriberbot/pages/admin/CartManagementPage.js +267 -262
- package/dist/subscriberbot/pages/admin/CartManagementPage.js.map +1 -1
- package/dist/subscriberbot/pages/admin/UserManagementPage.js +267 -262
- package/dist/subscriberbot/pages/admin/UserManagementPage.js.map +1 -1
- package/dist/subscriberbot/pages/cart-owner/AnalyticsDashboard.js +46 -41
- package/dist/subscriberbot/pages/cart-owner/AnalyticsDashboard.js.map +1 -1
- package/dist/subscriberbot/pages/cart-owner/BusinessSettingsPage.js +257 -252
- package/dist/subscriberbot/pages/cart-owner/BusinessSettingsPage.js.map +1 -1
- package/dist/subscriberbot/pages/cart-owner/CartOwnerDashboard.js +231 -194
- package/dist/subscriberbot/pages/cart-owner/CartOwnerDashboard.js.map +1 -1
- package/dist/subscriberbot/pages/cart-owner/CartOwnerProfilePage.js +167 -162
- package/dist/subscriberbot/pages/cart-owner/CartOwnerProfilePage.js.map +1 -1
- package/dist/subscriberbot/pages/cart-owner/CartServiceConfigPage.js +128 -126
- package/dist/subscriberbot/pages/cart-owner/CartServiceConfigPage.js.map +1 -1
- package/dist/subscriberbot/pages/cart-owner/InventoryManagementPage.js +297 -300
- package/dist/subscriberbot/pages/cart-owner/InventoryManagementPage.js.map +1 -1
- package/dist/subscriberbot/pages/cart-owner/OrderManagementPage.js +220 -223
- package/dist/subscriberbot/pages/cart-owner/OrderManagementPage.js.map +1 -1
- package/dist/subscriberbot/pages/cart-owner/StaffManagementPage.js +250 -245
- package/dist/subscriberbot/pages/cart-owner/StaffManagementPage.js.map +1 -1
- package/dist/subscriberbot/pages/common/HelpSupportPage.js +94 -96
- package/dist/subscriberbot/pages/common/HelpSupportPage.js.map +1 -1
- package/dist/subscriberbot/pages/common/NotificationCenterPage.js +48 -42
- package/dist/subscriberbot/pages/common/NotificationCenterPage.js.map +1 -1
- package/dist/subscriberbot/pages/common/SettingsPage.js +745 -736
- package/dist/subscriberbot/pages/common/SettingsPage.js.map +1 -1
- package/dist/subscriberbot/pages/customer/BookingDetailsPage.js +353 -321
- package/dist/subscriberbot/pages/customer/BookingDetailsPage.js.map +1 -1
- package/dist/subscriberbot/pages/customer/CartDetailPage.js +258 -225
- package/dist/subscriberbot/pages/customer/CartDetailPage.js.map +1 -1
- package/dist/subscriberbot/pages/customer/CartDiscoveryPage.js +82 -76
- package/dist/subscriberbot/pages/customer/CartDiscoveryPage.js.map +1 -1
- package/dist/subscriberbot/pages/customer/CheckoutPage.js +212 -215
- package/dist/subscriberbot/pages/customer/CheckoutPage.js.map +1 -1
- package/dist/subscriberbot/pages/customer/CustomerDashboard.js +416 -381
- package/dist/subscriberbot/pages/customer/CustomerDashboard.js.map +1 -1
- package/dist/subscriberbot/pages/customer/CustomerProfilePage.js +488 -479
- package/dist/subscriberbot/pages/customer/CustomerProfilePage.js.map +1 -1
- package/dist/subscriberbot/pages/customer/DirectServiceBookingPage.js +521 -512
- package/dist/subscriberbot/pages/customer/DirectServiceBookingPage.js.map +1 -1
- package/dist/subscriberbot/pages/customer/FavoritesPage.js +57 -51
- package/dist/subscriberbot/pages/customer/FavoritesPage.js.map +1 -1
- package/dist/subscriberbot/pages/customer/OrderHistoryPage.js +56 -50
- package/dist/subscriberbot/pages/customer/OrderHistoryPage.js.map +1 -1
- package/dist/subscriberbot/pages/customer/OrderTrackingPage.js +65 -60
- package/dist/subscriberbot/pages/customer/OrderTrackingPage.js.map +1 -1
- package/dist/subscriberbot/pages/customer/PaymentMethodsPage.js +79 -73
- package/dist/subscriberbot/pages/customer/PaymentMethodsPage.js.map +1 -1
- package/dist/subscriberbot/pages/customer/ReviewsPage.js +68 -62
- package/dist/subscriberbot/pages/customer/ReviewsPage.js.map +1 -1
- package/dist/subscriberbot/pages/customer/SavedAddressesPage.js +60 -54
- package/dist/subscriberbot/pages/customer/SavedAddressesPage.js.map +1 -1
- package/dist/subscriberbot/pages/investor/InvestmentDetailsPage.js +292 -255
- package/dist/subscriberbot/pages/investor/InvestmentDetailsPage.js.map +1 -1
- package/dist/subscriberbot/pages/investor/InvestmentOpportunitiesPage.js +237 -231
- package/dist/subscriberbot/pages/investor/InvestmentOpportunitiesPage.js.map +1 -1
- package/dist/subscriberbot/pages/investor/InvestorAnalyticsPage.js +60 -54
- package/dist/subscriberbot/pages/investor/InvestorAnalyticsPage.js.map +1 -1
- package/dist/subscriberbot/pages/investor/InvestorDashboard.js +350 -319
- package/dist/subscriberbot/pages/investor/InvestorDashboard.js.map +1 -1
- package/dist/subscriberbot/pages/investor/InvestorInvestmentsPage.js +106 -100
- package/dist/subscriberbot/pages/investor/InvestorInvestmentsPage.js.map +1 -1
- package/dist/subscriberbot/pages/investor/InvestorPortfolioPage.js +51 -45
- package/dist/subscriberbot/pages/investor/InvestorPortfolioPage.js.map +1 -1
- package/dist/subscriberbot/pages/investor/InvestorProfilePage.js +387 -382
- package/dist/subscriberbot/pages/investor/InvestorProfilePage.js.map +1 -1
- package/dist/subscriberbot/pages/worker/TaskDetailsPage.js +320 -282
- package/dist/subscriberbot/pages/worker/TaskDetailsPage.js.map +1 -1
- package/dist/subscriberbot/pages/worker/WorkerDashboard.js +92 -61
- package/dist/subscriberbot/pages/worker/WorkerDashboard.js.map +1 -1
- package/dist/subscriberbot/pages/worker/WorkerOrdersPage.js +82 -77
- package/dist/subscriberbot/pages/worker/WorkerOrdersPage.js.map +1 -1
- package/dist/subscriberbot/pages/worker/WorkerProfilePage.js +82 -77
- package/dist/subscriberbot/pages/worker/WorkerProfilePage.js.map +1 -1
- package/dist/subscriberbot/pages/worker/WorkerSchedulePage.js +348 -340
- package/dist/subscriberbot/pages/worker/WorkerSchedulePage.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FavoritesPage.js","names":[],"sources":["../../../../src/subscriberbot/pages/customer/FavoritesPage.tsx"],"sourcesContent":["/**\n * Favorites Page\n * @module subscriberbot/pages/customer\n *\n * Favorite carts AND products with stats header, 4 filters\n * (search, type, category, sort), Order Again / View Menu per cart,\n * Add to Cart / View Cart + remove per product, Veg badges,\n * prep time, 3 mock favorite products, 2 mock favorite carts.\n */\n\nimport { useState, useCallback, useEffect } from 'react';\nimport {\n Heart,\n Star,\n MapPin,\n Clock,\n CheckCircle2,\n Search,\n ShoppingCart,\n Leaf,\n Utensils,\n RotateCcw,\n ListFilter,\n X,\n} from 'lucide-react';\nimport { PageLayout } from '../../components/PageLayout';\nimport { EmptyState } from '../../components/EmptyState';\nimport { useSubscriberBot } from '../../context/SubscriberBotContext';\nimport { useProviders, useOrders } from '../../hooks/useSubscriberBotApi';\nimport { mockCarts } from '../../mocks/data';\nimport { cn } from '../../utils/cn';\nimport { formatCurrency, formatDate, formatDistance } from '../../utils/formatters';\n\n// ============================================================================\n// Types\n// ============================================================================\n\ninterface FavoriteCart {\n id: string;\n name: string;\n description: string;\n category: string;\n image: string;\n rating: number;\n reviewCount: number;\n isOpen: boolean;\n isVerified: boolean;\n distance: number;\n estimatedTime: number;\n addedToFavorites: string;\n lastOrdered?: string;\n totalOrders: number;\n totalSpent: number;\n}\n\ninterface FavoriteProduct {\n id: string;\n name: string;\n description: string;\n price: number;\n category: string;\n image: string;\n cartId: string;\n cartName: string;\n isVegetarian: boolean;\n isVegan: boolean;\n preparationTime: number;\n rating: number;\n addedToFavorites: string;\n lastOrdered?: string;\n orderCount: number;\n}\n\ninterface FavoriteFilters {\n searchQuery: string;\n type: 'all' | 'carts' | 'products';\n category: string;\n sortBy: 'recent' | 'name' | 'rating' | 'orders';\n}\n\n// ============================================================================\n// Component\n// ============================================================================\n\nexport function FavoritesPage() {\n const { navigateTo, currentUser } = useSubscriberBot();\n const { data: providers = [], isLoading: isLoadingProviders } = useProviders();\n const { data: orders = [], isLoading: isLoadingOrders } = useOrders({\n customerId: currentUser?.id,\n });\n\n const favoriteCarts: FavoriteCart[] = providers.slice(0, 2).map((p) => ({\n id: p.id,\n name: p.name,\n description: 'Authentic services from SubscriberBot',\n category: p.category,\n image: p.image,\n rating: p.rating,\n reviewCount: p.totalRatings,\n isOpen: p.isOpen,\n isVerified: p.isVerified || false,\n distance: p.distance,\n estimatedTime: p.estimatedTime,\n addedToFavorites: new Date().toISOString(),\n totalOrders: orders.filter((o) => o.cartId === p.id).length,\n totalSpent: orders.filter((o) => o.cartId === p.id).reduce((acc, o) => acc + o.total, 0),\n }));\n\n const favoriteProducts: FavoriteProduct[] = [\n {\n id: 'prod-001',\n name: 'Masala Dosa',\n description: 'Crispy rice crepe with spiced potato filling',\n price: 120,\n category: 'South Indian',\n image: 'https://images.unsplash.com/photo-1630383249896-424e482df921?w=300',\n cartId: providers[0]?.id || 'FOOD-001',\n cartName: providers[0]?.name || 'Dosa Express',\n isVegetarian: true,\n isVegan: false,\n preparationTime: 15,\n rating: 4.7,\n addedToFavorites: '2024-02-20T12:30:00Z',\n orderCount: 8,\n },\n ];\n\n const [filters, setFilters] = useState<FavoriteFilters>({\n searchQuery: '',\n type: 'all',\n category: '',\n sortBy: 'recent',\n });\n\n const isLoading = isLoadingProviders || isLoadingOrders;\n\n // --- Derived data ---\n const getDisplayItems = useCallback(() => {\n let carts = [...favoriteCarts];\n let products = [...favoriteProducts];\n\n // Search\n if (filters.searchQuery) {\n const q = filters.searchQuery.toLowerCase();\n carts = carts.filter(\n (c) =>\n c.name.toLowerCase().includes(q) ||\n c.description.toLowerCase().includes(q) ||\n c.category.toLowerCase().includes(q)\n );\n products = products.filter(\n (p) =>\n p.name.toLowerCase().includes(q) ||\n p.description.toLowerCase().includes(q) ||\n p.category.toLowerCase().includes(q) ||\n p.cartName.toLowerCase().includes(q)\n );\n }\n\n // Category\n if (filters.category) {\n carts = carts.filter((c) => c.category === filters.category);\n products = products.filter((p) => p.category === filters.category);\n }\n\n // Sort\n switch (filters.sortBy) {\n case 'recent':\n carts.sort(\n (a, b) => new Date(b.addedToFavorites).getTime() - new Date(a.addedToFavorites).getTime()\n );\n products.sort(\n (a, b) => new Date(b.addedToFavorites).getTime() - new Date(a.addedToFavorites).getTime()\n );\n break;\n case 'name':\n carts.sort((a, b) => a.name.localeCompare(b.name));\n products.sort((a, b) => a.name.localeCompare(b.name));\n break;\n case 'rating':\n carts.sort((a, b) => b.rating - a.rating);\n products.sort((a, b) => b.rating - a.rating);\n break;\n case 'orders':\n carts.sort((a, b) => b.totalOrders - a.totalOrders);\n products.sort((a, b) => b.orderCount - a.orderCount);\n break;\n }\n\n // Type filter\n if (filters.type === 'carts') return { carts, products: [] };\n if (filters.type === 'products') return { carts: [], products };\n return { carts, products };\n }, [favoriteCarts, favoriteProducts, filters]);\n\n const { carts: displayCarts, products: displayProducts } = getDisplayItems();\n\n const handleRemoveCart = (id: string) => {\n // In real app, this would call an API\n console.log('Remove cart:', id);\n };\n\n const handleRemoveProduct = (id: string) => {\n // In real app, this would call an API\n console.log('Remove product:', id);\n };\n\n // Stats\n const totalSaved =\n favoriteCarts.reduce((s, c) => s + c.totalSpent, 0) +\n favoriteProducts.reduce((s, p) => s + p.price * p.orderCount, 0);\n\n if (isLoading) {\n return (\n <PageLayout title=\"My Favorites\">\n <div className=\"flex items-center justify-center py-20\">\n <div className=\"animate-spin rounded-full h-12 w-12 border-b-2 border-foreground\" />\n </div>\n </PageLayout>\n );\n }\n\n return (\n <PageLayout\n title=\"My Favorites\"\n description={`${favoriteCarts.length} carts, ${favoriteProducts.length} products`}\n >\n {/* Stats Header */}\n <div className=\"flex flex-wrap items-center gap-4 text-sm text-text-secondary mb-6\">\n <span className=\"flex items-center gap-1.5\">\n <ShoppingCart className=\"h-3.5 w-3.5\" />\n {favoriteCarts.length} carts\n </span>\n <span className=\"flex items-center gap-1.5\">\n <Utensils className=\"h-3.5 w-3.5\" />\n {favoriteProducts.length} products\n </span>\n <span className=\"flex items-center gap-1.5\">\n <Star className=\"h-3.5 w-3.5\" />\n Total saved: {formatCurrency(totalSaved, { minimumFractionDigits: 0 })}\n </span>\n </div>\n\n {/* Filters */}\n <div className=\"rounded-lg border border-border-seam bg-bg-surface p-4 mb-6\">\n <div className=\"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3\">\n {/* Search */}\n <div className=\"relative\">\n <Search className=\"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-text-secondary\" />\n <input\n type=\"text\"\n placeholder=\"Search favorites...\"\n value={filters.searchQuery}\n onChange={(e) => setFilters((p) => ({ ...p, searchQuery: e.target.value }))}\n className=\"w-full rounded-lg border border-border-seam bg-bg-surface py-2 pl-9 pr-3 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n </div>\n\n {/* Type */}\n <select\n value={filters.type}\n onChange={(e) =>\n setFilters((p) => ({ ...p, type: e.target.value as FavoriteFilters['type'] }))\n }\n className=\"w-full rounded-lg border border-border-seam bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n >\n <option value=\"all\">All Favorites</option>\n <option value=\"carts\">Favorite Carts</option>\n <option value=\"products\">Favorite Products</option>\n </select>\n\n {/* Category */}\n <select\n value={filters.category}\n onChange={(e) => setFilters((p) => ({ ...p, category: e.target.value }))}\n className=\"w-full rounded-lg border border-border-seam bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n >\n <option value=\"\">All Categories</option>\n <option value=\"Food & Beverage\">Food & Beverage</option>\n <option value=\"Street Food\">Street Food</option>\n <option value=\"South Indian\">South Indian</option>\n <option value=\"Beverages\">Beverages</option>\n </select>\n\n {/* Sort */}\n <select\n value={filters.sortBy}\n onChange={(e) =>\n setFilters((p) => ({ ...p, sortBy: e.target.value as FavoriteFilters['sortBy'] }))\n }\n className=\"w-full rounded-lg border border-border-seam bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n >\n <option value=\"recent\">Recently Added</option>\n <option value=\"name\">Name A-Z</option>\n <option value=\"rating\">Highest Rated</option>\n <option value=\"orders\">Most Ordered</option>\n </select>\n </div>\n </div>\n\n {/* Content */}\n {displayCarts.length === 0 && displayProducts.length === 0 ? (\n <EmptyState\n illustration=\"empty-data\"\n icon={<Heart className=\"h-12 w-12\" />}\n title=\"No favorites yet\"\n description=\"Browse carts and tap the heart icon to add them to your favorites.\"\n action={\n <button\n type=\"button\"\n onClick={() => navigateTo('/customer/carts')}\n className=\"rounded-lg bg-foreground px-4 py-2 text-sm font-medium text-background hover:opacity-90 transition-opacity\"\n >\n Discover Carts\n </button>\n }\n />\n ) : (\n <div className=\"space-y-8\">\n {/* Favorite Carts */}\n {displayCarts.length > 0 && (\n <section>\n <h3 className=\"text-base font-semibold text-text-primary mb-4 flex items-center gap-2\">\n <ShoppingCart className=\"h-4 w-4 text-text-secondary\" />\n Favorite Carts ({displayCarts.length})\n </h3>\n <div className=\"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4\">\n {displayCarts.map((cart) => (\n <div\n key={cart.id}\n className=\"rounded-lg border border-border-seam bg-bg-surface shadow-sm overflow-hidden\"\n >\n {/* Image */}\n <div className=\"relative h-36 bg-bg-sunken\">\n <button\n type=\"button\"\n onClick={() => navigateTo(`/customer/carts/${cart.id}`)}\n className=\"block h-full w-full\"\n >\n <img\n src={cart.image}\n alt={cart.name}\n className=\"h-full w-full object-cover\"\n />\n </button>\n <button\n type=\"button\"\n onClick={() => handleRemoveCart(cart.id)}\n title=\"Remove from favorites\"\n className=\"absolute top-2 right-2 flex h-8 w-8 items-center justify-center rounded-full bg-bg-surface/80 backdrop-blur-sm text-status-error-text hover:bg-bg-surface transition-colors\"\n >\n <Heart className=\"h-4 w-4 fill-current\" />\n </button>\n <div className=\"absolute top-2 left-2\">\n <span\n className={cn(\n 'inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium',\n cart.isOpen\n ? 'bg-status-success-bg/20 text-status-success-text'\n : 'bg-status-error-bg/20 text-status-error-text'\n )}\n >\n {cart.isOpen ? 'Open' : 'Closed'}\n </span>\n </div>\n </div>\n\n {/* Details */}\n <div className=\"p-4\">\n <div className=\"flex items-start justify-between gap-2 mb-2\">\n <h4 className=\"text-sm font-semibold text-text-primary truncate\">\n {cart.name}\n </h4>\n <div className=\"flex items-center gap-1 shrink-0\">\n <Star className=\"h-3.5 w-3.5 fill-status-warning-text text-status-warning-text\" />\n <span className=\"text-xs font-medium text-text-primary\">\n {cart.rating}\n </span>\n <span className=\"text-xs text-text-secondary\">({cart.reviewCount})</span>\n </div>\n </div>\n\n <p className=\"text-xs text-text-secondary line-clamp-2 mb-3\">\n {cart.description}\n </p>\n\n <div className=\"space-y-1.5 text-xs text-text-secondary\">\n <div className=\"flex justify-between\">\n <span>Added:</span>\n <span>\n {formatDate(cart.addedToFavorites, {\n hour: undefined,\n minute: undefined,\n hour12: undefined,\n })}\n </span>\n </div>\n <div className=\"flex justify-between\">\n <span>Total orders:</span>\n <span>{cart.totalOrders}</span>\n </div>\n <div className=\"flex justify-between\">\n <span>Total spent:</span>\n <span className=\"font-medium\">\n {formatCurrency(cart.totalSpent, { minimumFractionDigits: 0 })}\n </span>\n </div>\n {cart.lastOrdered && (\n <div className=\"flex justify-between\">\n <span>Last ordered:</span>\n <span>\n {formatDate(cart.lastOrdered, {\n hour: undefined,\n minute: undefined,\n hour12: undefined,\n })}\n </span>\n </div>\n )}\n </div>\n\n <div className=\"flex gap-2 mt-4\">\n <button\n type=\"button\"\n onClick={() => navigateTo(`/customer/carts/${cart.id}`)}\n className=\"flex-1 flex items-center justify-center gap-1.5 rounded-lg bg-foreground px-3 py-2 text-xs font-medium text-background hover:opacity-90 transition-opacity\"\n >\n <RotateCcw className=\"h-3 w-3\" />\n Order Again\n </button>\n <button\n type=\"button\"\n onClick={() => navigateTo(`/customer/carts/${cart.id}`)}\n className=\"flex-1 rounded-lg border border-border-seam px-3 py-2 text-xs font-medium text-text-primary hover:bg-accent transition-colors\"\n >\n View Menu\n </button>\n </div>\n </div>\n </div>\n ))}\n </div>\n </section>\n )}\n\n {/* Favorite Products */}\n {displayProducts.length > 0 && (\n <section>\n <h3 className=\"text-base font-semibold text-text-primary mb-4 flex items-center gap-2\">\n <Utensils className=\"h-4 w-4 text-text-secondary\" />\n Favorite Products ({displayProducts.length})\n </h3>\n <div className=\"space-y-3\">\n {displayProducts.map((product) => (\n <div\n key={product.id}\n className=\"rounded-lg border border-border-seam bg-bg-surface p-4\"\n >\n <div className=\"flex flex-col sm:flex-row sm:items-center gap-4\">\n {/* Image */}\n <img\n src={product.image}\n alt={product.name}\n className=\"w-20 h-20 rounded-lg object-cover shrink-0 mx-auto sm:mx-0\"\n />\n\n {/* Info */}\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-start justify-between gap-2 mb-1\">\n <h4 className=\"text-sm font-semibold text-text-primary\">\n {product.name}\n </h4>\n <div className=\"flex items-center gap-2 shrink-0\">\n <span className=\"text-base font-bold text-text-primary\">\n {formatCurrency(product.price, { minimumFractionDigits: 0 })}\n </span>\n <button\n type=\"button\"\n onClick={() => handleRemoveProduct(product.id)}\n title=\"Remove from favorites\"\n className=\"rounded-md p-1 text-status-error-text hover:bg-status-error-bg/10 transition-colors\"\n >\n <X className=\"h-4 w-4\" />\n </button>\n </div>\n </div>\n\n <p className=\"text-xs text-text-secondary mb-2\">{product.description}</p>\n\n <div className=\"flex flex-wrap items-center gap-2 text-xs text-text-secondary mb-2\">\n <span>\n From:{' '}\n <span className=\"font-medium text-text-primary\">\n {product.cartName}\n </span>\n </span>\n <span>Ordered {product.orderCount} times</span>\n <span>\n Added:{' '}\n {formatDate(product.addedToFavorites, {\n hour: undefined,\n minute: undefined,\n hour12: undefined,\n })}\n </span>\n </div>\n\n <div className=\"flex flex-wrap items-center gap-2\">\n {product.isVegetarian && (\n <span className=\"inline-flex items-center gap-1 rounded-full bg-status-success-bg/10 px-2 py-0.5 text-[10px] font-medium text-status-success-text\">\n <Leaf className=\"h-3 w-3\" />\n Veg\n </span>\n )}\n {product.isVegan && (\n <span className=\"inline-flex items-center gap-1 rounded-full bg-status-success-bg/10 px-2 py-0.5 text-[10px] font-medium text-status-success-text\">\n <Leaf className=\"h-3 w-3\" />\n Vegan\n </span>\n )}\n <span className=\"inline-flex items-center gap-1 rounded-full bg-bg-sunken px-2 py-0.5 text-[10px] font-medium text-text-secondary\">\n <Clock className=\"h-3 w-3\" />\n {product.preparationTime} min\n </span>\n </div>\n </div>\n\n {/* Actions */}\n <div className=\"flex sm:flex-col gap-2 shrink-0\">\n <button\n type=\"button\"\n onClick={() => navigateTo(`/customer/carts/${product.cartId}`)}\n className=\"flex-1 sm:flex-none rounded-lg bg-foreground px-4 py-2 text-xs font-medium text-background hover:opacity-90 transition-opacity whitespace-nowrap\"\n >\n Add to Cart\n </button>\n <button\n type=\"button\"\n onClick={() => navigateTo(`/customer/carts/${product.cartId}`)}\n className=\"flex-1 sm:flex-none rounded-lg border border-border-seam px-4 py-2 text-xs font-medium text-text-primary hover:bg-accent transition-colors whitespace-nowrap\"\n >\n View Cart\n </button>\n </div>\n </div>\n </div>\n ))}\n </div>\n </section>\n )}\n </div>\n )}\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;AAoFA,SAAgB,IAAgB;CAC9B,IAAM,EAAE,eAAY,mBAAgB,GAAkB,EAChD,EAAE,MAAM,IAAY,EAAE,EAAE,WAAW,MAAuB,GAAc,EACxE,EAAE,MAAM,IAAS,EAAE,EAAE,WAAW,MAAoB,EAAU,EAClE,YAAY,GAAa,IAC1B,CAAC,EAEI,IAAgC,EAAU,MAAM,GAAG,EAAE,CAAC,KAAK,OAAO;EACtE,IAAI,EAAE;EACN,MAAM,EAAE;EACR,aAAa;EACb,UAAU,EAAE;EACZ,OAAO,EAAE;EACT,QAAQ,EAAE;EACV,aAAa,EAAE;EACf,QAAQ,EAAE;EACV,YAAY,EAAE,cAAc;EAC5B,UAAU,EAAE;EACZ,eAAe,EAAE;EACjB,mCAAkB,IAAI,MAAM,EAAC,aAAa;EAC1C,aAAa,EAAO,QAAQ,MAAM,EAAE,WAAW,EAAE,GAAG,CAAC;EACrD,YAAY,EAAO,QAAQ,MAAM,EAAE,WAAW,EAAE,GAAG,CAAC,QAAQ,GAAK,MAAM,IAAM,EAAE,OAAO,EAAE;EACzF,EAAE,EAEG,IAAsC,CAC1C;EACE,IAAI;EACJ,MAAM;EACN,aAAa;EACb,OAAO;EACP,UAAU;EACV,OAAO;EACP,QAAQ,EAAU,IAAI,MAAM;EAC5B,UAAU,EAAU,IAAI,QAAQ;EAChC,cAAc;EACd,SAAS;EACT,iBAAiB;EACjB,QAAQ;EACR,kBAAkB;EAClB,YAAY;EACb,CACF,EAEK,CAAC,GAAS,KAAc,EAA0B;EACtD,aAAa;EACb,MAAM;EACN,UAAU;EACV,QAAQ;EACT,CAAC,EAEI,IAAY,KAAsB,GA6DlC,EAAE,OAAO,GAAc,UAAU,MA1Df,QAAkB;EACxC,I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,EAAA,CAAA;YAC/C,kBAAC,QAAD,EAAA,UAAA;aAAM;aACG;aACN,EAAW,EAAQ,kBAAkB;cACpC,MAAM,KAAA;cACN,QAAQ,KAAA;cACR,QAAQ,KAAA;cACT,CAAC;aACG,EAAA,CAAA;YACH;;UAEN,kBAAC,OAAD;WAAK,WAAU;qBAAf;YACG,EAAQ,gBACP,kBAAC,QAAD;aAAM,WAAU;uBAAhB,CACE,kBAAC,GAAD,EAAM,WAAU,WAAY,CAAA,EAAA,MAEvB;;YAER,EAAQ,WACP,kBAAC,QAAD;aAAM,WAAU;uBAAhB,CACE,kBAAC,GAAD,EAAM,WAAU,WAAY,CAAA,EAAA,QAEvB;;YAET,kBAAC,QAAD;aAAM,WAAU;uBAAhB;cACE,kBAAC,GAAD,EAAO,WAAU,WAAY,CAAA;cAC5B,EAAQ;cAAgB;cACpB;;YACH;;UACF;;QAGN,kBAAC,OAAD;SAAK,WAAU;mBAAf,CACE,kBAAC,UAAD;UACE,MAAK;UACL,eAAe,EAAW,mBAAmB,EAAQ,SAAS;UAC9D,WAAU;oBACX;UAEQ,CAAA,EACT,kBAAC,UAAD;UACE,MAAK;UACL,eAAe,EAAW,mBAAmB,EAAQ,SAAS;UAC9D,WAAU;oBACX;UAEQ,CAAA,CACL;;QACF;;MACF,EA1FC,EAAQ,GA0FT,CACN;KACE,CAAA,CACE,EAAA,CAAA,CAER;;GAEG"}
|
|
1
|
+
{"version":3,"file":"FavoritesPage.js","names":[],"sources":["../../../../src/subscriberbot/pages/customer/FavoritesPage.tsx"],"sourcesContent":["/**\n * Favorites Page\n * @module subscriberbot/pages/customer\n *\n * Favorite carts AND products with stats header, 4 filters\n * (search, type, category, sort), Order Again / View Menu per cart,\n * Add to Cart / View Cart + remove per product, Veg badges,\n * prep time, 3 mock favorite products, 2 mock favorite carts.\n */\n\nimport { useState, useCallback, useEffect } from 'react';\nimport {\n Heart,\n Star,\n MapPin,\n Clock,\n CheckCircle2,\n Search,\n ShoppingCart,\n Leaf,\n Utensils,\n RotateCcw,\n ListFilter,\n X,\n} from 'lucide-react';\nimport { PagePurpose, EmphasisPanel } from '@burdenoff/fe-libs/ui';\nimport { PageLayout } from '../../components/PageLayout';\nimport { EmptyState } from '../../components/EmptyState';\nimport { useSubscriberBot } from '../../context/SubscriberBotContext';\nimport { useProviders, useOrders } from '../../hooks/useSubscriberBotApi';\nimport { mockCarts } from '../../mocks/data';\nimport { cn } from '../../utils/cn';\nimport { formatCurrency, formatDate, formatDistance } from '../../utils/formatters';\n\n// ============================================================================\n// Types\n// ============================================================================\n\ninterface FavoriteCart {\n id: string;\n name: string;\n description: string;\n category: string;\n image: string;\n rating: number;\n reviewCount: number;\n isOpen: boolean;\n isVerified: boolean;\n distance: number;\n estimatedTime: number;\n addedToFavorites: string;\n lastOrdered?: string;\n totalOrders: number;\n totalSpent: number;\n}\n\ninterface FavoriteProduct {\n id: string;\n name: string;\n description: string;\n price: number;\n category: string;\n image: string;\n cartId: string;\n cartName: string;\n isVegetarian: boolean;\n isVegan: boolean;\n preparationTime: number;\n rating: number;\n addedToFavorites: string;\n lastOrdered?: string;\n orderCount: number;\n}\n\ninterface FavoriteFilters {\n searchQuery: string;\n type: 'all' | 'carts' | 'products';\n category: string;\n sortBy: 'recent' | 'name' | 'rating' | 'orders';\n}\n\n// ============================================================================\n// Component\n// ============================================================================\n\nexport function FavoritesPage() {\n const { navigateTo, currentUser } = useSubscriberBot();\n const { data: providers = [], isLoading: isLoadingProviders } = useProviders();\n const { data: orders = [], isLoading: isLoadingOrders } = useOrders({\n customerId: currentUser?.id,\n });\n\n const favoriteCarts: FavoriteCart[] = providers.slice(0, 2).map((p) => ({\n id: p.id,\n name: p.name,\n description: 'Authentic services from SubscriberBot',\n category: p.category,\n image: p.image,\n rating: p.rating,\n reviewCount: p.totalRatings,\n isOpen: p.isOpen,\n isVerified: p.isVerified || false,\n distance: p.distance,\n estimatedTime: p.estimatedTime,\n addedToFavorites: new Date().toISOString(),\n totalOrders: orders.filter((o) => o.cartId === p.id).length,\n totalSpent: orders.filter((o) => o.cartId === p.id).reduce((acc, o) => acc + o.total, 0),\n }));\n\n const favoriteProducts: FavoriteProduct[] = [\n {\n id: 'prod-001',\n name: 'Masala Dosa',\n description: 'Crispy rice crepe with spiced potato filling',\n price: 120,\n category: 'South Indian',\n image: 'https://images.unsplash.com/photo-1630383249896-424e482df921?w=300',\n cartId: providers[0]?.id || 'FOOD-001',\n cartName: providers[0]?.name || 'Dosa Express',\n isVegetarian: true,\n isVegan: false,\n preparationTime: 15,\n rating: 4.7,\n addedToFavorites: '2024-02-20T12:30:00Z',\n orderCount: 8,\n },\n ];\n\n const [filters, setFilters] = useState<FavoriteFilters>({\n searchQuery: '',\n type: 'all',\n category: '',\n sortBy: 'recent',\n });\n\n const isLoading = isLoadingProviders || isLoadingOrders;\n\n // --- Derived data ---\n const getDisplayItems = useCallback(() => {\n let carts = [...favoriteCarts];\n let products = [...favoriteProducts];\n\n // Search\n if (filters.searchQuery) {\n const q = filters.searchQuery.toLowerCase();\n carts = carts.filter(\n (c) =>\n c.name.toLowerCase().includes(q) ||\n c.description.toLowerCase().includes(q) ||\n c.category.toLowerCase().includes(q)\n );\n products = products.filter(\n (p) =>\n p.name.toLowerCase().includes(q) ||\n p.description.toLowerCase().includes(q) ||\n p.category.toLowerCase().includes(q) ||\n p.cartName.toLowerCase().includes(q)\n );\n }\n\n // Category\n if (filters.category) {\n carts = carts.filter((c) => c.category === filters.category);\n products = products.filter((p) => p.category === filters.category);\n }\n\n // Sort\n switch (filters.sortBy) {\n case 'recent':\n carts.sort(\n (a, b) => new Date(b.addedToFavorites).getTime() - new Date(a.addedToFavorites).getTime()\n );\n products.sort(\n (a, b) => new Date(b.addedToFavorites).getTime() - new Date(a.addedToFavorites).getTime()\n );\n break;\n case 'name':\n carts.sort((a, b) => a.name.localeCompare(b.name));\n products.sort((a, b) => a.name.localeCompare(b.name));\n break;\n case 'rating':\n carts.sort((a, b) => b.rating - a.rating);\n products.sort((a, b) => b.rating - a.rating);\n break;\n case 'orders':\n carts.sort((a, b) => b.totalOrders - a.totalOrders);\n products.sort((a, b) => b.orderCount - a.orderCount);\n break;\n }\n\n // Type filter\n if (filters.type === 'carts') return { carts, products: [] };\n if (filters.type === 'products') return { carts: [], products };\n return { carts, products };\n }, [favoriteCarts, favoriteProducts, filters]);\n\n const { carts: displayCarts, products: displayProducts } = getDisplayItems();\n\n const handleRemoveCart = (id: string) => {\n // In real app, this would call an API\n console.log('Remove cart:', id);\n };\n\n const handleRemoveProduct = (id: string) => {\n // In real app, this would call an API\n console.log('Remove product:', id);\n };\n\n // Stats\n const totalSaved =\n favoriteCarts.reduce((s, c) => s + c.totalSpent, 0) +\n favoriteProducts.reduce((s, p) => s + p.price * p.orderCount, 0);\n\n if (isLoading) {\n return (\n <PageLayout title=\"My Favorites\">\n <div className=\"flex items-center justify-center py-20\">\n <div className=\"animate-spin rounded-full h-12 w-12 border-b-2 border-foreground\" />\n </div>\n </PageLayout>\n );\n }\n\n return (\n <PageLayout\n title=\"My Favorites\"\n description={`${favoriteCarts.length} carts, ${favoriteProducts.length} products`}\n >\n <PagePurpose icon={<Heart className=\"h-4 w-4\" />} className=\"mb-6\">\n Your shortlist of carts and items worth coming back to. Save anything you love so\n you can reorder in seconds instead of searching again, and see at a glance how much\n you've saved with favourites. Filter by carts or products to find exactly what\n you're craving.\n </PagePurpose>\n\n {/* Stats Header — the ONE emphasis zone */}\n <EmphasisPanel className=\"flex flex-wrap items-center gap-4 text-sm text-text-secondary mb-6\">\n <span className=\"flex items-center gap-1.5\">\n <ShoppingCart className=\"h-3.5 w-3.5\" />\n {favoriteCarts.length} carts\n </span>\n <span className=\"flex items-center gap-1.5\">\n <Utensils className=\"h-3.5 w-3.5\" />\n {favoriteProducts.length} products\n </span>\n <span className=\"flex items-center gap-1.5\">\n <Star className=\"h-3.5 w-3.5\" />\n Total saved: {formatCurrency(totalSaved, { minimumFractionDigits: 0 })}\n </span>\n </EmphasisPanel>\n\n {/* Filters */}\n <div className=\"rounded-lg border border-border-seam bg-bg-surface p-4 mb-6\">\n <div className=\"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3\">\n {/* Search */}\n <div className=\"relative\">\n <Search className=\"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-text-secondary\" />\n <input\n type=\"text\"\n placeholder=\"Search favorites...\"\n value={filters.searchQuery}\n onChange={(e) => setFilters((p) => ({ ...p, searchQuery: e.target.value }))}\n className=\"w-full rounded-lg border border-border-seam bg-bg-surface py-2 pl-9 pr-3 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n </div>\n\n {/* Type */}\n <select\n value={filters.type}\n onChange={(e) =>\n setFilters((p) => ({ ...p, type: e.target.value as FavoriteFilters['type'] }))\n }\n className=\"w-full rounded-lg border border-border-seam bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n >\n <option value=\"all\">All Favorites</option>\n <option value=\"carts\">Favorite Carts</option>\n <option value=\"products\">Favorite Products</option>\n </select>\n\n {/* Category */}\n <select\n value={filters.category}\n onChange={(e) => setFilters((p) => ({ ...p, category: e.target.value }))}\n className=\"w-full rounded-lg border border-border-seam bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n >\n <option value=\"\">All Categories</option>\n <option value=\"Food & Beverage\">Food & Beverage</option>\n <option value=\"Street Food\">Street Food</option>\n <option value=\"South Indian\">South Indian</option>\n <option value=\"Beverages\">Beverages</option>\n </select>\n\n {/* Sort */}\n <select\n value={filters.sortBy}\n onChange={(e) =>\n setFilters((p) => ({ ...p, sortBy: e.target.value as FavoriteFilters['sortBy'] }))\n }\n className=\"w-full rounded-lg border border-border-seam bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n >\n <option value=\"recent\">Recently Added</option>\n <option value=\"name\">Name A-Z</option>\n <option value=\"rating\">Highest Rated</option>\n <option value=\"orders\">Most Ordered</option>\n </select>\n </div>\n </div>\n\n {/* Content */}\n {displayCarts.length === 0 && displayProducts.length === 0 ? (\n <EmptyState\n illustration=\"empty-data\"\n icon={<Heart className=\"h-12 w-12\" />}\n title=\"No favorites yet\"\n description=\"Browse carts and tap the heart icon to add them to your favorites.\"\n action={\n <button\n type=\"button\"\n onClick={() => navigateTo('/customer/carts')}\n className=\"rounded-lg bg-foreground px-4 py-2 text-sm font-medium text-background hover:opacity-90 transition-opacity\"\n >\n Discover Carts\n </button>\n }\n />\n ) : (\n <div className=\"space-y-8\">\n {/* Favorite Carts */}\n {displayCarts.length > 0 && (\n <section>\n <h3 className=\"text-base font-semibold text-text-primary mb-4 flex items-center gap-2\">\n <ShoppingCart className=\"h-4 w-4 text-text-secondary\" />\n Favorite Carts ({displayCarts.length})\n </h3>\n <div className=\"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4\">\n {displayCarts.map((cart) => (\n <div\n key={cart.id}\n className=\"rounded-lg border border-border-seam bg-bg-surface shadow-sm overflow-hidden\"\n >\n {/* Image */}\n <div className=\"relative h-36 bg-bg-sunken\">\n <button\n type=\"button\"\n onClick={() => navigateTo(`/customer/carts/${cart.id}`)}\n className=\"block h-full w-full\"\n >\n <img\n src={cart.image}\n alt={cart.name}\n className=\"h-full w-full object-cover\"\n />\n </button>\n <button\n type=\"button\"\n onClick={() => handleRemoveCart(cart.id)}\n title=\"Remove from favorites\"\n className=\"absolute top-2 right-2 flex h-8 w-8 items-center justify-center rounded-full bg-bg-surface/80 backdrop-blur-sm text-status-error-text hover:bg-bg-surface transition-colors\"\n >\n <Heart className=\"h-4 w-4 fill-current\" />\n </button>\n <div className=\"absolute top-2 left-2\">\n <span\n className={cn(\n 'inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium',\n cart.isOpen\n ? 'bg-status-success-bg/20 text-status-success-text'\n : 'bg-status-error-bg/20 text-status-error-text'\n )}\n >\n {cart.isOpen ? 'Open' : 'Closed'}\n </span>\n </div>\n </div>\n\n {/* Details */}\n <div className=\"p-4\">\n <div className=\"flex items-start justify-between gap-2 mb-2\">\n <h4 className=\"text-sm font-semibold text-text-primary truncate\">\n {cart.name}\n </h4>\n <div className=\"flex items-center gap-1 shrink-0\">\n <Star className=\"h-3.5 w-3.5 fill-status-warning-text text-status-warning-text\" />\n <span className=\"text-xs font-medium text-text-primary\">\n {cart.rating}\n </span>\n <span className=\"text-xs text-text-secondary\">({cart.reviewCount})</span>\n </div>\n </div>\n\n <p className=\"text-xs text-text-secondary line-clamp-2 mb-3\">\n {cart.description}\n </p>\n\n <div className=\"space-y-1.5 text-xs text-text-secondary\">\n <div className=\"flex justify-between\">\n <span>Added:</span>\n <span>\n {formatDate(cart.addedToFavorites, {\n hour: undefined,\n minute: undefined,\n hour12: undefined,\n })}\n </span>\n </div>\n <div className=\"flex justify-between\">\n <span>Total orders:</span>\n <span>{cart.totalOrders}</span>\n </div>\n <div className=\"flex justify-between\">\n <span>Total spent:</span>\n <span className=\"font-medium\">\n {formatCurrency(cart.totalSpent, { minimumFractionDigits: 0 })}\n </span>\n </div>\n {cart.lastOrdered && (\n <div className=\"flex justify-between\">\n <span>Last ordered:</span>\n <span>\n {formatDate(cart.lastOrdered, {\n hour: undefined,\n minute: undefined,\n hour12: undefined,\n })}\n </span>\n </div>\n )}\n </div>\n\n <div className=\"flex gap-2 mt-4\">\n <button\n type=\"button\"\n onClick={() => navigateTo(`/customer/carts/${cart.id}`)}\n className=\"flex-1 flex items-center justify-center gap-1.5 rounded-lg bg-foreground px-3 py-2 text-xs font-medium text-background hover:opacity-90 transition-opacity\"\n >\n <RotateCcw className=\"h-3 w-3\" />\n Order Again\n </button>\n <button\n type=\"button\"\n onClick={() => navigateTo(`/customer/carts/${cart.id}`)}\n className=\"flex-1 rounded-lg border border-border-seam px-3 py-2 text-xs font-medium text-text-primary hover:bg-accent transition-colors\"\n >\n View Menu\n </button>\n </div>\n </div>\n </div>\n ))}\n </div>\n </section>\n )}\n\n {/* Favorite Products */}\n {displayProducts.length > 0 && (\n <section>\n <h3 className=\"text-base font-semibold text-text-primary mb-4 flex items-center gap-2\">\n <Utensils className=\"h-4 w-4 text-text-secondary\" />\n Favorite Products ({displayProducts.length})\n </h3>\n <div className=\"space-y-3\">\n {displayProducts.map((product) => (\n <div\n key={product.id}\n className=\"rounded-lg border border-border-seam bg-bg-surface p-4\"\n >\n <div className=\"flex flex-col sm:flex-row sm:items-center gap-4\">\n {/* Image */}\n <img\n src={product.image}\n alt={product.name}\n className=\"w-20 h-20 rounded-lg object-cover shrink-0 mx-auto sm:mx-0\"\n />\n\n {/* Info */}\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-start justify-between gap-2 mb-1\">\n <h4 className=\"text-sm font-semibold text-text-primary\">\n {product.name}\n </h4>\n <div className=\"flex items-center gap-2 shrink-0\">\n <span className=\"text-base font-bold text-text-primary\">\n {formatCurrency(product.price, { minimumFractionDigits: 0 })}\n </span>\n <button\n type=\"button\"\n onClick={() => handleRemoveProduct(product.id)}\n title=\"Remove from favorites\"\n className=\"rounded-md p-1 text-status-error-text hover:bg-status-error-bg/10 transition-colors\"\n >\n <X className=\"h-4 w-4\" />\n </button>\n </div>\n </div>\n\n <p className=\"text-xs text-text-secondary mb-2\">{product.description}</p>\n\n <div className=\"flex flex-wrap items-center gap-2 text-xs text-text-secondary mb-2\">\n <span>\n From:{' '}\n <span className=\"font-medium text-text-primary\">\n {product.cartName}\n </span>\n </span>\n <span>Ordered {product.orderCount} times</span>\n <span>\n Added:{' '}\n {formatDate(product.addedToFavorites, {\n hour: undefined,\n minute: undefined,\n hour12: undefined,\n })}\n </span>\n </div>\n\n <div className=\"flex flex-wrap items-center gap-2\">\n {product.isVegetarian && (\n <span className=\"inline-flex items-center gap-1 rounded-full bg-status-success-bg/10 px-2 py-0.5 text-[10px] font-medium text-status-success-text\">\n <Leaf className=\"h-3 w-3\" />\n Veg\n </span>\n )}\n {product.isVegan && (\n <span className=\"inline-flex items-center gap-1 rounded-full bg-status-success-bg/10 px-2 py-0.5 text-[10px] font-medium text-status-success-text\">\n <Leaf className=\"h-3 w-3\" />\n Vegan\n </span>\n )}\n <span className=\"inline-flex items-center gap-1 rounded-full bg-bg-sunken px-2 py-0.5 text-[10px] font-medium text-text-secondary\">\n <Clock className=\"h-3 w-3\" />\n {product.preparationTime} min\n </span>\n </div>\n </div>\n\n {/* Actions */}\n <div className=\"flex sm:flex-col gap-2 shrink-0\">\n <button\n type=\"button\"\n onClick={() => navigateTo(`/customer/carts/${product.cartId}`)}\n className=\"flex-1 sm:flex-none rounded-lg bg-foreground px-4 py-2 text-xs font-medium text-background hover:opacity-90 transition-opacity whitespace-nowrap\"\n >\n Add to Cart\n </button>\n <button\n type=\"button\"\n onClick={() => navigateTo(`/customer/carts/${product.cartId}`)}\n className=\"flex-1 sm:flex-none rounded-lg border border-border-seam px-4 py-2 text-xs font-medium text-text-primary hover:bg-accent transition-colors whitespace-nowrap\"\n >\n View Cart\n </button>\n </div>\n </div>\n </div>\n ))}\n </div>\n </section>\n )}\n </div>\n )}\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;AAqFA,SAAgB,IAAgB;CAC9B,IAAM,EAAE,eAAY,mBAAgB,GAAkB,EAChD,EAAE,MAAM,IAAY,EAAE,EAAE,WAAW,MAAuB,GAAc,EACxE,EAAE,MAAM,IAAS,EAAE,EAAE,WAAW,MAAoB,EAAU,EAClE,YAAY,GAAa,IAC1B,CAAC,EAEI,IAAgC,EAAU,MAAM,GAAG,EAAE,CAAC,KAAK,OAAO;EACtE,IAAI,EAAE;EACN,MAAM,EAAE;EACR,aAAa;EACb,UAAU,EAAE;EACZ,OAAO,EAAE;EACT,QAAQ,EAAE;EACV,aAAa,EAAE;EACf,QAAQ,EAAE;EACV,YAAY,EAAE,cAAc;EAC5B,UAAU,EAAE;EACZ,eAAe,EAAE;EACjB,mCA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cACpB;;YACH;;UACF;;QAGN,kBAAC,OAAD;SAAK,WAAU;mBAAf,CACE,kBAAC,UAAD;UACE,MAAK;UACL,eAAe,EAAW,mBAAmB,EAAQ,SAAS;UAC9D,WAAU;oBACX;UAEQ,CAAA,EACT,kBAAC,UAAD;UACE,MAAK;UACL,eAAe,EAAW,mBAAmB,EAAQ,SAAS;UAC9D,WAAU;oBACX;UAEQ,CAAA,CACL;;QACF;;MACF,EA1FC,EAAQ,GA0FT,CACN;KACE,CAAA,CACE,EAAA,CAAA,CAER;;GAEG"}
|
|
@@ -8,8 +8,9 @@ import { RatingDisplay as s } from "../../components/RatingDisplay.js";
|
|
|
8
8
|
import { useMemo as c, useState as l } from "react";
|
|
9
9
|
import { AlertCircle as u, CheckCircle2 as d, ChevronDown as f, Clock as p, Eye as m, Heart as h, IndianRupee as g, Loader2 as _, Package as v, RotateCcw as y, Search as b, ShoppingBag as x, Star as S, TrendingUp as C, Truck as w, XCircle as T } from "lucide-react";
|
|
10
10
|
import { jsx as E, jsxs as D } from "react/jsx-runtime";
|
|
11
|
+
import { EmphasisPanel as O, PagePurpose as k } from "@burdenoff/fe-libs/ui";
|
|
11
12
|
//#region src/subscriberbot/pages/customer/OrderHistoryPage.tsx
|
|
12
|
-
var
|
|
13
|
+
var A = 10, j = [
|
|
13
14
|
{
|
|
14
15
|
value: "",
|
|
15
16
|
label: "All Status"
|
|
@@ -42,7 +43,7 @@ var O = 10, k = [
|
|
|
42
43
|
value: "cancelled",
|
|
43
44
|
label: "Cancelled"
|
|
44
45
|
}
|
|
45
|
-
],
|
|
46
|
+
], M = [
|
|
46
47
|
{
|
|
47
48
|
value: "7days",
|
|
48
49
|
label: "Last 7 Days"
|
|
@@ -59,7 +60,7 @@ var O = 10, k = [
|
|
|
59
60
|
value: "all",
|
|
60
61
|
label: "All Time"
|
|
61
62
|
}
|
|
62
|
-
],
|
|
63
|
+
], N = [
|
|
63
64
|
{
|
|
64
65
|
value: "recent",
|
|
65
66
|
label: "Most Recent"
|
|
@@ -77,15 +78,15 @@ var O = 10, k = [
|
|
|
77
78
|
label: "Amount: Low to High"
|
|
78
79
|
}
|
|
79
80
|
];
|
|
80
|
-
function
|
|
81
|
-
let { navigateTo:
|
|
81
|
+
function P() {
|
|
82
|
+
let { navigateTo: P, currentUser: F } = e(), [I, L] = l(A), [R, z] = l({
|
|
82
83
|
status: "",
|
|
83
84
|
dateRange: "30days",
|
|
84
85
|
searchQuery: "",
|
|
85
86
|
sortBy: "recent"
|
|
86
|
-
}), { data:
|
|
87
|
-
let e =
|
|
88
|
-
for (let e of
|
|
87
|
+
}), { data: B = [], isLoading: V, isError: H } = i({ customerId: F?.id }), U = c(() => {
|
|
88
|
+
let e = B.length, t = B.reduce((e, t) => e + t.total, 0), n = e > 0 ? Math.round(t / e) : 0, r = B.filter((e) => new Date(e.orderDate) > /* @__PURE__ */ new Date(Date.now() - 10080 * 60 * 1e3)).length, i = {};
|
|
89
|
+
for (let e of B) i[e.cartName] = (i[e.cartName] || 0) + 1;
|
|
89
90
|
return {
|
|
90
91
|
totalOrders: e,
|
|
91
92
|
totalSpent: t,
|
|
@@ -93,11 +94,11 @@ function M() {
|
|
|
93
94
|
recentOrdersCount: r,
|
|
94
95
|
favoriteCart: Object.entries(i).sort((e, t) => t[1] - e[1])[0]?.[0] || "No orders yet"
|
|
95
96
|
};
|
|
96
|
-
}, [
|
|
97
|
-
let e = [...
|
|
98
|
-
if (
|
|
97
|
+
}, [B]), W = c(() => {
|
|
98
|
+
let e = [...B];
|
|
99
|
+
if (R.status && (e = e.filter((e) => e.status === R.status)), R.dateRange !== "all") {
|
|
99
100
|
let t = /* @__PURE__ */ new Date(), n = /* @__PURE__ */ new Date();
|
|
100
|
-
switch (
|
|
101
|
+
switch (R.dateRange) {
|
|
101
102
|
case "7days":
|
|
102
103
|
n.setDate(t.getDate() - 7);
|
|
103
104
|
break;
|
|
@@ -110,11 +111,11 @@ function M() {
|
|
|
110
111
|
}
|
|
111
112
|
e = e.filter((e) => new Date(e.orderDate) >= n);
|
|
112
113
|
}
|
|
113
|
-
if (
|
|
114
|
-
let t =
|
|
114
|
+
if (R.searchQuery) {
|
|
115
|
+
let t = R.searchQuery.toLowerCase();
|
|
115
116
|
e = e.filter((e) => e.id.toLowerCase().includes(t) || e.cartName.toLowerCase().includes(t) || e.items.some((e) => e.name.toLowerCase().includes(t)));
|
|
116
117
|
}
|
|
117
|
-
switch (
|
|
118
|
+
switch (R.sortBy) {
|
|
118
119
|
case "recent":
|
|
119
120
|
e.sort((e, t) => new Date(t.orderDate).getTime() - new Date(e.orderDate).getTime());
|
|
120
121
|
break;
|
|
@@ -129,22 +130,22 @@ function M() {
|
|
|
129
130
|
break;
|
|
130
131
|
}
|
|
131
132
|
return e;
|
|
132
|
-
}, [
|
|
133
|
-
|
|
133
|
+
}, [B, R]), G = c(() => W.slice(0, I), [W, I]), K = I < W.length, q = (e, t) => {
|
|
134
|
+
z((n) => ({
|
|
134
135
|
...n,
|
|
135
136
|
[e]: t
|
|
136
|
-
})),
|
|
137
|
-
},
|
|
138
|
-
|
|
137
|
+
})), L(A);
|
|
138
|
+
}, J = (e) => {
|
|
139
|
+
P(`/customer/cart/${e.cartId}`), alert("Add items to cart to reorder");
|
|
139
140
|
};
|
|
140
|
-
return
|
|
141
|
+
return V ? /* @__PURE__ */ E(t, {
|
|
141
142
|
title: "Order History",
|
|
142
143
|
description: "Loading your orders...",
|
|
143
144
|
children: /* @__PURE__ */ E("div", {
|
|
144
145
|
className: "flex h-[60vh] items-center justify-center",
|
|
145
146
|
children: /* @__PURE__ */ E(_, { className: "h-8 w-8 animate-spin text-primary" })
|
|
146
147
|
})
|
|
147
|
-
}) :
|
|
148
|
+
}) : H ? /* @__PURE__ */ E(t, {
|
|
148
149
|
title: "Order History",
|
|
149
150
|
description: "Error loading orders",
|
|
150
151
|
children: /* @__PURE__ */ D("div", {
|
|
@@ -168,7 +169,12 @@ function M() {
|
|
|
168
169
|
description: "View all your past and current orders",
|
|
169
170
|
titleGradient: !0,
|
|
170
171
|
children: [
|
|
171
|
-
/* @__PURE__ */
|
|
172
|
+
/* @__PURE__ */ E(k, {
|
|
173
|
+
icon: /* @__PURE__ */ E(v, { className: "h-4 w-4" }),
|
|
174
|
+
className: "mb-6",
|
|
175
|
+
children: "A record of everything you've ordered. Search and filter to find a past order, reorder a favourite in a couple of taps, track anything still in progress, or leave a review once it's delivered. The summary up top shows how much you've spent and which cart you return to most."
|
|
176
|
+
}),
|
|
177
|
+
/* @__PURE__ */ D(O, {
|
|
172
178
|
className: "grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-3 mb-6",
|
|
173
179
|
children: [
|
|
174
180
|
/* @__PURE__ */ D("div", {
|
|
@@ -181,7 +187,7 @@ function M() {
|
|
|
181
187
|
})]
|
|
182
188
|
}), /* @__PURE__ */ E("p", {
|
|
183
189
|
className: "text-xl font-bold text-text-primary",
|
|
184
|
-
children:
|
|
190
|
+
children: U.totalOrders
|
|
185
191
|
})]
|
|
186
192
|
}),
|
|
187
193
|
/* @__PURE__ */ D("div", {
|
|
@@ -194,7 +200,7 @@ function M() {
|
|
|
194
200
|
})]
|
|
195
201
|
}), /* @__PURE__ */ E("p", {
|
|
196
202
|
className: "text-xl font-bold text-text-primary",
|
|
197
|
-
children: a(
|
|
203
|
+
children: a(U.totalSpent, { minimumFractionDigits: 0 })
|
|
198
204
|
})]
|
|
199
205
|
}),
|
|
200
206
|
/* @__PURE__ */ D("div", {
|
|
@@ -207,7 +213,7 @@ function M() {
|
|
|
207
213
|
})]
|
|
208
214
|
}), /* @__PURE__ */ E("p", {
|
|
209
215
|
className: "text-xl font-bold text-text-primary",
|
|
210
|
-
children: a(
|
|
216
|
+
children: a(U.averageOrderValue, { minimumFractionDigits: 0 })
|
|
211
217
|
})]
|
|
212
218
|
}),
|
|
213
219
|
/* @__PURE__ */ D("div", {
|
|
@@ -220,7 +226,7 @@ function M() {
|
|
|
220
226
|
})]
|
|
221
227
|
}), /* @__PURE__ */ E("p", {
|
|
222
228
|
className: "text-xl font-bold text-text-primary",
|
|
223
|
-
children:
|
|
229
|
+
children: U.recentOrdersCount
|
|
224
230
|
})]
|
|
225
231
|
}),
|
|
226
232
|
/* @__PURE__ */ D("div", {
|
|
@@ -233,7 +239,7 @@ function M() {
|
|
|
233
239
|
})]
|
|
234
240
|
}), /* @__PURE__ */ E("p", {
|
|
235
241
|
className: "text-sm font-bold text-text-primary truncate",
|
|
236
|
-
children:
|
|
242
|
+
children: U.favoriteCart
|
|
237
243
|
})]
|
|
238
244
|
})
|
|
239
245
|
]
|
|
@@ -248,34 +254,34 @@ function M() {
|
|
|
248
254
|
children: [/* @__PURE__ */ E(b, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-text-secondary" }), /* @__PURE__ */ E("input", {
|
|
249
255
|
type: "text",
|
|
250
256
|
placeholder: "Search orders...",
|
|
251
|
-
value:
|
|
252
|
-
onChange: (e) =>
|
|
257
|
+
value: R.searchQuery,
|
|
258
|
+
onChange: (e) => q("searchQuery", e.target.value),
|
|
253
259
|
className: "w-full rounded-lg border border-border-seam bg-bg-surface pl-9 pr-3 py-2.5 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
254
260
|
})]
|
|
255
261
|
}),
|
|
256
262
|
/* @__PURE__ */ E("select", {
|
|
257
|
-
value:
|
|
258
|
-
onChange: (e) =>
|
|
263
|
+
value: R.status,
|
|
264
|
+
onChange: (e) => q("status", e.target.value),
|
|
259
265
|
className: "w-full rounded-lg border border-border-seam bg-bg-surface px-3 py-2.5 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]",
|
|
260
|
-
children:
|
|
266
|
+
children: j.map((e) => /* @__PURE__ */ E("option", {
|
|
261
267
|
value: e.value,
|
|
262
268
|
children: e.label
|
|
263
269
|
}, e.value))
|
|
264
270
|
}),
|
|
265
271
|
/* @__PURE__ */ E("select", {
|
|
266
|
-
value:
|
|
267
|
-
onChange: (e) =>
|
|
272
|
+
value: R.dateRange,
|
|
273
|
+
onChange: (e) => q("dateRange", e.target.value),
|
|
268
274
|
className: "w-full rounded-lg border border-border-seam bg-bg-surface px-3 py-2.5 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]",
|
|
269
|
-
children:
|
|
275
|
+
children: M.map((e) => /* @__PURE__ */ E("option", {
|
|
270
276
|
value: e.value,
|
|
271
277
|
children: e.label
|
|
272
278
|
}, e.value))
|
|
273
279
|
}),
|
|
274
280
|
/* @__PURE__ */ E("select", {
|
|
275
|
-
value:
|
|
276
|
-
onChange: (e) =>
|
|
281
|
+
value: R.sortBy,
|
|
282
|
+
onChange: (e) => q("sortBy", e.target.value),
|
|
277
283
|
className: "w-full rounded-lg border border-border-seam bg-bg-surface px-3 py-2.5 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]",
|
|
278
|
-
children:
|
|
284
|
+
children: N.map((e) => /* @__PURE__ */ E("option", {
|
|
279
285
|
value: e.value,
|
|
280
286
|
children: e.label
|
|
281
287
|
}, e.value))
|
|
@@ -283,26 +289,26 @@ function M() {
|
|
|
283
289
|
]
|
|
284
290
|
})
|
|
285
291
|
}),
|
|
286
|
-
|
|
292
|
+
V ? /* @__PURE__ */ D("div", {
|
|
287
293
|
className: "flex flex-col items-center justify-center py-12 text-center",
|
|
288
294
|
children: [/* @__PURE__ */ E("div", { className: "animate-spin rounded-full h-12 w-12 border-b-2 border-foreground mx-auto mb-4" }), /* @__PURE__ */ E("p", {
|
|
289
295
|
className: "text-sm text-text-secondary",
|
|
290
296
|
children: "Loading orders..."
|
|
291
297
|
})]
|
|
292
|
-
}) :
|
|
298
|
+
}) : G.length === 0 ? /* @__PURE__ */ E(r, {
|
|
293
299
|
illustration: "empty-search",
|
|
294
300
|
icon: /* @__PURE__ */ E(x, { className: "h-12 w-12" }),
|
|
295
301
|
title: "No orders found",
|
|
296
|
-
description:
|
|
302
|
+
description: R.searchQuery || R.status ? "Try adjusting your filters" : "You haven't placed any orders yet",
|
|
297
303
|
action: /* @__PURE__ */ E("button", {
|
|
298
304
|
type: "button",
|
|
299
|
-
onClick: () =>
|
|
305
|
+
onClick: () => P("/customer/carts"),
|
|
300
306
|
className: "rounded-lg bg-foreground px-4 py-2 text-sm font-medium text-background hover:opacity-90 transition-opacity",
|
|
301
307
|
children: "Start Ordering"
|
|
302
308
|
})
|
|
303
309
|
}) : /* @__PURE__ */ E("div", {
|
|
304
310
|
className: "space-y-4",
|
|
305
|
-
children:
|
|
311
|
+
children: G.map((e) => /* @__PURE__ */ E("div", {
|
|
306
312
|
className: "rounded-lg border border-border-seam bg-bg-surface hover:shadow-md transition-shadow",
|
|
307
313
|
children: /* @__PURE__ */ D("div", {
|
|
308
314
|
className: "p-4 md:p-5",
|
|
@@ -335,12 +341,12 @@ function M() {
|
|
|
335
341
|
className: "flex gap-2",
|
|
336
342
|
children: [/* @__PURE__ */ D("button", {
|
|
337
343
|
type: "button",
|
|
338
|
-
onClick: () =>
|
|
344
|
+
onClick: () => P(`/customer/orders/${e.id}`),
|
|
339
345
|
className: "flex items-center gap-1.5 rounded-lg border border-border-seam px-3 py-1.5 text-xs font-medium text-text-primary hover:bg-accent transition-colors",
|
|
340
346
|
children: [/* @__PURE__ */ E(m, { className: "h-3 w-3" }), "Track Order"]
|
|
341
347
|
}), e.status === "delivered" && /* @__PURE__ */ D("button", {
|
|
342
348
|
type: "button",
|
|
343
|
-
onClick: () =>
|
|
349
|
+
onClick: () => J(e),
|
|
344
350
|
className: "flex items-center gap-1.5 rounded-lg bg-foreground px-3 py-1.5 text-xs font-medium text-background hover:opacity-90 transition-opacity",
|
|
345
351
|
children: [/* @__PURE__ */ E(y, { className: "h-3 w-3" }), "Reorder"]
|
|
346
352
|
})]
|
|
@@ -411,7 +417,7 @@ function M() {
|
|
|
411
417
|
})]
|
|
412
418
|
}) : /* @__PURE__ */ D("button", {
|
|
413
419
|
type: "button",
|
|
414
|
-
onClick: () =>
|
|
420
|
+
onClick: () => P(`/customer/orders/${e.id}/rate`),
|
|
415
421
|
className: "flex items-center gap-1.5 rounded-lg border border-border-seam px-3 py-1.5 text-xs font-medium text-text-primary hover:bg-accent transition-colors",
|
|
416
422
|
children: [/* @__PURE__ */ E(S, { className: "h-3 w-3" }), "Rate Order"]
|
|
417
423
|
})
|
|
@@ -420,12 +426,12 @@ function M() {
|
|
|
420
426
|
})
|
|
421
427
|
}, e.id))
|
|
422
428
|
}),
|
|
423
|
-
|
|
429
|
+
K && !V && /* @__PURE__ */ E("div", {
|
|
424
430
|
className: "text-center mt-8",
|
|
425
431
|
children: /* @__PURE__ */ D("button", {
|
|
426
432
|
type: "button",
|
|
427
433
|
onClick: () => {
|
|
428
|
-
|
|
434
|
+
L((e) => e + A);
|
|
429
435
|
},
|
|
430
436
|
className: "inline-flex items-center gap-2 rounded-lg border border-border-seam px-6 py-2.5 text-sm font-medium text-text-primary hover:bg-accent transition-colors",
|
|
431
437
|
children: [/* @__PURE__ */ E(f, { className: "h-4 w-4" }), "Load More Orders"]
|
|
@@ -435,6 +441,6 @@ function M() {
|
|
|
435
441
|
});
|
|
436
442
|
}
|
|
437
443
|
//#endregion
|
|
438
|
-
export {
|
|
444
|
+
export { P as OrderHistoryPage };
|
|
439
445
|
|
|
440
446
|
//# sourceMappingURL=OrderHistoryPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrderHistoryPage.js","names":[],"sources":["../../../../src/subscriberbot/pages/customer/OrderHistoryPage.tsx"],"sourcesContent":["/**\n * Order History Page\n * @module subscriberbot/pages/customer\n *\n * Full list of customer orders with stats summary, search, status/date/sort\n * filters, rating display, reorder, cancellation reason, and Load More pagination.\n */\n\nimport { useState, useMemo, useCallback, useEffect } from 'react';\nimport {\n ShoppingBag,\n Search,\n Star,\n RotateCcw,\n Eye,\n ChevronDown,\n Package,\n IndianRupee,\n TrendingUp,\n Clock,\n Heart,\n CheckCircle2,\n XCircle,\n Truck,\n Loader2,\n AlertCircle,\n} from 'lucide-react';\nimport { PageLayout } from '../../components/PageLayout';\nimport { StatusBadge } from '../../components/StatusBadge';\nimport { EmptyState } from '../../components/EmptyState';\nimport { RatingDisplay } from '../../components/RatingDisplay';\nimport { useSubscriberBot } from '../../context/SubscriberBotContext';\nimport { useOrders } from '../../hooks/useSubscriberBotApi';\nimport { cn } from '../../utils/cn';\nimport { formatCurrency, formatDate } from '../../utils/formatters';\nimport type { OrderStatus, MockOrder } from '../../types';\n\ninterface OrderFilters {\n status: string;\n dateRange: string;\n searchQuery: string;\n sortBy: string;\n}\n\nconst PAGE_SIZE = 10;\n\nconst statusOptions = [\n { value: '', label: 'All Status' },\n { value: 'pending', label: 'Pending' },\n { value: 'confirmed', label: 'Confirmed' },\n { value: 'preparing', label: 'Preparing' },\n { value: 'ready', label: 'Ready' },\n { value: 'out_for_delivery', label: 'Out for Delivery' },\n { value: 'delivered', label: 'Delivered' },\n { value: 'cancelled', label: 'Cancelled' },\n];\n\nconst dateRangeOptions = [\n { value: '7days', label: 'Last 7 Days' },\n { value: '30days', label: 'Last 30 Days' },\n { value: '90days', label: 'Last 90 Days' },\n { value: 'all', label: 'All Time' },\n];\n\nconst sortOptions = [\n { value: 'recent', label: 'Most Recent' },\n { value: 'oldest', label: 'Oldest First' },\n { value: 'amount_high', label: 'Amount: High to Low' },\n { value: 'amount_low', label: 'Amount: Low to High' },\n];\n\nexport function OrderHistoryPage() {\n const { navigateTo, currentUser } = useSubscriberBot();\n const [displayCount, setDisplayCount] = useState(PAGE_SIZE);\n const [filters, setFilters] = useState<OrderFilters>({\n status: '',\n dateRange: '30days',\n searchQuery: '',\n sortBy: 'recent',\n });\n\n const { data: allOrders = [], isLoading, isError } = useOrders({ customerId: currentUser?.id });\n\n // Calculate stats from all orders\n const orderStats = useMemo(() => {\n const totalOrders = allOrders.length;\n const totalSpent = allOrders.reduce((sum, o) => sum + o.total, 0);\n const averageOrderValue = totalOrders > 0 ? Math.round(totalSpent / totalOrders) : 0;\n const recentOrdersCount = allOrders.filter(\n (o) => new Date(o.orderDate) > new Date(Date.now() - 7 * 24 * 60 * 60 * 1000)\n ).length;\n\n // Find favorite cart (most ordered from)\n const cartCounts: Record<string, number> = {};\n for (const o of allOrders) {\n cartCounts[o.cartName] = (cartCounts[o.cartName] || 0) + 1;\n }\n const favoriteCart =\n Object.entries(cartCounts).sort((a, b) => b[1] - a[1])[0]?.[0] || 'No orders yet';\n\n return { totalOrders, totalSpent, averageOrderValue, recentOrdersCount, favoriteCart };\n }, [allOrders]);\n\n // Filter and sort orders\n const filteredOrders = useMemo(() => {\n let orders = [...allOrders];\n\n // Filter by status\n if (filters.status) {\n orders = orders.filter((o) => o.status === filters.status);\n }\n\n // Filter by date range\n if (filters.dateRange !== 'all') {\n const now = new Date();\n const dateLimit = new Date();\n switch (filters.dateRange) {\n case '7days':\n dateLimit.setDate(now.getDate() - 7);\n break;\n case '30days':\n dateLimit.setDate(now.getDate() - 30);\n break;\n case '90days':\n dateLimit.setDate(now.getDate() - 90);\n break;\n }\n orders = orders.filter((o) => new Date(o.orderDate) >= dateLimit);\n }\n\n // Search filter\n if (filters.searchQuery) {\n const query = filters.searchQuery.toLowerCase();\n orders = orders.filter(\n (o) =>\n o.id.toLowerCase().includes(query) ||\n o.cartName.toLowerCase().includes(query) ||\n o.items.some((item) => item.name.toLowerCase().includes(query))\n );\n }\n\n // Sort\n switch (filters.sortBy) {\n case 'recent':\n orders.sort((a, b) => new Date(b.orderDate).getTime() - new Date(a.orderDate).getTime());\n break;\n case 'oldest':\n orders.sort((a, b) => new Date(a.orderDate).getTime() - new Date(b.orderDate).getTime());\n break;\n case 'amount_high':\n orders.sort((a, b) => b.total - a.total);\n break;\n case 'amount_low':\n orders.sort((a, b) => a.total - b.total);\n break;\n }\n\n return orders;\n }, [allOrders, filters]);\n\n const displayedOrders = useMemo(\n () => filteredOrders.slice(0, displayCount),\n [filteredOrders, displayCount]\n );\n\n const hasMore = displayCount < filteredOrders.length;\n\n const handleFilterChange = (key: keyof OrderFilters, value: string) => {\n setFilters((prev) => ({ ...prev, [key]: value }));\n setDisplayCount(PAGE_SIZE);\n };\n\n const handleReorder = (order: MockOrder) => {\n navigateTo(`/customer/cart/${order.cartId}`);\n alert('Add items to cart to reorder');\n };\n\n const handleLoadMore = () => {\n setDisplayCount((prev) => prev + PAGE_SIZE);\n };\n\n if (isLoading) {\n return (\n <PageLayout title=\"Order History\" description=\"Loading your orders...\">\n <div className=\"flex h-[60vh] items-center justify-center\">\n <Loader2 className=\"h-8 w-8 animate-spin text-primary\" />\n </div>\n </PageLayout>\n );\n }\n\n if (isError) {\n return (\n <PageLayout title=\"Order History\" description=\"Error loading orders\">\n <div className=\"flex h-[60vh] flex-col items-center justify-center gap-4\">\n <AlertCircle className=\"h-12 w-12 text-status-error-text\" />\n <h2 className=\"text-xl font-semibold\">Error loading your orders</h2>\n <button\n type=\"button\"\n onClick={() => window.location.reload()}\n className=\"rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text\"\n >\n Retry\n </button>\n </div>\n </PageLayout>\n );\n }\n\n return (\n <PageLayout\n title=\"Order History\"\n description=\"View all your past and current orders\"\n titleGradient\n >\n {/* Stats Summary */}\n <div className=\"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-3 mb-6\">\n <div className=\"rounded-lg border border-border-seam bg-bg-surface p-3.5\">\n <div className=\"flex items-center gap-2 mb-1\">\n <Package className=\"h-3.5 w-3.5 text-text-secondary\" />\n <p className=\"text-xs text-text-secondary\">Total Orders</p>\n </div>\n <p className=\"text-xl font-bold text-text-primary\">{orderStats.totalOrders}</p>\n </div>\n <div className=\"rounded-lg border border-border-seam bg-bg-surface p-3.5\">\n <div className=\"flex items-center gap-2 mb-1\">\n <IndianRupee className=\"h-3.5 w-3.5 text-text-secondary\" />\n <p className=\"text-xs text-text-secondary\">Total Spent</p>\n </div>\n <p className=\"text-xl font-bold text-text-primary\">\n {formatCurrency(orderStats.totalSpent, { minimumFractionDigits: 0 })}\n </p>\n </div>\n <div className=\"rounded-lg border border-border-seam bg-bg-surface p-3.5\">\n <div className=\"flex items-center gap-2 mb-1\">\n <TrendingUp className=\"h-3.5 w-3.5 text-text-secondary\" />\n <p className=\"text-xs text-text-secondary\">Average Order</p>\n </div>\n <p className=\"text-xl font-bold text-text-primary\">\n {formatCurrency(orderStats.averageOrderValue, { minimumFractionDigits: 0 })}\n </p>\n </div>\n <div className=\"rounded-lg border border-border-seam bg-bg-surface p-3.5\">\n <div className=\"flex items-center gap-2 mb-1\">\n <Clock className=\"h-3.5 w-3.5 text-text-secondary\" />\n <p className=\"text-xs text-text-secondary\">Recent Orders</p>\n </div>\n <p className=\"text-xl font-bold text-text-primary\">{orderStats.recentOrdersCount}</p>\n </div>\n <div className=\"rounded-lg border border-border-seam bg-bg-surface p-3.5 col-span-2 md:col-span-1\">\n <div className=\"flex items-center gap-2 mb-1\">\n <Heart className=\"h-3.5 w-3.5 text-text-secondary\" />\n <p className=\"text-xs text-text-secondary\">Favorite Cart</p>\n </div>\n <p className=\"text-sm font-bold text-text-primary truncate\">{orderStats.favoriteCart}</p>\n </div>\n </div>\n\n {/* Filters */}\n <div className=\"rounded-lg border border-border-seam bg-bg-surface p-4 mb-6\">\n <div className=\"grid grid-cols-1 md:grid-cols-4 gap-3\">\n {/* Search */}\n <div className=\"relative\">\n <Search className=\"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-text-secondary\" />\n <input\n type=\"text\"\n placeholder=\"Search orders...\"\n value={filters.searchQuery}\n onChange={(e) => handleFilterChange('searchQuery', e.target.value)}\n className=\"w-full rounded-lg border border-border-seam bg-bg-surface pl-9 pr-3 py-2.5 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n </div>\n\n {/* Status Filter */}\n <select\n value={filters.status}\n onChange={(e) => handleFilterChange('status', e.target.value)}\n className=\"w-full rounded-lg border border-border-seam bg-bg-surface px-3 py-2.5 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n >\n {statusOptions.map((opt) => (\n <option key={opt.value} value={opt.value}>\n {opt.label}\n </option>\n ))}\n </select>\n\n {/* Date Range */}\n <select\n value={filters.dateRange}\n onChange={(e) => handleFilterChange('dateRange', e.target.value)}\n className=\"w-full rounded-lg border border-border-seam bg-bg-surface px-3 py-2.5 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n >\n {dateRangeOptions.map((opt) => (\n <option key={opt.value} value={opt.value}>\n {opt.label}\n </option>\n ))}\n </select>\n\n {/* Sort */}\n <select\n value={filters.sortBy}\n onChange={(e) => handleFilterChange('sortBy', e.target.value)}\n className=\"w-full rounded-lg border border-border-seam bg-bg-surface px-3 py-2.5 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n >\n {sortOptions.map((opt) => (\n <option key={opt.value} value={opt.value}>\n {opt.label}\n </option>\n ))}\n </select>\n </div>\n </div>\n\n {/* Orders List */}\n {isLoading ? (\n <div className=\"flex flex-col items-center justify-center py-12 text-center\">\n <div className=\"animate-spin rounded-full h-12 w-12 border-b-2 border-foreground mx-auto mb-4\" />\n <p className=\"text-sm text-text-secondary\">Loading orders...</p>\n </div>\n ) : displayedOrders.length === 0 ? (\n <EmptyState\n illustration=\"empty-search\"\n icon={<ShoppingBag className=\"h-12 w-12\" />}\n title=\"No orders found\"\n description={\n filters.searchQuery || filters.status\n ? 'Try adjusting your filters'\n : \"You haven't placed any orders yet\"\n }\n action={\n <button\n type=\"button\"\n onClick={() => navigateTo('/customer/carts')}\n className=\"rounded-lg bg-foreground px-4 py-2 text-sm font-medium text-background hover:opacity-90 transition-opacity\"\n >\n Start Ordering\n </button>\n }\n />\n ) : (\n <div className=\"space-y-4\">\n {displayedOrders.map((order) => (\n <div\n key={order.id}\n className=\"rounded-lg border border-border-seam bg-bg-surface hover:shadow-md transition-shadow\"\n >\n <div className=\"p-4 md:p-5\">\n {/* Order Header */}\n <div className=\"flex flex-col md:flex-row md:items-center justify-between mb-3\">\n <div className=\"mb-3 md:mb-0\">\n <div className=\"flex flex-col sm:flex-row sm:items-center gap-2\">\n <h3 className=\"text-base font-semibold text-text-primary\">\n {order.cartName}\n </h3>\n <StatusBadge status={order.status} />\n </div>\n <p className=\"text-xs text-text-secondary mt-1\">\n Order #{order.id} · {formatDate(order.orderDate)}\n </p>\n </div>\n <div className=\"flex flex-col sm:flex-row sm:items-center gap-2\">\n <p className=\"text-lg font-bold text-text-primary\">\n {formatCurrency(order.total, { minimumFractionDigits: 0 })}\n </p>\n <div className=\"flex gap-2\">\n <button\n type=\"button\"\n onClick={() => navigateTo(`/customer/orders/${order.id}`)}\n className=\"flex items-center gap-1.5 rounded-lg border border-border-seam px-3 py-1.5 text-xs font-medium text-text-primary hover:bg-accent transition-colors\"\n >\n <Eye className=\"h-3 w-3\" />\n Track Order\n </button>\n {order.status === 'delivered' && (\n <button\n type=\"button\"\n onClick={() => handleReorder(order)}\n className=\"flex items-center gap-1.5 rounded-lg bg-foreground px-3 py-1.5 text-xs font-medium text-background hover:opacity-90 transition-opacity\"\n >\n <RotateCcw className=\"h-3 w-3\" />\n Reorder\n </button>\n )}\n </div>\n </div>\n </div>\n\n {/* Order Items Summary */}\n <div className=\"border-t border-border-seam pt-3\">\n <div className=\"flex flex-wrap gap-1\">\n {order.items.slice(0, 3).map((item, index) => (\n <span key={index} className=\"text-xs text-text-secondary\">\n {item.name} ({item.quantity})\n {index < Math.min(2, order.items.length - 1) && ', '}\n </span>\n ))}\n {order.items.length > 3 && (\n <span className=\"text-xs text-text-secondary\">\n +{order.items.length - 3} more items\n </span>\n )}\n </div>\n </div>\n\n {/* Status Message */}\n <div className=\"mt-3\">\n {order.status === 'delivered' && (\n <div className=\"flex items-center gap-1.5 text-xs text-status-success-text\">\n <CheckCircle2 className=\"h-3 w-3\" />\n <span>Order delivered successfully</span>\n </div>\n )}\n {order.status === 'cancelled' && (\n <div className=\"flex items-center gap-1.5 text-xs text-status-error-text\">\n <XCircle className=\"h-3 w-3\" />\n <span>\n Cancelled{order.cancellationReason && ` - ${order.cancellationReason}`}\n </span>\n </div>\n )}\n {['pending', 'confirmed', 'preparing', 'ready', 'out_for_delivery'].includes(\n order.status\n ) && (\n <div className=\"flex items-center gap-1.5 text-xs text-status-info-text\">\n <Truck className=\"h-3 w-3\" />\n <span>\n Estimated delivery by{' '}\n {order.estimatedDeliveryTime\n ? formatDate(order.estimatedDeliveryTime)\n : 'TBD'}\n </span>\n </div>\n )}\n </div>\n\n {/* Rating Section */}\n {order.status === 'delivered' && (\n <div className=\"mt-3 flex flex-col sm:flex-row sm:items-center justify-between gap-2\">\n {order.rating ? (\n <div className=\"flex flex-col sm:flex-row sm:items-center gap-2\">\n <RatingDisplay value={order.rating} />\n {order.review && (\n <p className=\"text-xs text-text-secondary italic\">\n “{order.review}”\n </p>\n )}\n </div>\n ) : (\n <button\n type=\"button\"\n onClick={() => navigateTo(`/customer/orders/${order.id}/rate`)}\n className=\"flex items-center gap-1.5 rounded-lg border border-border-seam px-3 py-1.5 text-xs font-medium text-text-primary hover:bg-accent transition-colors\"\n >\n <Star className=\"h-3 w-3\" />\n Rate Order\n </button>\n )}\n </div>\n )}\n </div>\n </div>\n ))}\n </div>\n )}\n\n {/* Load More */}\n {hasMore && !isLoading && (\n <div className=\"text-center mt-8\">\n <button\n type=\"button\"\n onClick={handleLoadMore}\n className=\"inline-flex items-center gap-2 rounded-lg border border-border-seam px-6 py-2.5 text-sm font-medium text-text-primary hover:bg-accent transition-colors\"\n >\n <ChevronDown className=\"h-4 w-4\" />\n Load More Orders\n </button>\n </div>\n )}\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;AA4CA,IAAM,IAAY,IAEZ,IAAgB;CACpB;EAAE,OAAO;EAAI,OAAO;EAAc;CAClC;EAAE,OAAO;EAAW,OAAO;EAAW;CACtC;EAAE,OAAO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,GAAD,EAAa,WAAU,WAAY,CAAA,EAAA,mBAE5B;;IACL,CAAA;GAEG"}
|
|
1
|
+
{"version":3,"file":"OrderHistoryPage.js","names":[],"sources":["../../../../src/subscriberbot/pages/customer/OrderHistoryPage.tsx"],"sourcesContent":["/**\n * Order History Page\n * @module subscriberbot/pages/customer\n *\n * Full list of customer orders with stats summary, search, status/date/sort\n * filters, rating display, reorder, cancellation reason, and Load More pagination.\n */\n\nimport { useState, useMemo, useCallback, useEffect } from 'react';\nimport {\n ShoppingBag,\n Search,\n Star,\n RotateCcw,\n Eye,\n ChevronDown,\n Package,\n IndianRupee,\n TrendingUp,\n Clock,\n Heart,\n CheckCircle2,\n XCircle,\n Truck,\n Loader2,\n AlertCircle,\n} from 'lucide-react';\nimport { PagePurpose, EmphasisPanel } from '@burdenoff/fe-libs/ui';\nimport { PageLayout } from '../../components/PageLayout';\nimport { StatusBadge } from '../../components/StatusBadge';\nimport { EmptyState } from '../../components/EmptyState';\nimport { RatingDisplay } from '../../components/RatingDisplay';\nimport { useSubscriberBot } from '../../context/SubscriberBotContext';\nimport { useOrders } from '../../hooks/useSubscriberBotApi';\nimport { cn } from '../../utils/cn';\nimport { formatCurrency, formatDate } from '../../utils/formatters';\nimport type { OrderStatus, MockOrder } from '../../types';\n\ninterface OrderFilters {\n status: string;\n dateRange: string;\n searchQuery: string;\n sortBy: string;\n}\n\nconst PAGE_SIZE = 10;\n\nconst statusOptions = [\n { value: '', label: 'All Status' },\n { value: 'pending', label: 'Pending' },\n { value: 'confirmed', label: 'Confirmed' },\n { value: 'preparing', label: 'Preparing' },\n { value: 'ready', label: 'Ready' },\n { value: 'out_for_delivery', label: 'Out for Delivery' },\n { value: 'delivered', label: 'Delivered' },\n { value: 'cancelled', label: 'Cancelled' },\n];\n\nconst dateRangeOptions = [\n { value: '7days', label: 'Last 7 Days' },\n { value: '30days', label: 'Last 30 Days' },\n { value: '90days', label: 'Last 90 Days' },\n { value: 'all', label: 'All Time' },\n];\n\nconst sortOptions = [\n { value: 'recent', label: 'Most Recent' },\n { value: 'oldest', label: 'Oldest First' },\n { value: 'amount_high', label: 'Amount: High to Low' },\n { value: 'amount_low', label: 'Amount: Low to High' },\n];\n\nexport function OrderHistoryPage() {\n const { navigateTo, currentUser } = useSubscriberBot();\n const [displayCount, setDisplayCount] = useState(PAGE_SIZE);\n const [filters, setFilters] = useState<OrderFilters>({\n status: '',\n dateRange: '30days',\n searchQuery: '',\n sortBy: 'recent',\n });\n\n const { data: allOrders = [], isLoading, isError } = useOrders({ customerId: currentUser?.id });\n\n // Calculate stats from all orders\n const orderStats = useMemo(() => {\n const totalOrders = allOrders.length;\n const totalSpent = allOrders.reduce((sum, o) => sum + o.total, 0);\n const averageOrderValue = totalOrders > 0 ? Math.round(totalSpent / totalOrders) : 0;\n const recentOrdersCount = allOrders.filter(\n (o) => new Date(o.orderDate) > new Date(Date.now() - 7 * 24 * 60 * 60 * 1000)\n ).length;\n\n // Find favorite cart (most ordered from)\n const cartCounts: Record<string, number> = {};\n for (const o of allOrders) {\n cartCounts[o.cartName] = (cartCounts[o.cartName] || 0) + 1;\n }\n const favoriteCart =\n Object.entries(cartCounts).sort((a, b) => b[1] - a[1])[0]?.[0] || 'No orders yet';\n\n return { totalOrders, totalSpent, averageOrderValue, recentOrdersCount, favoriteCart };\n }, [allOrders]);\n\n // Filter and sort orders\n const filteredOrders = useMemo(() => {\n let orders = [...allOrders];\n\n // Filter by status\n if (filters.status) {\n orders = orders.filter((o) => o.status === filters.status);\n }\n\n // Filter by date range\n if (filters.dateRange !== 'all') {\n const now = new Date();\n const dateLimit = new Date();\n switch (filters.dateRange) {\n case '7days':\n dateLimit.setDate(now.getDate() - 7);\n break;\n case '30days':\n dateLimit.setDate(now.getDate() - 30);\n break;\n case '90days':\n dateLimit.setDate(now.getDate() - 90);\n break;\n }\n orders = orders.filter((o) => new Date(o.orderDate) >= dateLimit);\n }\n\n // Search filter\n if (filters.searchQuery) {\n const query = filters.searchQuery.toLowerCase();\n orders = orders.filter(\n (o) =>\n o.id.toLowerCase().includes(query) ||\n o.cartName.toLowerCase().includes(query) ||\n o.items.some((item) => item.name.toLowerCase().includes(query))\n );\n }\n\n // Sort\n switch (filters.sortBy) {\n case 'recent':\n orders.sort((a, b) => new Date(b.orderDate).getTime() - new Date(a.orderDate).getTime());\n break;\n case 'oldest':\n orders.sort((a, b) => new Date(a.orderDate).getTime() - new Date(b.orderDate).getTime());\n break;\n case 'amount_high':\n orders.sort((a, b) => b.total - a.total);\n break;\n case 'amount_low':\n orders.sort((a, b) => a.total - b.total);\n break;\n }\n\n return orders;\n }, [allOrders, filters]);\n\n const displayedOrders = useMemo(\n () => filteredOrders.slice(0, displayCount),\n [filteredOrders, displayCount]\n );\n\n const hasMore = displayCount < filteredOrders.length;\n\n const handleFilterChange = (key: keyof OrderFilters, value: string) => {\n setFilters((prev) => ({ ...prev, [key]: value }));\n setDisplayCount(PAGE_SIZE);\n };\n\n const handleReorder = (order: MockOrder) => {\n navigateTo(`/customer/cart/${order.cartId}`);\n alert('Add items to cart to reorder');\n };\n\n const handleLoadMore = () => {\n setDisplayCount((prev) => prev + PAGE_SIZE);\n };\n\n if (isLoading) {\n return (\n <PageLayout title=\"Order History\" description=\"Loading your orders...\">\n <div className=\"flex h-[60vh] items-center justify-center\">\n <Loader2 className=\"h-8 w-8 animate-spin text-primary\" />\n </div>\n </PageLayout>\n );\n }\n\n if (isError) {\n return (\n <PageLayout title=\"Order History\" description=\"Error loading orders\">\n <div className=\"flex h-[60vh] flex-col items-center justify-center gap-4\">\n <AlertCircle className=\"h-12 w-12 text-status-error-text\" />\n <h2 className=\"text-xl font-semibold\">Error loading your orders</h2>\n <button\n type=\"button\"\n onClick={() => window.location.reload()}\n className=\"rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text\"\n >\n Retry\n </button>\n </div>\n </PageLayout>\n );\n }\n\n return (\n <PageLayout\n title=\"Order History\"\n description=\"View all your past and current orders\"\n titleGradient\n >\n <PagePurpose icon={<Package className=\"h-4 w-4\" />} className=\"mb-6\">\n A record of everything you've ordered. Search and filter to find a past order,\n reorder a favourite in a couple of taps, track anything still in progress, or leave\n a review once it's delivered. The summary up top shows how much you've spent and\n which cart you return to most.\n </PagePurpose>\n\n {/* Stats Summary — the ONE emphasis zone */}\n <EmphasisPanel className=\"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-3 mb-6\">\n <div className=\"rounded-lg border border-border-seam bg-bg-surface p-3.5\">\n <div className=\"flex items-center gap-2 mb-1\">\n <Package className=\"h-3.5 w-3.5 text-text-secondary\" />\n <p className=\"text-xs text-text-secondary\">Total Orders</p>\n </div>\n <p className=\"text-xl font-bold text-text-primary\">{orderStats.totalOrders}</p>\n </div>\n <div className=\"rounded-lg border border-border-seam bg-bg-surface p-3.5\">\n <div className=\"flex items-center gap-2 mb-1\">\n <IndianRupee className=\"h-3.5 w-3.5 text-text-secondary\" />\n <p className=\"text-xs text-text-secondary\">Total Spent</p>\n </div>\n <p className=\"text-xl font-bold text-text-primary\">\n {formatCurrency(orderStats.totalSpent, { minimumFractionDigits: 0 })}\n </p>\n </div>\n <div className=\"rounded-lg border border-border-seam bg-bg-surface p-3.5\">\n <div className=\"flex items-center gap-2 mb-1\">\n <TrendingUp className=\"h-3.5 w-3.5 text-text-secondary\" />\n <p className=\"text-xs text-text-secondary\">Average Order</p>\n </div>\n <p className=\"text-xl font-bold text-text-primary\">\n {formatCurrency(orderStats.averageOrderValue, { minimumFractionDigits: 0 })}\n </p>\n </div>\n <div className=\"rounded-lg border border-border-seam bg-bg-surface p-3.5\">\n <div className=\"flex items-center gap-2 mb-1\">\n <Clock className=\"h-3.5 w-3.5 text-text-secondary\" />\n <p className=\"text-xs text-text-secondary\">Recent Orders</p>\n </div>\n <p className=\"text-xl font-bold text-text-primary\">{orderStats.recentOrdersCount}</p>\n </div>\n <div className=\"rounded-lg border border-border-seam bg-bg-surface p-3.5 col-span-2 md:col-span-1\">\n <div className=\"flex items-center gap-2 mb-1\">\n <Heart className=\"h-3.5 w-3.5 text-text-secondary\" />\n <p className=\"text-xs text-text-secondary\">Favorite Cart</p>\n </div>\n <p className=\"text-sm font-bold text-text-primary truncate\">{orderStats.favoriteCart}</p>\n </div>\n </EmphasisPanel>\n\n {/* Filters */}\n <div className=\"rounded-lg border border-border-seam bg-bg-surface p-4 mb-6\">\n <div className=\"grid grid-cols-1 md:grid-cols-4 gap-3\">\n {/* Search */}\n <div className=\"relative\">\n <Search className=\"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-text-secondary\" />\n <input\n type=\"text\"\n placeholder=\"Search orders...\"\n value={filters.searchQuery}\n onChange={(e) => handleFilterChange('searchQuery', e.target.value)}\n className=\"w-full rounded-lg border border-border-seam bg-bg-surface pl-9 pr-3 py-2.5 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n </div>\n\n {/* Status Filter */}\n <select\n value={filters.status}\n onChange={(e) => handleFilterChange('status', e.target.value)}\n className=\"w-full rounded-lg border border-border-seam bg-bg-surface px-3 py-2.5 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n >\n {statusOptions.map((opt) => (\n <option key={opt.value} value={opt.value}>\n {opt.label}\n </option>\n ))}\n </select>\n\n {/* Date Range */}\n <select\n value={filters.dateRange}\n onChange={(e) => handleFilterChange('dateRange', e.target.value)}\n className=\"w-full rounded-lg border border-border-seam bg-bg-surface px-3 py-2.5 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n >\n {dateRangeOptions.map((opt) => (\n <option key={opt.value} value={opt.value}>\n {opt.label}\n </option>\n ))}\n </select>\n\n {/* Sort */}\n <select\n value={filters.sortBy}\n onChange={(e) => handleFilterChange('sortBy', e.target.value)}\n className=\"w-full rounded-lg border border-border-seam bg-bg-surface px-3 py-2.5 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n >\n {sortOptions.map((opt) => (\n <option key={opt.value} value={opt.value}>\n {opt.label}\n </option>\n ))}\n </select>\n </div>\n </div>\n\n {/* Orders List */}\n {isLoading ? (\n <div className=\"flex flex-col items-center justify-center py-12 text-center\">\n <div className=\"animate-spin rounded-full h-12 w-12 border-b-2 border-foreground mx-auto mb-4\" />\n <p className=\"text-sm text-text-secondary\">Loading orders...</p>\n </div>\n ) : displayedOrders.length === 0 ? (\n <EmptyState\n illustration=\"empty-search\"\n icon={<ShoppingBag className=\"h-12 w-12\" />}\n title=\"No orders found\"\n description={\n filters.searchQuery || filters.status\n ? 'Try adjusting your filters'\n : \"You haven't placed any orders yet\"\n }\n action={\n <button\n type=\"button\"\n onClick={() => navigateTo('/customer/carts')}\n className=\"rounded-lg bg-foreground px-4 py-2 text-sm font-medium text-background hover:opacity-90 transition-opacity\"\n >\n Start Ordering\n </button>\n }\n />\n ) : (\n <div className=\"space-y-4\">\n {displayedOrders.map((order) => (\n <div\n key={order.id}\n className=\"rounded-lg border border-border-seam bg-bg-surface hover:shadow-md transition-shadow\"\n >\n <div className=\"p-4 md:p-5\">\n {/* Order Header */}\n <div className=\"flex flex-col md:flex-row md:items-center justify-between mb-3\">\n <div className=\"mb-3 md:mb-0\">\n <div className=\"flex flex-col sm:flex-row sm:items-center gap-2\">\n <h3 className=\"text-base font-semibold text-text-primary\">\n {order.cartName}\n </h3>\n <StatusBadge status={order.status} />\n </div>\n <p className=\"text-xs text-text-secondary mt-1\">\n Order #{order.id} · {formatDate(order.orderDate)}\n </p>\n </div>\n <div className=\"flex flex-col sm:flex-row sm:items-center gap-2\">\n <p className=\"text-lg font-bold text-text-primary\">\n {formatCurrency(order.total, { minimumFractionDigits: 0 })}\n </p>\n <div className=\"flex gap-2\">\n <button\n type=\"button\"\n onClick={() => navigateTo(`/customer/orders/${order.id}`)}\n className=\"flex items-center gap-1.5 rounded-lg border border-border-seam px-3 py-1.5 text-xs font-medium text-text-primary hover:bg-accent transition-colors\"\n >\n <Eye className=\"h-3 w-3\" />\n Track Order\n </button>\n {order.status === 'delivered' && (\n <button\n type=\"button\"\n onClick={() => handleReorder(order)}\n className=\"flex items-center gap-1.5 rounded-lg bg-foreground px-3 py-1.5 text-xs font-medium text-background hover:opacity-90 transition-opacity\"\n >\n <RotateCcw className=\"h-3 w-3\" />\n Reorder\n </button>\n )}\n </div>\n </div>\n </div>\n\n {/* Order Items Summary */}\n <div className=\"border-t border-border-seam pt-3\">\n <div className=\"flex flex-wrap gap-1\">\n {order.items.slice(0, 3).map((item, index) => (\n <span key={index} className=\"text-xs text-text-secondary\">\n {item.name} ({item.quantity})\n {index < Math.min(2, order.items.length - 1) && ', '}\n </span>\n ))}\n {order.items.length > 3 && (\n <span className=\"text-xs text-text-secondary\">\n +{order.items.length - 3} more items\n </span>\n )}\n </div>\n </div>\n\n {/* Status Message */}\n <div className=\"mt-3\">\n {order.status === 'delivered' && (\n <div className=\"flex items-center gap-1.5 text-xs text-status-success-text\">\n <CheckCircle2 className=\"h-3 w-3\" />\n <span>Order delivered successfully</span>\n </div>\n )}\n {order.status === 'cancelled' && (\n <div className=\"flex items-center gap-1.5 text-xs text-status-error-text\">\n <XCircle className=\"h-3 w-3\" />\n <span>\n Cancelled{order.cancellationReason && ` - ${order.cancellationReason}`}\n </span>\n </div>\n )}\n {['pending', 'confirmed', 'preparing', 'ready', 'out_for_delivery'].includes(\n order.status\n ) && (\n <div className=\"flex items-center gap-1.5 text-xs text-status-info-text\">\n <Truck className=\"h-3 w-3\" />\n <span>\n Estimated delivery by{' '}\n {order.estimatedDeliveryTime\n ? formatDate(order.estimatedDeliveryTime)\n : 'TBD'}\n </span>\n </div>\n )}\n </div>\n\n {/* Rating Section */}\n {order.status === 'delivered' && (\n <div className=\"mt-3 flex flex-col sm:flex-row sm:items-center justify-between gap-2\">\n {order.rating ? (\n <div className=\"flex flex-col sm:flex-row sm:items-center gap-2\">\n <RatingDisplay value={order.rating} />\n {order.review && (\n <p className=\"text-xs text-text-secondary italic\">\n “{order.review}”\n </p>\n )}\n </div>\n ) : (\n <button\n type=\"button\"\n onClick={() => navigateTo(`/customer/orders/${order.id}/rate`)}\n className=\"flex items-center gap-1.5 rounded-lg border border-border-seam px-3 py-1.5 text-xs font-medium text-text-primary hover:bg-accent transition-colors\"\n >\n <Star className=\"h-3 w-3\" />\n Rate Order\n </button>\n )}\n </div>\n )}\n </div>\n </div>\n ))}\n </div>\n )}\n\n {/* Load More */}\n {hasMore && !isLoading && (\n <div className=\"text-center mt-8\">\n <button\n type=\"button\"\n onClick={handleLoadMore}\n className=\"inline-flex items-center gap-2 rounded-lg border border-border-seam px-6 py-2.5 text-sm font-medium text-text-primary hover:bg-accent transition-colors\"\n >\n <ChevronDown className=\"h-4 w-4\" />\n Load More Orders\n </button>\n </div>\n )}\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;AA6CA,IAAM,IAAY,IAEZ,IAAgB;CACpB;EAAE,OAAO;EAAI,OAAO;EAAc;CAClC;EAAE,OAAO;EAAW,OAAO;EAAW;CACtC;EAAE,OAAO;EAAa,OAAO;EAAa;CAC1C;EAAE,OAAO;EAAa,OAAO;EAAa;CAC1C;EAAE,OAAO;EAAS,OAAO;EAAS;CAClC;EAAE,OAAO;EAAoB,OAAO;EAAoB;CACxD;EAAE,OAAO;EAAa,OAAO;EAAa;CAC1C;EAAE,OAAO;EAAa,OAAO;EAAa;CAC3C,EAEK,IAAmB;CACvB;EAAE,OAAO;EAAS,OAAO;EAAe;CACxC;EAAE,OAAO;EAAU,OAAO;EAAgB;CAC1C;EAAE,OAAO;EAAU,OAAO;EAAgB;CAC1C;EAAE,OAAO;EAAO,OAAO;EAAY;CACpC,EAEK,IAAc;CAClB;EAAE,OAAO;EAAU,OAAO;EAAe;CACzC;EAAE,OAAO;EAAU,OAAO;EAAgB;CAC1C;EAAE,OAAO;EAAe,OAAO;EAAuB;CACtD;EAAE,OAAO;EAAc,OAAO;EAAuB;CACtD;AAED,SAAgB,IAAm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