@burdenoff/microfe-coolandlovely 2026.624.1 → 2026.625.2
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/coolandlovely/components/EmptyState.js +17 -21
- package/dist/coolandlovely/components/EmptyState.js.map +1 -1
- package/dist/coolandlovely/components/InvestmentCard.js +25 -23
- package/dist/coolandlovely/components/InvestmentCard.js.map +1 -1
- package/dist/coolandlovely/components/MetricsCard.js +18 -12
- package/dist/coolandlovely/components/MetricsCard.js.map +1 -1
- package/dist/coolandlovely/components/PageLayout.js +38 -19
- package/dist/coolandlovely/components/PageLayout.js.map +1 -1
- package/dist/coolandlovely/components/RatingDisplay.js +3 -3
- package/dist/coolandlovely/components/RatingDisplay.js.map +1 -1
- package/dist/coolandlovely/components/StatusBadge.js +36 -16
- package/dist/coolandlovely/components/StatusBadge.js.map +1 -1
- package/dist/coolandlovely/pages/HomePage.js +219 -204
- package/dist/coolandlovely/pages/HomePage.js.map +1 -1
- package/dist/coolandlovely/pages/admin/AdminAnalyticsPage.js +98 -92
- package/dist/coolandlovely/pages/admin/AdminAnalyticsPage.js.map +1 -1
- package/dist/coolandlovely/pages/admin/AdminDashboard.js +111 -77
- package/dist/coolandlovely/pages/admin/AdminDashboard.js.map +1 -1
- package/dist/coolandlovely/pages/admin/AdminFinancialPage.js +49 -43
- package/dist/coolandlovely/pages/admin/AdminFinancialPage.js.map +1 -1
- package/dist/coolandlovely/pages/admin/AdminOrdersPage.js +234 -229
- package/dist/coolandlovely/pages/admin/AdminOrdersPage.js.map +1 -1
- package/dist/coolandlovely/pages/admin/AdminProfilePage.js +67 -62
- package/dist/coolandlovely/pages/admin/AdminProfilePage.js.map +1 -1
- package/dist/coolandlovely/pages/admin/AdminSettingsPage.js +235 -230
- package/dist/coolandlovely/pages/admin/AdminSettingsPage.js.map +1 -1
- package/dist/coolandlovely/pages/admin/CartManagementPage.js +291 -286
- package/dist/coolandlovely/pages/admin/CartManagementPage.js.map +1 -1
- package/dist/coolandlovely/pages/admin/UserManagementPage.js +287 -282
- package/dist/coolandlovely/pages/admin/UserManagementPage.js.map +1 -1
- package/dist/coolandlovely/pages/cart-owner/AnalyticsDashboard.js +108 -100
- package/dist/coolandlovely/pages/cart-owner/AnalyticsDashboard.js.map +1 -1
- package/dist/coolandlovely/pages/cart-owner/BusinessSettingsPage.js +260 -255
- package/dist/coolandlovely/pages/cart-owner/BusinessSettingsPage.js.map +1 -1
- package/dist/coolandlovely/pages/cart-owner/CartOwnerDashboard.js +596 -554
- package/dist/coolandlovely/pages/cart-owner/CartOwnerDashboard.js.map +1 -1
- package/dist/coolandlovely/pages/cart-owner/CartOwnerProfilePage.js +187 -182
- package/dist/coolandlovely/pages/cart-owner/CartOwnerProfilePage.js.map +1 -1
- package/dist/coolandlovely/pages/cart-owner/CartServiceConfigPage.js +229 -221
- package/dist/coolandlovely/pages/cart-owner/CartServiceConfigPage.js.map +1 -1
- package/dist/coolandlovely/pages/cart-owner/InventoryManagementPage.js +675 -674
- package/dist/coolandlovely/pages/cart-owner/InventoryManagementPage.js.map +1 -1
- package/dist/coolandlovely/pages/cart-owner/OrderManagementPage.js +525 -524
- package/dist/coolandlovely/pages/cart-owner/OrderManagementPage.js.map +1 -1
- package/dist/coolandlovely/pages/cart-owner/StaffManagementPage.js +264 -266
- package/dist/coolandlovely/pages/cart-owner/StaffManagementPage.js.map +1 -1
- package/dist/coolandlovely/pages/common/HelpSupportPage.js +137 -137
- package/dist/coolandlovely/pages/common/HelpSupportPage.js.map +1 -1
- package/dist/coolandlovely/pages/common/NotificationCenterPage.js +81 -75
- package/dist/coolandlovely/pages/common/NotificationCenterPage.js.map +1 -1
- package/dist/coolandlovely/pages/common/SettingsPage.js +745 -736
- package/dist/coolandlovely/pages/common/SettingsPage.js.map +1 -1
- package/dist/coolandlovely/pages/customer/BookingDetailsPage.js +394 -357
- package/dist/coolandlovely/pages/customer/BookingDetailsPage.js.map +1 -1
- package/dist/coolandlovely/pages/customer/CartDetailPage.js +189 -186
- package/dist/coolandlovely/pages/customer/CartDetailPage.js.map +1 -1
- package/dist/coolandlovely/pages/customer/CartDiscoveryPage.js +222 -211
- package/dist/coolandlovely/pages/customer/CartDiscoveryPage.js.map +1 -1
- package/dist/coolandlovely/pages/customer/CheckoutPage.js +219 -222
- package/dist/coolandlovely/pages/customer/CheckoutPage.js.map +1 -1
- package/dist/coolandlovely/pages/customer/CustomerDashboard.js +446 -404
- package/dist/coolandlovely/pages/customer/CustomerDashboard.js.map +1 -1
- package/dist/coolandlovely/pages/customer/CustomerProfilePage.js +525 -488
- package/dist/coolandlovely/pages/customer/CustomerProfilePage.js.map +1 -1
- package/dist/coolandlovely/pages/customer/DirectServiceBookingPage.js +522 -513
- package/dist/coolandlovely/pages/customer/DirectServiceBookingPage.js.map +1 -1
- package/dist/coolandlovely/pages/customer/FavoritesPage.js +94 -84
- package/dist/coolandlovely/pages/customer/FavoritesPage.js.map +1 -1
- package/dist/coolandlovely/pages/customer/OrderHistoryPage.js +121 -112
- package/dist/coolandlovely/pages/customer/OrderHistoryPage.js.map +1 -1
- package/dist/coolandlovely/pages/customer/OrderTrackingPage.js +312 -275
- package/dist/coolandlovely/pages/customer/OrderTrackingPage.js.map +1 -1
- package/dist/coolandlovely/pages/customer/PaymentMethodsPage.js +90 -84
- package/dist/coolandlovely/pages/customer/PaymentMethodsPage.js.map +1 -1
- package/dist/coolandlovely/pages/customer/ReviewsPage.js +99 -89
- package/dist/coolandlovely/pages/customer/ReviewsPage.js.map +1 -1
- package/dist/coolandlovely/pages/customer/SavedAddressesPage.js +74 -68
- package/dist/coolandlovely/pages/customer/SavedAddressesPage.js.map +1 -1
- package/dist/coolandlovely/pages/investor/InvestmentDetailsPage.js +317 -279
- package/dist/coolandlovely/pages/investor/InvestmentDetailsPage.js.map +1 -1
- package/dist/coolandlovely/pages/investor/InvestmentOpportunitiesPage.js +249 -243
- package/dist/coolandlovely/pages/investor/InvestmentOpportunitiesPage.js.map +1 -1
- package/dist/coolandlovely/pages/investor/InvestorAnalyticsPage.js +87 -81
- package/dist/coolandlovely/pages/investor/InvestorAnalyticsPage.js.map +1 -1
- package/dist/coolandlovely/pages/investor/InvestorDashboard.js +359 -323
- package/dist/coolandlovely/pages/investor/InvestorDashboard.js.map +1 -1
- package/dist/coolandlovely/pages/investor/InvestorInvestmentsPage.js +115 -109
- package/dist/coolandlovely/pages/investor/InvestorInvestmentsPage.js.map +1 -1
- package/dist/coolandlovely/pages/investor/InvestorPortfolioPage.js +179 -146
- package/dist/coolandlovely/pages/investor/InvestorPortfolioPage.js.map +1 -1
- package/dist/coolandlovely/pages/investor/InvestorProfilePage.js +397 -392
- package/dist/coolandlovely/pages/investor/InvestorProfilePage.js.map +1 -1
- package/dist/coolandlovely/pages/worker/TaskDetailsPage.js +364 -327
- package/dist/coolandlovely/pages/worker/TaskDetailsPage.js.map +1 -1
- package/dist/coolandlovely/pages/worker/WorkerDashboard.js +580 -543
- package/dist/coolandlovely/pages/worker/WorkerDashboard.js.map +1 -1
- package/dist/coolandlovely/pages/worker/WorkerOrdersPage.js +114 -109
- package/dist/coolandlovely/pages/worker/WorkerOrdersPage.js.map +1 -1
- package/dist/coolandlovely/pages/worker/WorkerProfilePage.js +115 -110
- package/dist/coolandlovely/pages/worker/WorkerProfilePage.js.map +1 -1
- package/dist/coolandlovely/pages/worker/WorkerSchedulePage.js +100 -95
- package/dist/coolandlovely/pages/worker/WorkerSchedulePage.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReviewsPage.js","names":[],"sources":["../../../../src/coolandlovely/pages/customer/ReviewsPage.tsx"],"sourcesContent":["/**\n * Reviews Page\n * @module coolandlovely/pages/customer\n *\n * Full-featured reviews: Write Review modal (interactive star rating with\n * text labels, title, comment, guidelines), Owner Response callout,\n * review images, verified badge, Mark as Helpful toggle, 4 filters\n * (search, type, rating, sort), Your Review label, 5 mock reviews.\n */\n\nimport { useState, useCallback } from 'react';\nimport {\n Star,\n MessageSquare,\n ThumbsUp,\n PenSquare,\n X,\n CheckCircle2,\n Image,\n MessageCircle,\n Info,\n Search,\n} from 'lucide-react';\nimport { PageLayout } from '../../components/PageLayout';\nimport { RatingDisplay } from '../../components/RatingDisplay';\nimport { EmptyState } from '../../components/EmptyState';\nimport { useCoolAndLovely } from '../../context/CoolAndLovelyContext';\nimport { cn } from '../../utils/cn';\nimport { formatDate } from '../../utils/formatters';\n\n// ============================================================================\n// Types\n// ============================================================================\n\ninterface Review {\n id: string;\n userId: string;\n userName: string;\n userAvatar: string;\n itemId: string;\n itemName: string;\n itemType: 'cart' | 'product';\n cartId: string;\n cartName: string;\n orderId: string;\n rating: number;\n title: string;\n comment: string;\n images?: string[];\n helpfulCount: number;\n isHelpful: boolean;\n isVerified: boolean;\n createdAt: string;\n response?: {\n message: string;\n respondedBy: string;\n respondedAt: string;\n };\n}\n\ninterface ReviewFormData {\n rating: number;\n title: string;\n comment: string;\n}\n\ninterface ReviewFilters {\n searchQuery: string;\n type: 'all' | 'cart' | 'product' | 'my-reviews';\n rating: string;\n sortBy: 'recent' | 'helpful' | 'rating-high' | 'rating-low';\n}\n\nconst CURRENT_USER_ID = 'user-001';\n\nconst ratingLabels: Record<number, string> = {\n 1: 'Terrible',\n 2: 'Poor',\n 3: 'Average',\n 4: 'Good',\n 5: 'Excellent',\n};\n\n// ============================================================================\n// Mock Data\n// ============================================================================\n\nconst mockReviews: Review[] = [\n {\n id: 'review-001',\n userId: CURRENT_USER_ID,\n userName: 'Rahul Sharma',\n userAvatar: 'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=100',\n itemId: 'FOOD-001',\n itemName: 'Dosa Express',\n itemType: 'cart',\n cartId: 'FOOD-001',\n cartName: 'Dosa Express',\n orderId: 'ORD-2024-001',\n rating: 5,\n title: 'Excellent breakfast spot!',\n comment:\n 'Amazing dosas and filter coffee. The masala dosa was perfectly crispy and the potato filling was delicious. Service was quick and friendly. Highly recommend for authentic South Indian breakfast!',\n helpfulCount: 12,\n isHelpful: true,\n isVerified: true,\n createdAt: '2024-06-20T09:30:00Z',\n response: {\n message:\n \"Thank you so much for your wonderful review! We're thrilled you enjoyed the dosas. We look forward to serving you again soon!\",\n respondedBy: 'Dosa Express Team',\n respondedAt: '2024-06-20T15:45:00Z',\n },\n },\n {\n id: 'review-002',\n userId: 'user-002',\n userName: 'Priya Patel',\n userAvatar: 'https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=100',\n itemId: 'prod-002',\n itemName: 'Pani Puri',\n itemType: 'product',\n cartId: 'FOOD-002',\n cartName: 'Chaat Corner',\n orderId: 'ORD-2024-002',\n rating: 4,\n title: 'Good but could be spicier',\n comment:\n 'The pani puri was good overall. The puris were crispy and fresh. However, the pani could have been more spicy and tangy. The portions were generous though.',\n helpfulCount: 8,\n isHelpful: false,\n isVerified: true,\n createdAt: '2024-06-18T19:15:00Z',\n },\n {\n id: 'review-003',\n userId: 'user-003',\n userName: 'Amit Kumar',\n userAvatar: 'https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?w=100',\n itemId: 'FOOD-002',\n itemName: 'Chaat Corner',\n itemType: 'cart',\n cartId: 'FOOD-002',\n cartName: 'Chaat Corner',\n orderId: 'ORD-2024-003',\n rating: 5,\n title: 'Authentic Mumbai street food!',\n comment:\n 'This place brings back memories of Mumbai streets. Every item I ordered was authentic and delicious. The bhel puri and vada pav were exceptional. Will definitely order again!',\n images: ['https://images.unsplash.com/photo-1601050690597-df0568f70950?w=400'],\n helpfulCount: 15,\n isHelpful: false,\n isVerified: true,\n createdAt: '2024-06-17T20:30:00Z',\n },\n {\n id: 'review-004',\n userId: CURRENT_USER_ID,\n userName: 'Rahul Sharma',\n userAvatar: 'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=100',\n itemId: 'prod-001',\n itemName: 'Masala Dosa',\n itemType: 'product',\n cartId: 'FOOD-001',\n cartName: 'Dosa Express',\n orderId: 'ORD-2024-004',\n rating: 5,\n title: 'Perfect masala dosa!',\n comment:\n 'The masala dosa here is absolutely perfect. Crispy, golden brown, and the potato masala inside is perfectly spiced. Comes with great chutneys and sambar.',\n helpfulCount: 6,\n isHelpful: false,\n isVerified: true,\n createdAt: '2024-06-15T08:45:00Z',\n response: {\n message: 'Glad you loved it, Rahul! Our chef takes great care with every dosa. See you soon!',\n respondedBy: 'Dosa Express Team',\n respondedAt: '2024-06-15T14:00:00Z',\n },\n },\n {\n id: 'review-005',\n userId: 'user-004',\n userName: 'Sneha Reddy',\n userAvatar: 'https://images.unsplash.com/photo-1438761681033-6461ffad8d80?w=100',\n itemId: 'FOOD-001',\n itemName: 'Dosa Express',\n itemType: 'cart',\n cartId: 'FOOD-001',\n cartName: 'Dosa Express',\n orderId: 'ORD-2024-005',\n rating: 3,\n title: 'Average experience',\n comment:\n 'The food was okay but delivery took longer than expected. The taste was good but not exceptional. The packaging could be better to keep food warm.',\n helpfulCount: 4,\n isHelpful: false,\n isVerified: true,\n createdAt: '2024-06-12T12:20:00Z',\n },\n];\n\n// ============================================================================\n// Star Rating Interactive Component\n// ============================================================================\n\nfunction InteractiveStarRating({\n value,\n onChange,\n}: {\n value: number;\n onChange: (v: number) => void;\n}) {\n const [hoverValue, setHoverValue] = useState(0);\n const displayValue = hoverValue || value;\n\n return (\n <div className=\"flex items-center gap-3\">\n <div className=\"flex items-center gap-0.5\">\n {[1, 2, 3, 4, 5].map((star) => (\n <button\n key={star}\n type=\"button\"\n onClick={() => onChange(star)}\n onMouseEnter={() => setHoverValue(star)}\n onMouseLeave={() => setHoverValue(0)}\n className=\"p-0.5 transition-transform\"\n >\n <Star\n className={cn(\n 'h-6 w-6',\n star <= displayValue\n ? 'fill-yellow-400 text-yellow-400'\n : 'fill-none text-text-secondary/40'\n )}\n />\n </button>\n ))}\n </div>\n <span className=\"text-sm font-medium text-text-secondary\">\n {ratingLabels[displayValue] ?? ''}\n </span>\n </div>\n );\n}\n\n// ============================================================================\n// Component\n// ============================================================================\n\nexport function ReviewsPage() {\n const { navigateTo } = useCoolAndLovely();\n const [reviews, setReviews] = useState<Review[]>(mockReviews);\n const [showWriteReview, setShowWriteReview] = useState(false);\n const [reviewForm, setReviewForm] = useState<ReviewFormData>({\n rating: 5,\n title: '',\n comment: '',\n });\n const [filters, setFilters] = useState<ReviewFilters>({\n searchQuery: '',\n type: 'all',\n rating: '',\n sortBy: 'recent',\n });\n const [statusMessage, setStatusMessage] = useState<string | null>(null);\n\n const showStatus = (msg: string) => {\n setStatusMessage(msg);\n setTimeout(() => setStatusMessage(null), 3000);\n };\n\n // --- Filtered reviews ---\n const filteredReviews = useCallback(() => {\n let result = [...reviews];\n\n // Type filter\n if (filters.type === 'my-reviews') {\n result = result.filter((r) => r.userId === CURRENT_USER_ID);\n } else if (filters.type !== 'all') {\n result = result.filter((r) => r.itemType === filters.type);\n }\n\n // Rating filter\n if (filters.rating) {\n const ratingVal = parseInt(filters.rating, 10);\n result = result.filter((r) => r.rating === ratingVal);\n }\n\n // Search\n if (filters.searchQuery) {\n const q = filters.searchQuery.toLowerCase();\n result = result.filter(\n (r) =>\n r.itemName.toLowerCase().includes(q) ||\n r.title.toLowerCase().includes(q) ||\n r.comment.toLowerCase().includes(q) ||\n r.cartName.toLowerCase().includes(q)\n );\n }\n\n // Sort\n switch (filters.sortBy) {\n case 'recent':\n result.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime());\n break;\n case 'helpful':\n result.sort((a, b) => b.helpfulCount - a.helpfulCount);\n break;\n case 'rating-high':\n result.sort((a, b) => b.rating - a.rating);\n break;\n case 'rating-low':\n result.sort((a, b) => a.rating - b.rating);\n break;\n }\n\n return result;\n }, [reviews, filters])();\n\n // --- Stats ---\n const myReviewCount = reviews.filter((r) => r.userId === CURRENT_USER_ID).length;\n const avgRating =\n reviews.length > 0\n ? (reviews.reduce((s, r) => s + r.rating, 0) / reviews.length).toFixed(1)\n : '0';\n\n // --- Handlers ---\n const handleSubmitReview = () => {\n if (!reviewForm.title.trim() || !reviewForm.comment.trim()) {\n alert('Please fill in the Review Title and Comment.');\n return;\n }\n\n const newReview: Review = {\n id: `review-${Date.now()}`,\n userId: CURRENT_USER_ID,\n userName: 'Rahul Sharma',\n userAvatar: 'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=100',\n itemId: 'FOOD-001',\n itemName: 'Dosa Express',\n itemType: 'cart',\n cartId: 'FOOD-001',\n cartName: 'Dosa Express',\n orderId: `ORD-2024-${Date.now()}`,\n rating: reviewForm.rating,\n title: reviewForm.title,\n comment: reviewForm.comment,\n helpfulCount: 0,\n isHelpful: false,\n isVerified: true,\n createdAt: new Date().toISOString(),\n };\n\n setReviews((prev) => [newReview, ...prev]);\n setReviewForm({ rating: 5, title: '', comment: '' });\n setShowWriteReview(false);\n showStatus('Review submitted successfully!');\n };\n\n const handleMarkHelpful = (reviewId: string) => {\n setReviews((prev) =>\n prev.map((r) =>\n r.id === reviewId\n ? {\n ...r,\n isHelpful: !r.isHelpful,\n helpfulCount: r.isHelpful ? r.helpfulCount - 1 : r.helpfulCount + 1,\n }\n : r\n )\n );\n };\n\n return (\n <PageLayout\n title=\"Reviews & Ratings\"\n description={`${filteredReviews.length} reviews found`}\n actions={\n <button\n type=\"button\"\n onClick={() => setShowWriteReview(true)}\n className={cn(\n 'flex items-center gap-2 rounded-lg px-4 py-2 text-sm font-medium transition-opacity',\n 'bg-foreground text-background hover:opacity-90'\n )}\n >\n <PenSquare className=\"h-4 w-4\" />\n Write Review\n </button>\n }\n >\n {/* Status message */}\n {statusMessage && (\n <div className=\"mb-4 rounded-lg border border-green-500/30 bg-green-500/10 p-3 flex items-center gap-2\">\n <CheckCircle2 className=\"h-4 w-4 text-green-600 dark:text-green-400 shrink-0\" />\n <p className=\"text-sm text-green-600 dark:text-green-400\">{statusMessage}</p>\n </div>\n )}\n\n {/* Stats */}\n <div className=\"flex flex-wrap items-center gap-4 text-sm text-text-secondary mb-6\">\n <span>{reviews.length} total reviews</span>\n <span>{myReviewCount} your reviews</span>\n <span className=\"flex items-center gap-1\">\n Average: {avgRating}\n <Star className=\"h-3.5 w-3.5 fill-yellow-400 text-yellow-400\" />\n </span>\n </div>\n\n {/* Filters */}\n <div className=\"rounded-lg border border-border-subtle 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 reviews...\"\n value={filters.searchQuery}\n onChange={(e) => setFilters((p) => ({ ...p, searchQuery: e.target.value }))}\n className=\"w-full rounded-lg border border-border-subtle 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 ReviewFilters['type'] }))\n }\n className=\"w-full rounded-lg border border-border-subtle 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 Reviews</option>\n <option value=\"cart\">Cart Reviews</option>\n <option value=\"product\">Product Reviews</option>\n <option value=\"my-reviews\">My Reviews</option>\n </select>\n\n {/* Rating */}\n <select\n value={filters.rating}\n onChange={(e) => setFilters((p) => ({ ...p, rating: e.target.value }))}\n className=\"w-full rounded-lg border border-border-subtle 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 Ratings</option>\n <option value=\"5\">5 Stars</option>\n <option value=\"4\">4 Stars</option>\n <option value=\"3\">3 Stars</option>\n <option value=\"2\">2 Stars</option>\n <option value=\"1\">1 Star</option>\n </select>\n\n {/* Sort */}\n <select\n value={filters.sortBy}\n onChange={(e) =>\n setFilters((p) => ({ ...p, sortBy: e.target.value as ReviewFilters['sortBy'] }))\n }\n className=\"w-full rounded-lg border border-border-subtle 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\">Most Recent</option>\n <option value=\"helpful\">Most Helpful</option>\n <option value=\"rating-high\">Highest Rating</option>\n <option value=\"rating-low\">Lowest Rating</option>\n </select>\n </div>\n </div>\n\n {/* Reviews List */}\n {filteredReviews.length === 0 ? (\n <EmptyState\n icon={<MessageSquare className=\"h-12 w-12\" />}\n title=\"No reviews found\"\n description=\"Be the first to write a review!\"\n action={\n <button\n type=\"button\"\n onClick={() => setShowWriteReview(true)}\n className=\"rounded-lg bg-foreground px-4 py-2 text-sm font-medium text-background hover:opacity-90 transition-opacity\"\n >\n Write a Review\n </button>\n }\n />\n ) : (\n <div className=\"space-y-4\">\n {filteredReviews.map((review) => {\n const isMyReview = review.userId === CURRENT_USER_ID;\n return (\n <div\n key={review.id}\n className={cn(\n 'rounded-lg border bg-bg-surface p-5',\n isMyReview ? 'border-foreground/20' : 'border-border-subtle'\n )}\n >\n {/* Header */}\n <div className=\"flex items-start gap-3 mb-3\">\n <img\n src={review.userAvatar}\n alt={review.userName}\n className=\"h-10 w-10 rounded-full object-cover shrink-0\"\n />\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center gap-2 flex-wrap\">\n <span className=\"text-sm font-semibold text-text-primary\">\n {review.userName}\n </span>\n {review.isVerified && (\n <span className=\"inline-flex items-center gap-1 rounded-full bg-green-500/10 px-2 py-0.5 text-[10px] font-medium text-green-600 dark:text-green-400\">\n <CheckCircle2 className=\"h-3 w-3\" />\n Verified\n </span>\n )}\n {isMyReview && (\n <span className=\"inline-flex items-center rounded-full bg-blue-500/10 px-2 py-0.5 text-[10px] font-medium text-blue-600 dark:text-blue-400\">\n Your Review\n </span>\n )}\n </div>\n <div className=\"flex flex-wrap items-center gap-2 text-xs text-text-secondary mt-0.5\">\n <span>\n {review.itemType === 'cart' ? (\n <MessageSquare className=\"inline h-3 w-3 mr-0.5\" />\n ) : (\n <Star className=\"inline h-3 w-3 mr-0.5\" />\n )}\n {review.itemName}\n </span>\n <span>\n {formatDate(review.createdAt, {\n hour: undefined,\n minute: undefined,\n hour12: undefined,\n })}\n </span>\n </div>\n </div>\n <div className=\"shrink-0\">\n <RatingDisplay value={review.rating} size=\"sm\" />\n <p className=\"text-xs text-text-secondary mt-0.5 text-right\">\n From: {review.cartName}\n </p>\n </div>\n </div>\n\n {/* Content */}\n <div className=\"mb-3\">\n <h4 className=\"text-sm font-semibold text-text-primary mb-1\">{review.title}</h4>\n <p className=\"text-sm text-text-primary leading-relaxed\">{review.comment}</p>\n </div>\n\n {/* Review Images */}\n {review.images && review.images.length > 0 && (\n <div className=\"mb-3 flex gap-2 overflow-x-auto pb-1\">\n {review.images.map((img, idx) => (\n <img\n key={idx}\n src={img}\n alt={`Review image ${idx + 1}`}\n className=\"h-20 w-20 rounded-lg object-cover shrink-0\"\n />\n ))}\n </div>\n )}\n\n {/* Owner Response */}\n {review.response && (\n <div className=\"mb-3 rounded-lg border border-blue-500/20 bg-blue-500/5 p-3\">\n <div className=\"flex flex-wrap items-center gap-2 mb-1.5\">\n <MessageCircle className=\"h-3.5 w-3.5 text-blue-600 dark:text-blue-400\" />\n <span className=\"text-xs font-medium text-blue-600 dark:text-blue-400\">\n Response from {review.response.respondedBy}\n </span>\n <span className=\"text-[10px] text-blue-500/70\">\n {formatDate(review.response.respondedAt, {\n hour: undefined,\n minute: undefined,\n hour12: undefined,\n })}\n </span>\n </div>\n <p className=\"text-xs text-blue-700 dark:text-blue-300 leading-relaxed\">\n {review.response.message}\n </p>\n </div>\n )}\n\n {/* Footer */}\n <div className=\"flex items-center justify-between pt-3 border-t border-border-subtle\">\n <button\n type=\"button\"\n onClick={() => handleMarkHelpful(review.id)}\n className={cn(\n 'flex items-center gap-1.5 text-xs transition-colors',\n review.isHelpful\n ? 'text-blue-600 dark:text-blue-400 font-medium'\n : 'text-text-secondary hover:text-text-primary'\n )}\n >\n <ThumbsUp className={cn('h-3.5 w-3.5', review.isHelpful && 'fill-current')} />\n Helpful ({review.helpfulCount})\n </button>\n\n <div className=\"flex items-center gap-3 text-xs text-text-secondary\">\n <span>Order: {review.orderId}</span>\n <button\n type=\"button\"\n onClick={() => navigateTo(`/customer/carts/${review.cartId}`)}\n className=\"font-medium hover:text-text-primary transition-colors\"\n >\n View Cart\n </button>\n </div>\n </div>\n </div>\n );\n })}\n </div>\n )}\n\n {/* Write Review Modal */}\n {showWriteReview && (\n <div className=\"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4\">\n <div className=\"w-full max-w-2xl max-h-[90vh] overflow-y-auto rounded-lg border border-border-subtle bg-bg-surface shadow-lg\">\n <div className=\"p-5\">\n {/* Header */}\n <div className=\"flex items-center justify-between mb-5\">\n <h3 className=\"text-lg font-semibold text-text-primary\">Write a Review</h3>\n <button\n type=\"button\"\n onClick={() => setShowWriteReview(false)}\n className=\"rounded-md p-2 text-text-secondary hover:bg-accent hover:text-text-primary transition-colors\"\n >\n <X className=\"h-4 w-4\" />\n </button>\n </div>\n\n <div className=\"space-y-4\">\n {/* Rating */}\n <div>\n <label className=\"block text-sm font-medium text-text-primary mb-2\">\n Rating <span className=\"text-red-500\">*</span>\n </label>\n <InteractiveStarRating\n value={reviewForm.rating}\n onChange={(v) => setReviewForm((p) => ({ ...p, rating: v }))}\n />\n </div>\n\n {/* Title */}\n <div>\n <label className=\"block text-sm font-medium text-text-primary mb-1.5\">\n Review Title <span className=\"text-red-500\">*</span>\n </label>\n <input\n type=\"text\"\n placeholder=\"Summarize your experience\"\n value={reviewForm.title}\n onChange={(e) => setReviewForm((p) => ({ ...p, title: e.target.value }))}\n className=\"w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 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 {/* Comment */}\n <div>\n <label className=\"block text-sm font-medium text-text-primary mb-1.5\">\n Your Review <span className=\"text-red-500\">*</span>\n </label>\n <textarea\n rows={5}\n placeholder=\"Share your experience with others...\"\n value={reviewForm.comment}\n onChange={(e) => setReviewForm((p) => ({ ...p, comment: e.target.value }))}\n className=\"w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] resize-none\"\n />\n </div>\n\n {/* Guidelines */}\n <div className=\"rounded-lg bg-bg-sunken p-4\">\n <div className=\"flex items-center gap-2 mb-2\">\n <Info className=\"h-4 w-4 text-text-secondary\" />\n <h4 className=\"text-sm font-medium text-text-primary\">Review Guidelines</h4>\n </div>\n <ul className=\"text-xs text-text-secondary space-y-1\">\n <li>- Be honest and helpful to other customers</li>\n <li>- Focus on your experience with the food and service</li>\n <li>- Avoid personal information or inappropriate content</li>\n <li>- Reviews are public and cannot be deleted once submitted</li>\n </ul>\n </div>\n </div>\n\n {/* Actions */}\n <div className=\"flex items-center gap-3 pt-5\">\n <button\n type=\"button\"\n onClick={handleSubmitReview}\n className=\"rounded-lg bg-foreground px-4 py-2 text-sm font-medium text-background hover:opacity-90 transition-opacity\"\n >\n Submit Review\n </button>\n <button\n type=\"button\"\n onClick={() => setShowWriteReview(false)}\n className=\"rounded-lg border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-accent transition-colors\"\n >\n Cancel\n </button>\n </div>\n </div>\n </div>\n </div>\n )}\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;AAyEA,IAAM,IAAkB,YAElB,IAAuC;CAC3C,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACJ,EAMK,IAAwB;CAC5B;EACE,IAAI;EACJ,QAAQ;EACR,UAAU;EACV,YAAY;EACZ,QAAQ;EACR,UAAU;EACV,UAAU;EACV,QAAQ;EACR,UAAU;EACV,SAAS;EACT,QAAQ;EACR,OA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C1E,WAAU;UACV,CAAA,CACE,EAAA,CAAA;SAGN,kBAAC,OAAD;UAAK,WAAU;oBAAf,CACE,kBAAC,OAAD;WAAK,WAAU;qBAAf,CACE,kBAAC,GAAD,EAAM,WAAU,+BAAgC,CAAA,EAChD,kBAAC,MAAD;YAAI,WAAU;sBAAwC;YAAsB,CAAA,CACxE;cACN,kBAAC,MAAD;WAAI,WAAU;qBAAd;YACE,kBAAC,MAAD,EAAA,UAAI,8CAA+C,CAAA;YACnD,kBAAC,MAAD,EAAA,UAAI,wDAAyD,CAAA;YAC7D,kBAAC,MAAD,EAAA,UAAI,yDAA0D,CAAA;YAC9D,kBAAC,MAAD,EAAA,UAAI,6DAA8D,CAAA;YAC/D;aACD;;SACF;;OAGN,kBAAC,OAAD;QAAK,WAAU;kBAAf,CACE,kBAAC,UAAD;SACE,MAAK;SACL,SAAS;SACT,WAAU;mBACX;SAEQ,CAAA,EACT,kBAAC,UAAD;SACE,MAAK;SACL,eAAe,EAAmB,GAAM;SACxC,WAAU;mBACX;SAEQ,CAAA,CACL;;OACF;;KACF,CAAA;IACF,CAAA;GAEG"}
|
|
1
|
+
{"version":3,"file":"ReviewsPage.js","names":[],"sources":["../../../../src/coolandlovely/pages/customer/ReviewsPage.tsx"],"sourcesContent":["/**\n * Reviews Page\n * @module coolandlovely/pages/customer\n *\n * Full-featured reviews: Write Review modal (interactive star rating with\n * text labels, title, comment, guidelines), Owner Response callout,\n * review images, verified badge, Mark as Helpful toggle, 4 filters\n * (search, type, rating, sort), Your Review label, 5 mock reviews.\n */\n\nimport { useState, useCallback } from'react';\nimport {\n Star,\n MessageSquare,\n ThumbsUp,\n PenSquare,\n X,\n CheckCircle2,\n Image,\n MessageCircle,\n Info,\n Search,\n} from'lucide-react';\nimport { EmphasisPanel, PagePurpose } from'@burdenoff/fe-libs/ui';\nimport { PageLayout } from'../../components/PageLayout';\nimport { RatingDisplay } from'../../components/RatingDisplay';\nimport { EmptyState } from'../../components/EmptyState';\nimport { useCoolAndLovely } from'../../context/CoolAndLovelyContext';\nimport { cn } from'../../utils/cn';\nimport { formatDate } from'../../utils/formatters';\n\n// ============================================================================\n// Types\n// ============================================================================\n\ninterface Review {\n id: string;\n userId: string;\n userName: string;\n userAvatar: string;\n itemId: string;\n itemName: string;\n itemType: 'cart' | 'product';\n cartId: string;\n cartName: string;\n orderId: string;\n rating: number;\n title: string;\n comment: string;\n images?: string[];\n helpfulCount: number;\n isHelpful: boolean;\n isVerified: boolean;\n createdAt: string;\n response?: {\n message: string;\n respondedBy: string;\n respondedAt: string;\n };\n}\n\ninterface ReviewFormData {\n rating: number;\n title: string;\n comment: string;\n}\n\ninterface ReviewFilters {\n searchQuery: string;\n type: 'all' | 'cart' | 'product' | 'my-reviews';\n rating: string;\n sortBy: 'recent' | 'helpful' | 'rating-high' | 'rating-low';\n}\n\nconst CURRENT_USER_ID = 'user-001';\n\nconst ratingLabels: Record<number, string> = {\n 1: 'Terrible',\n 2: 'Poor',\n 3: 'Average',\n 4: 'Good',\n 5: 'Excellent',\n};\n\n// ============================================================================\n// Mock Data\n// ============================================================================\n\nconst mockReviews: Review[] = [\n {\n id: 'review-001',\n userId: CURRENT_USER_ID,\n userName: 'Rahul Sharma',\n userAvatar: 'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=100',\n itemId: 'FOOD-001',\n itemName: 'Dosa Express',\n itemType: 'cart',\n cartId: 'FOOD-001',\n cartName: 'Dosa Express',\n orderId: 'ORD-2024-001',\n rating: 5,\n title: 'Excellent breakfast spot!',\n comment:\n 'Amazing dosas and filter coffee. The masala dosa was perfectly crispy and the potato filling was delicious. Service was quick and friendly. Highly recommend for authentic South Indian breakfast!',\n helpfulCount: 12,\n isHelpful: true,\n isVerified: true,\n createdAt: '2024-06-20T09:30:00Z',\n response: {\n message:\n \"Thank you so much for your wonderful review! We're thrilled you enjoyed the dosas. We look forward to serving you again soon!\",\n respondedBy: 'Dosa Express Team',\n respondedAt: '2024-06-20T15:45:00Z',\n },\n },\n {\n id: 'review-002',\n userId: 'user-002',\n userName: 'Priya Patel',\n userAvatar: 'https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=100',\n itemId: 'prod-002',\n itemName: 'Pani Puri',\n itemType: 'product',\n cartId: 'FOOD-002',\n cartName: 'Chaat Corner',\n orderId: 'ORD-2024-002',\n rating: 4,\n title: 'Good but could be spicier',\n comment:\n 'The pani puri was good overall. The puris were crispy and fresh. However, the pani could have been more spicy and tangy. The portions were generous though.',\n helpfulCount: 8,\n isHelpful: false,\n isVerified: true,\n createdAt: '2024-06-18T19:15:00Z',\n },\n {\n id: 'review-003',\n userId: 'user-003',\n userName: 'Amit Kumar',\n userAvatar: 'https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?w=100',\n itemId: 'FOOD-002',\n itemName: 'Chaat Corner',\n itemType: 'cart',\n cartId: 'FOOD-002',\n cartName: 'Chaat Corner',\n orderId: 'ORD-2024-003',\n rating: 5,\n title: 'Authentic Mumbai street food!',\n comment:\n 'This place brings back memories of Mumbai streets. Every item I ordered was authentic and delicious. The bhel puri and vada pav were exceptional. Will definitely order again!',\n images: ['https://images.unsplash.com/photo-1601050690597-df0568f70950?w=400'],\n helpfulCount: 15,\n isHelpful: false,\n isVerified: true,\n createdAt: '2024-06-17T20:30:00Z',\n },\n {\n id: 'review-004',\n userId: CURRENT_USER_ID,\n userName: 'Rahul Sharma',\n userAvatar: 'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=100',\n itemId: 'prod-001',\n itemName: 'Masala Dosa',\n itemType: 'product',\n cartId: 'FOOD-001',\n cartName: 'Dosa Express',\n orderId: 'ORD-2024-004',\n rating: 5,\n title: 'Perfect masala dosa!',\n comment:\n 'The masala dosa here is absolutely perfect. Crispy, golden brown, and the potato masala inside is perfectly spiced. Comes with great chutneys and sambar.',\n helpfulCount: 6,\n isHelpful: false,\n isVerified: true,\n createdAt: '2024-06-15T08:45:00Z',\n response: {\n message: 'Glad you loved it, Rahul! Our chef takes great care with every dosa. See you soon!',\n respondedBy: 'Dosa Express Team',\n respondedAt: '2024-06-15T14:00:00Z',\n },\n },\n {\n id: 'review-005',\n userId: 'user-004',\n userName: 'Sneha Reddy',\n userAvatar: 'https://images.unsplash.com/photo-1438761681033-6461ffad8d80?w=100',\n itemId: 'FOOD-001',\n itemName: 'Dosa Express',\n itemType: 'cart',\n cartId: 'FOOD-001',\n cartName: 'Dosa Express',\n orderId: 'ORD-2024-005',\n rating: 3,\n title: 'Average experience',\n comment:\n 'The food was okay but delivery took longer than expected. The taste was good but not exceptional. The packaging could be better to keep food warm.',\n helpfulCount: 4,\n isHelpful: false,\n isVerified: true,\n createdAt: '2024-06-12T12:20:00Z',\n },\n];\n\n// ============================================================================\n// Star Rating Interactive Component\n// ============================================================================\n\nfunction InteractiveStarRating({\n value,\n onChange,\n}: {\n value: number;\n onChange: (v: number) => void;\n}) {\n const [hoverValue, setHoverValue] = useState(0);\n const displayValue = hoverValue || value;\n\n return (\n <div className=\"flex items-center gap-3\">\n <div className=\"flex items-center gap-0.5\">\n {[1, 2, 3, 4, 5].map((star) => (\n <button\n key={star}\n type=\"button\"\n onClick={() => onChange(star)}\n onMouseEnter={() => setHoverValue(star)}\n onMouseLeave={() => setHoverValue(0)}\n className=\"p-0.5 transition-transform\"\n >\n <Star\n className={cn(\n 'h-6 w-6',\n star <= displayValue\n ? 'fill-status-warning-text text-status-warning-text'\n : 'fill-none text-text-secondary/40'\n )}\n />\n </button>\n ))}\n </div>\n <span className=\"text-sm font-medium text-text-secondary\">\n {ratingLabels[displayValue] ?? ''}\n </span>\n </div>\n );\n}\n\n// ============================================================================\n// Component\n// ============================================================================\n\nexport function ReviewsPage() {\n const { navigateTo } = useCoolAndLovely();\n const [reviews, setReviews] = useState<Review[]>(mockReviews);\n const [showWriteReview, setShowWriteReview] = useState(false);\n const [reviewForm, setReviewForm] = useState<ReviewFormData>({\n rating: 5,\n title: '',\n comment: '',\n });\n const [filters, setFilters] = useState<ReviewFilters>({\n searchQuery: '',\n type: 'all',\n rating: '',\n sortBy: 'recent',\n });\n const [statusMessage, setStatusMessage] = useState<string | null>(null);\n\n const showStatus = (msg: string) => {\n setStatusMessage(msg);\n setTimeout(() => setStatusMessage(null), 3000);\n };\n\n // --- Filtered reviews ---\n const filteredReviews = useCallback(() => {\n let result = [...reviews];\n\n // Type filter\n if (filters.type === 'my-reviews') {\n result = result.filter((r) => r.userId === CURRENT_USER_ID);\n } else if (filters.type !== 'all') {\n result = result.filter((r) => r.itemType === filters.type);\n }\n\n // Rating filter\n if (filters.rating) {\n const ratingVal = parseInt(filters.rating, 10);\n result = result.filter((r) => r.rating === ratingVal);\n }\n\n // Search\n if (filters.searchQuery) {\n const q = filters.searchQuery.toLowerCase();\n result = result.filter(\n (r) =>\n r.itemName.toLowerCase().includes(q) ||\n r.title.toLowerCase().includes(q) ||\n r.comment.toLowerCase().includes(q) ||\n r.cartName.toLowerCase().includes(q)\n );\n }\n\n // Sort\n switch (filters.sortBy) {\n case'recent':\n result.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime());\n break;\n case'helpful':\n result.sort((a, b) => b.helpfulCount - a.helpfulCount);\n break;\n case'rating-high':\n result.sort((a, b) => b.rating - a.rating);\n break;\n case'rating-low':\n result.sort((a, b) => a.rating - b.rating);\n break;\n }\n\n return result;\n }, [reviews, filters])();\n\n // --- Stats ---\n const myReviewCount = reviews.filter((r) => r.userId === CURRENT_USER_ID).length;\n const avgRating =\n reviews.length > 0\n ? (reviews.reduce((s, r) => s + r.rating, 0) / reviews.length).toFixed(1)\n : '0';\n\n // --- Handlers ---\n const handleSubmitReview = () => {\n if (!reviewForm.title.trim() || !reviewForm.comment.trim()) {\n alert('Please fill in the Review Title and Comment.');\n return;\n }\n\n const newReview: Review = {\n id: `review-${Date.now()}`,\n userId: CURRENT_USER_ID,\n userName: 'Rahul Sharma',\n userAvatar: 'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=100',\n itemId: 'FOOD-001',\n itemName: 'Dosa Express',\n itemType: 'cart',\n cartId: 'FOOD-001',\n cartName: 'Dosa Express',\n orderId: `ORD-2024-${Date.now()}`,\n rating: reviewForm.rating,\n title: reviewForm.title,\n comment: reviewForm.comment,\n helpfulCount: 0,\n isHelpful: false,\n isVerified: true,\n createdAt: new Date().toISOString(),\n };\n\n setReviews((prev) => [newReview, ...prev]);\n setReviewForm({ rating: 5, title: '', comment: '' });\n setShowWriteReview(false);\n showStatus('Review submitted successfully!');\n };\n\n const handleMarkHelpful = (reviewId: string) => {\n setReviews((prev) =>\n prev.map((r) =>\n r.id === reviewId\n ? {\n ...r,\n isHelpful: !r.isHelpful,\n helpfulCount: r.isHelpful ? r.helpfulCount - 1 : r.helpfulCount + 1,\n }\n : r\n )\n );\n };\n\n return (\n <PageLayout\n title=\"Reviews & Ratings\"\n description={`${filteredReviews.length} reviews found`}\n actions={\n <button\n type=\"button\"\n onClick={() => setShowWriteReview(true)}\n className={cn(\n 'flex items-center gap-2 rounded-lg px-4 py-2 text-sm font-medium transition-opacity',\n 'bg-foreground text-background hover:opacity-90'\n )}\n >\n <PenSquare className=\"h-4 w-4\" />\n Write Review\n </button>\n }\n >\n {/* Status message */}\n {statusMessage && (\n <div className=\"mb-4 rounded-lg border border-status-success-border/30 bg-status-success-bg-subtle/10 p-3 flex items-center gap-2\">\n <CheckCircle2 className=\"h-4 w-4 text-status-success-text shrink-0\" />\n <p className=\"text-sm text-status-success-text\">{statusMessage}</p>\n </div>\n )}\n\n <PagePurpose className=\"mb-6\" icon={<MessageSquare className=\"h-4 w-4\" />}>\n Read what other customers think and share your own experience. Filter by\n rating or type to find the most helpful feedback, mark reviews that helped\n you, and write your own — your honest review helps carts improve and other\n shoppers choose well.\n </PagePurpose>\n\n {/* Stats — primary emphasis zone */}\n <EmphasisPanel className=\"mb-6 p-5\">\n <div className=\"flex flex-wrap items-center justify-between gap-4\">\n <div className=\"flex flex-wrap items-center gap-5 text-sm text-text-secondary\">\n <span>{reviews.length} total reviews</span>\n <span>{myReviewCount} your reviews</span>\n </div>\n <div className=\"flex items-center gap-2\">\n <span className=\"text-xs text-text-secondary\">Average rating</span>\n <span className=\"flex items-center gap-1 text-2xl font-bold text-text-primary\">\n {avgRating}\n <Star className=\"h-5 w-5 fill-status-warning-text text-status-warning-text\" />\n </span>\n </div>\n </div>\n </EmphasisPanel>\n\n {/* Filters */}\n <div className=\"rounded-lg border border-border-seam bg-bg-surface p-4 mb-6 bg-gloss-card shadow-pop\">\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 reviews...\"\n value={filters.searchQuery}\n onChange={(e) => setFilters((p) => ({ ...p, searchQuery: e.target.value }))}\n className=\"w-full rounded-lg border border-border-subtle 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 ReviewFilters['type'] }))\n }\n className=\"w-full rounded-lg border border-border-subtle 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 Reviews</option>\n <option value=\"cart\">Cart Reviews</option>\n <option value=\"product\">Product Reviews</option>\n <option value=\"my-reviews\">My Reviews</option>\n </select>\n\n {/* Rating */}\n <select\n value={filters.rating}\n onChange={(e) => setFilters((p) => ({ ...p, rating: e.target.value }))}\n className=\"w-full rounded-lg border border-border-subtle 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 Ratings</option>\n <option value=\"5\">5 Stars</option>\n <option value=\"4\">4 Stars</option>\n <option value=\"3\">3 Stars</option>\n <option value=\"2\">2 Stars</option>\n <option value=\"1\">1 Star</option>\n </select>\n\n {/* Sort */}\n <select\n value={filters.sortBy}\n onChange={(e) =>\n setFilters((p) => ({ ...p, sortBy: e.target.value as ReviewFilters['sortBy'] }))\n }\n className=\"w-full rounded-lg border border-border-subtle 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\">Most Recent</option>\n <option value=\"helpful\">Most Helpful</option>\n <option value=\"rating-high\">Highest Rating</option>\n <option value=\"rating-low\">Lowest Rating</option>\n </select>\n </div>\n </div>\n\n {/* Reviews List */}\n {filteredReviews.length === 0 ? (\n <EmptyState\n illustration={\n filters.searchQuery || filters.rating || filters.type !== 'all'\n ? 'empty-search'\n : 'empty-generic'\n }\n title=\"No reviews found\"\n description=\"Be the first to write a review!\"\n action={\n <button\n type=\"button\"\n onClick={() => setShowWriteReview(true)}\n className=\"rounded-lg bg-foreground px-4 py-2 text-sm font-medium text-background hover:opacity-90 transition-opacity\"\n >\n Write a Review\n </button>\n }\n />\n ) : (\n <div className=\"space-y-4\">\n {filteredReviews.map((review) => {\n const isMyReview = review.userId === CURRENT_USER_ID;\n return (\n <div\n key={review.id}\n className={cn(\n 'rounded-lg border bg-bg-surface p-5',\n isMyReview ? 'border-foreground/20' : 'border-border-subtle'\n )}\n >\n {/* Header */}\n <div className=\"flex items-start gap-3 mb-3\">\n <img\n src={review.userAvatar}\n alt={review.userName}\n className=\"h-10 w-10 rounded-full object-cover shrink-0\"\n />\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center gap-2 flex-wrap\">\n <span className=\"text-sm font-semibold text-text-primary\">\n {review.userName}\n </span>\n {review.isVerified && (\n <span className=\"inline-flex items-center gap-1 rounded-full bg-status-success-bg-subtle/10 px-2 py-0.5 text-[10px] font-medium text-status-success-text\">\n <CheckCircle2 className=\"h-3 w-3\" />\n Verified\n </span>\n )}\n {isMyReview && (\n <span className=\"inline-flex items-center rounded-full bg-accent-blue-subtle/10 px-2 py-0.5 text-[10px] font-medium text-accent-blue\">\n Your Review\n </span>\n )}\n </div>\n <div className=\"flex flex-wrap items-center gap-2 text-xs text-text-secondary mt-0.5\">\n <span>\n {review.itemType === 'cart' ? (\n <MessageSquare className=\"inline h-3 w-3 mr-0.5\" />\n ) : (\n <Star className=\"inline h-3 w-3 mr-0.5\" />\n )}\n {review.itemName}\n </span>\n <span>\n {formatDate(review.createdAt, {\n hour: undefined,\n minute: undefined,\n hour12: undefined,\n })}\n </span>\n </div>\n </div>\n <div className=\"shrink-0\">\n <RatingDisplay value={review.rating} size=\"sm\" />\n <p className=\"text-xs text-text-secondary mt-0.5 text-right\">\n From: {review.cartName}\n </p>\n </div>\n </div>\n\n {/* Content */}\n <div className=\"mb-3\">\n <h4 className=\"text-sm font-semibold text-text-primary mb-1\">{review.title}</h4>\n <p className=\"text-sm text-text-primary leading-relaxed\">{review.comment}</p>\n </div>\n\n {/* Review Images */}\n {review.images && review.images.length > 0 && (\n <div className=\"mb-3 flex gap-2 overflow-x-auto pb-1\">\n {review.images.map((img, idx) => (\n <img\n key={idx}\n src={img}\n alt={`Review image ${idx + 1}`}\n className=\"h-20 w-20 rounded-lg object-cover shrink-0\"\n />\n ))}\n </div>\n )}\n\n {/* Owner Response */}\n {review.response && (\n <div className=\"mb-3 rounded-lg border border-accent-blue-subtle/20 bg-accent-blue-subtle/5 p-3\">\n <div className=\"flex flex-wrap items-center gap-2 mb-1.5\">\n <MessageCircle className=\"h-3.5 w-3.5 text-accent-blue\" />\n <span className=\"text-xs font-medium text-accent-blue\">\n Response from {review.response.respondedBy}\n </span>\n <span className=\"text-[10px] text-accent-blue\">\n {formatDate(review.response.respondedAt, {\n hour: undefined,\n minute: undefined,\n hour12: undefined,\n })}\n </span>\n </div>\n <p className=\"text-xs text-accent-blue leading-relaxed\">\n {review.response.message}\n </p>\n </div>\n )}\n\n {/* Footer */}\n <div className=\"flex items-center justify-between pt-3 border-t border-border-subtle\">\n <button\n type=\"button\"\n onClick={() => handleMarkHelpful(review.id)}\n className={cn(\n 'flex items-center gap-1.5 text-xs transition-colors',\n review.isHelpful\n ? 'text-accent-blue font-medium'\n : 'text-text-secondary hover:text-text-primary'\n )}\n >\n <ThumbsUp className={cn('h-3.5 w-3.5', review.isHelpful && 'fill-current')} />\n Helpful ({review.helpfulCount})\n </button>\n\n <div className=\"flex items-center gap-3 text-xs text-text-secondary\">\n <span>Order: {review.orderId}</span>\n <button\n type=\"button\"\n onClick={() => navigateTo(`/customer/carts/${review.cartId}`)}\n className=\"font-medium hover:text-text-primary transition-colors\"\n >\n View Cart\n </button>\n </div>\n </div>\n </div>\n );\n })}\n </div>\n )}\n\n {/* Write Review Modal */}\n {showWriteReview && (\n <div className=\"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4\">\n <div className=\"w-full max-w-2xl max-h-[90vh] overflow-y-auto rounded-lg border border-border-subtle bg-bg-surface shadow-lg\">\n <div className=\"p-5\">\n {/* Header */}\n <div className=\"flex items-center justify-between mb-5\">\n <h3 className=\"text-lg font-semibold text-text-primary\">Write a Review</h3>\n <button\n type=\"button\"\n onClick={() => setShowWriteReview(false)}\n className=\"rounded-md p-2 text-text-secondary hover:bg-accent hover:text-text-primary transition-colors\"\n >\n <X className=\"h-4 w-4\" />\n </button>\n </div>\n\n <div className=\"space-y-4\">\n {/* Rating */}\n <div>\n <label className=\"block text-sm font-medium text-text-primary mb-2\">\n Rating <span className=\"text-status-error-text\">*</span>\n </label>\n <InteractiveStarRating\n value={reviewForm.rating}\n onChange={(v) => setReviewForm((p) => ({ ...p, rating: v }))}\n />\n </div>\n\n {/* Title */}\n <div>\n <label className=\"block text-sm font-medium text-text-primary mb-1.5\">\n Review Title <span className=\"text-status-error-text\">*</span>\n </label>\n <input\n type=\"text\"\n placeholder=\"Summarize your experience\"\n value={reviewForm.title}\n onChange={(e) => setReviewForm((p) => ({ ...p, title: e.target.value }))}\n className=\"w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 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 {/* Comment */}\n <div>\n <label className=\"block text-sm font-medium text-text-primary mb-1.5\">\n Your Review <span className=\"text-status-error-text\">*</span>\n </label>\n <textarea\n rows={5}\n placeholder=\"Share your experience with others...\"\n value={reviewForm.comment}\n onChange={(e) => setReviewForm((p) => ({ ...p, comment: e.target.value }))}\n className=\"w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] resize-none\"\n />\n </div>\n\n {/* Guidelines */}\n <div className=\"rounded-lg bg-bg-sunken p-4\">\n <div className=\"flex items-center gap-2 mb-2\">\n <Info className=\"h-4 w-4 text-text-secondary\" />\n <h4 className=\"text-sm font-medium text-text-primary\">Review Guidelines</h4>\n </div>\n <ul className=\"text-xs text-text-secondary space-y-1\">\n <li>- Be honest and helpful to other customers</li>\n <li>- Focus on your experience with the food and service</li>\n <li>- Avoid personal information or inappropriate content</li>\n <li>- Reviews are public and cannot be deleted once submitted</li>\n </ul>\n </div>\n </div>\n\n {/* Actions */}\n <div className=\"flex items-center gap-3 pt-5\">\n <button\n type=\"button\"\n onClick={handleSubmitReview}\n className=\"rounded-lg bg-foreground px-4 py-2 text-sm font-medium text-background hover:opacity-90 transition-opacity\"\n >\n Submit Review\n </button>\n <button\n type=\"button\"\n onClick={() => setShowWriteReview(false)}\n className=\"rounded-lg border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-accent transition-colors\"\n >\n Cancel\n </button>\n </div>\n </div>\n </div>\n </div>\n )}\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;AA0EA,IAAM,IAAkB,YAElB,IAAuC;CAC3C,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACJ,EAMK,IAAwB;CAC5B;EAC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AAY;UACZ,OAAO,EAAW;UAClB,WAAW,MAAM,GAAe,OAAO;WAAE,GAAG;WAAG,OAAO,EAAE,OAAO;WAAO,EAAE;UACxE,WAAU;UACV,CAAA,CACE,EAAA,CAAA;SAGN,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,SAAD;UAAO,WAAU;oBAAjB,CAAsE,gBACxD,kBAAC,QAAD;WAAM,WAAU;qBAAyB;WAAQ,CAAA,CACvD;aACR,kBAAC,YAAD;UACE,MAAM;UACN,aAAY;UACZ,OAAO,EAAW;UAClB,WAAW,MAAM,GAAe,OAAO;WAAE,GAAG;WAAG,SAAS,EAAE,OAAO;WAAO,EAAE;UAC1E,WAAU;UACV,CAAA,CACE,EAAA,CAAA;SAGN,kBAAC,OAAD;UAAK,WAAU;oBAAf,CACE,kBAAC,OAAD;WAAK,WAAU;qBAAf,CACE,kBAAC,GAAD,EAAM,WAAU,+BAAgC,CAAA,EAChD,kBAAC,MAAD;YAAI,WAAU;sBAAwC;YAAsB,CAAA,CACxE;cACN,kBAAC,MAAD;WAAI,WAAU;qBAAd;YACE,kBAAC,MAAD,EAAA,UAAI,8CAA+C,CAAA;YACnD,kBAAC,MAAD,EAAA,UAAI,wDAAyD,CAAA;YAC7D,kBAAC,MAAD,EAAA,UAAI,yDAA0D,CAAA;YAC9D,kBAAC,MAAD,EAAA,UAAI,6DAA8D,CAAA;YAC/D;aACD;;SACF;;OAGN,kBAAC,OAAD;QAAK,WAAU;kBAAf,CACE,kBAAC,UAAD;SACE,MAAK;SACL,SAAS;SACT,WAAU;mBACX;SAEQ,CAAA,EACT,kBAAC,UAAD;SACE,MAAK;SACL,eAAe,EAAmB,GAAM;SACxC,WAAU;mBACX;SAEQ,CAAA,CACL;;OACF;;KACF,CAAA;IACF,CAAA;GAEG"}
|
|
@@ -6,8 +6,9 @@ import { formatDate as i } from "../../utils/formatters.js";
|
|
|
6
6
|
import { useState as a } from "react";
|
|
7
7
|
import { Briefcase as o, CheckCircle2 as s, Clock as c, Hash as l, Home as u, MapPin as d, Pencil as f, Plus as p, Star as m, Trash2 as h, X as g } from "lucide-react";
|
|
8
8
|
import { jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
9
|
+
import { EmphasisPanel as y, PagePurpose as b } from "@burdenoff/fe-libs/ui";
|
|
9
10
|
//#region src/coolandlovely/pages/customer/SavedAddressesPage.tsx
|
|
10
|
-
var
|
|
11
|
+
var x = {
|
|
11
12
|
type: "home",
|
|
12
13
|
nickname: "",
|
|
13
14
|
addressLine1: "",
|
|
@@ -16,7 +17,7 @@ var y = {
|
|
|
16
17
|
state: "",
|
|
17
18
|
zipCode: "",
|
|
18
19
|
isDefault: !1
|
|
19
|
-
},
|
|
20
|
+
}, S = [
|
|
20
21
|
{
|
|
21
22
|
id: "addr-001",
|
|
22
23
|
type: "home",
|
|
@@ -69,16 +70,16 @@ var y = {
|
|
|
69
70
|
usageCount: 8,
|
|
70
71
|
lastUsed: "2024-06-18T11:30:00Z"
|
|
71
72
|
}
|
|
72
|
-
],
|
|
73
|
+
], C = {
|
|
73
74
|
home: u,
|
|
74
75
|
office: o,
|
|
75
76
|
other: d
|
|
76
|
-
},
|
|
77
|
-
home: "bg-
|
|
78
|
-
office: "bg-blue-
|
|
79
|
-
other: "bg-purple-
|
|
77
|
+
}, w = {
|
|
78
|
+
home: "bg-status-success-bg-subtle/10 text-status-success-text",
|
|
79
|
+
office: "bg-accent-blue-subtle/10 text-accent-blue",
|
|
80
|
+
other: "bg-accent-purple-subtle/10 text-accent-purple"
|
|
80
81
|
};
|
|
81
|
-
function
|
|
82
|
+
function T({ data: e, onChange: t, onSubmit: n, onCancel: r, submitLabel: i }) {
|
|
82
83
|
return /* @__PURE__ */ v("div", {
|
|
83
84
|
className: "space-y-4",
|
|
84
85
|
children: [
|
|
@@ -87,7 +88,7 @@ function C({ data: e, onChange: t, onSubmit: n, onCancel: r, submitLabel: i }) {
|
|
|
87
88
|
children: [/* @__PURE__ */ v("div", { children: [/* @__PURE__ */ v("label", {
|
|
88
89
|
className: "block text-sm font-medium text-text-primary mb-1.5",
|
|
89
90
|
children: ["Address Type ", /* @__PURE__ */ _("span", {
|
|
90
|
-
className: "text-
|
|
91
|
+
className: "text-status-error-text",
|
|
91
92
|
children: "*"
|
|
92
93
|
})]
|
|
93
94
|
}), /* @__PURE__ */ v("select", {
|
|
@@ -122,7 +123,7 @@ function C({ data: e, onChange: t, onSubmit: n, onCancel: r, submitLabel: i }) {
|
|
|
122
123
|
/* @__PURE__ */ v("div", { children: [/* @__PURE__ */ v("label", {
|
|
123
124
|
className: "block text-sm font-medium text-text-primary mb-1.5",
|
|
124
125
|
children: ["Address Line 1 ", /* @__PURE__ */ _("span", {
|
|
125
|
-
className: "text-
|
|
126
|
+
className: "text-status-error-text",
|
|
126
127
|
children: "*"
|
|
127
128
|
})]
|
|
128
129
|
}), /* @__PURE__ */ _("input", {
|
|
@@ -148,7 +149,7 @@ function C({ data: e, onChange: t, onSubmit: n, onCancel: r, submitLabel: i }) {
|
|
|
148
149
|
/* @__PURE__ */ v("div", { children: [/* @__PURE__ */ v("label", {
|
|
149
150
|
className: "block text-sm font-medium text-text-primary mb-1.5",
|
|
150
151
|
children: ["City ", /* @__PURE__ */ _("span", {
|
|
151
|
-
className: "text-
|
|
152
|
+
className: "text-status-error-text",
|
|
152
153
|
children: "*"
|
|
153
154
|
})]
|
|
154
155
|
}), /* @__PURE__ */ _("input", {
|
|
@@ -161,7 +162,7 @@ function C({ data: e, onChange: t, onSubmit: n, onCancel: r, submitLabel: i }) {
|
|
|
161
162
|
/* @__PURE__ */ v("div", { children: [/* @__PURE__ */ v("label", {
|
|
162
163
|
className: "block text-sm font-medium text-text-primary mb-1.5",
|
|
163
164
|
children: ["State ", /* @__PURE__ */ _("span", {
|
|
164
|
-
className: "text-
|
|
165
|
+
className: "text-status-error-text",
|
|
165
166
|
children: "*"
|
|
166
167
|
})]
|
|
167
168
|
}), /* @__PURE__ */ _("input", {
|
|
@@ -174,7 +175,7 @@ function C({ data: e, onChange: t, onSubmit: n, onCancel: r, submitLabel: i }) {
|
|
|
174
175
|
/* @__PURE__ */ v("div", { children: [/* @__PURE__ */ v("label", {
|
|
175
176
|
className: "block text-sm font-medium text-text-primary mb-1.5",
|
|
176
177
|
children: ["ZIP Code ", /* @__PURE__ */ _("span", {
|
|
177
|
-
className: "text-
|
|
178
|
+
className: "text-status-error-text",
|
|
178
179
|
children: "*"
|
|
179
180
|
})]
|
|
180
181
|
}), /* @__PURE__ */ _("input", {
|
|
@@ -215,47 +216,47 @@ function C({ data: e, onChange: t, onSubmit: n, onCancel: r, submitLabel: i }) {
|
|
|
215
216
|
]
|
|
216
217
|
});
|
|
217
218
|
}
|
|
218
|
-
function
|
|
219
|
-
let { navigateTo: o } = e(), [u,
|
|
220
|
-
|
|
221
|
-
},
|
|
222
|
-
if (!
|
|
219
|
+
function E() {
|
|
220
|
+
let { navigateTo: o } = e(), [u, E] = a(S), [D, O] = a(!1), [k, A] = a(null), [j, M] = a({ ...x }), [N, P] = a(null), F = (e) => {
|
|
221
|
+
P(e), setTimeout(() => P(null), 3e3);
|
|
222
|
+
}, I = (e) => !e.addressLine1.trim() || !e.city.trim() || !e.state.trim() || !e.zipCode.trim() ? (alert("Please fill in all required fields (Address Line 1, City, State, ZIP Code)."), !1) : !0, L = () => {
|
|
223
|
+
if (!I(j)) return;
|
|
223
224
|
let e = {
|
|
224
225
|
id: `addr-${Date.now()}`,
|
|
225
|
-
type:
|
|
226
|
-
nickname:
|
|
227
|
-
addressLine1:
|
|
228
|
-
addressLine2:
|
|
229
|
-
city:
|
|
230
|
-
state:
|
|
231
|
-
zipCode:
|
|
232
|
-
isDefault:
|
|
226
|
+
type: j.type,
|
|
227
|
+
nickname: j.nickname,
|
|
228
|
+
addressLine1: j.addressLine1,
|
|
229
|
+
addressLine2: j.addressLine2,
|
|
230
|
+
city: j.city,
|
|
231
|
+
state: j.state,
|
|
232
|
+
zipCode: j.zipCode,
|
|
233
|
+
isDefault: j.isDefault,
|
|
233
234
|
usageCount: 0
|
|
234
235
|
};
|
|
235
|
-
|
|
236
|
+
E((t) => {
|
|
236
237
|
let n = [...t];
|
|
237
238
|
return e.isDefault && (n = n.map((e) => ({
|
|
238
239
|
...e,
|
|
239
240
|
isDefault: !1
|
|
240
241
|
}))), [...n, e];
|
|
241
|
-
}),
|
|
242
|
-
},
|
|
243
|
-
|
|
242
|
+
}), M({ ...x }), O(!1), F("Address added successfully");
|
|
243
|
+
}, R = () => {
|
|
244
|
+
k && I(k) && (E((e) => e.map((e) => e.id === k.id ? k : k.isDefault ? {
|
|
244
245
|
...e,
|
|
245
246
|
isDefault: !1
|
|
246
|
-
} : e)),
|
|
247
|
-
},
|
|
247
|
+
} : e)), A(null), F("Address updated successfully"));
|
|
248
|
+
}, z = (e) => {
|
|
248
249
|
if (u.find((t) => t.id === e)?.isDefault) {
|
|
249
250
|
alert("Cannot delete default address. Set another address as default first.");
|
|
250
251
|
return;
|
|
251
252
|
}
|
|
252
|
-
|
|
253
|
-
},
|
|
254
|
-
|
|
253
|
+
E((t) => t.filter((t) => t.id !== e)), F("Address deleted successfully");
|
|
254
|
+
}, B = (e) => {
|
|
255
|
+
E((t) => t.map((t) => ({
|
|
255
256
|
...t,
|
|
256
257
|
isDefault: t.id === e
|
|
257
|
-
}))),
|
|
258
|
-
},
|
|
258
|
+
}))), F("Default address updated");
|
|
259
|
+
}, V = (e, t, n) => {
|
|
259
260
|
e((e) => ({
|
|
260
261
|
...e,
|
|
261
262
|
[t]: n
|
|
@@ -264,31 +265,36 @@ function w() {
|
|
|
264
265
|
return /* @__PURE__ */ v(n, {
|
|
265
266
|
title: "Saved Addresses",
|
|
266
267
|
description: "Manage your delivery addresses for faster checkout",
|
|
267
|
-
actions:
|
|
268
|
+
actions: D ? void 0 : /* @__PURE__ */ v("button", {
|
|
268
269
|
type: "button",
|
|
269
|
-
onClick: () =>
|
|
270
|
+
onClick: () => O(!0),
|
|
270
271
|
className: t("flex items-center gap-2 rounded-lg px-4 py-2 text-sm font-medium transition-opacity", "bg-foreground text-background hover:opacity-90"),
|
|
271
272
|
children: [/* @__PURE__ */ _(p, { className: "h-4 w-4" }), "Add New Address"]
|
|
272
273
|
}),
|
|
273
274
|
children: [
|
|
274
|
-
|
|
275
|
-
className: "mb-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
275
|
+
/* @__PURE__ */ _(b, {
|
|
276
|
+
className: "mb-6",
|
|
277
|
+
icon: /* @__PURE__ */ _(d, { className: "h-4 w-4" }),
|
|
278
|
+
children: "Keep your home, office and other delivery spots saved so you never retype an address at checkout. Set a default for one-tap ordering, nickname each place, and see which addresses you use most."
|
|
279
|
+
}),
|
|
280
|
+
N && /* @__PURE__ */ v("div", {
|
|
281
|
+
className: "mb-4 rounded-lg border border-status-success-border/30 bg-status-success-bg-subtle/10 p-3 flex items-center gap-2",
|
|
282
|
+
children: [/* @__PURE__ */ _(s, { className: "h-4 w-4 text-status-success-text shrink-0" }), /* @__PURE__ */ _("p", {
|
|
283
|
+
className: "text-sm text-status-success-text",
|
|
284
|
+
children: N
|
|
279
285
|
})]
|
|
280
286
|
}),
|
|
281
|
-
|
|
282
|
-
className: "rounded-lg border border-border-
|
|
287
|
+
D && /* @__PURE__ */ v("div", {
|
|
288
|
+
className: "rounded-lg border border-border-seam bg-bg-surface p-5 mb-6 bg-gloss-card shadow-pop",
|
|
283
289
|
children: [/* @__PURE__ */ _("h3", {
|
|
284
290
|
className: "text-base font-semibold text-text-primary mb-4",
|
|
285
291
|
children: "Add New Address"
|
|
286
|
-
}), /* @__PURE__ */ _(
|
|
287
|
-
data:
|
|
288
|
-
onChange: (e, t) =>
|
|
289
|
-
onSubmit:
|
|
292
|
+
}), /* @__PURE__ */ _(T, {
|
|
293
|
+
data: j,
|
|
294
|
+
onChange: (e, t) => V(M, e, t),
|
|
295
|
+
onSubmit: L,
|
|
290
296
|
onCancel: () => {
|
|
291
|
-
|
|
297
|
+
O(!1), M({ ...x });
|
|
292
298
|
},
|
|
293
299
|
submitLabel: "Save Address"
|
|
294
300
|
})]
|
|
@@ -296,8 +302,8 @@ function w() {
|
|
|
296
302
|
u.length > 0 ? /* @__PURE__ */ _("div", {
|
|
297
303
|
className: "space-y-3",
|
|
298
304
|
children: u.map((e) => {
|
|
299
|
-
let n =
|
|
300
|
-
return /* @__PURE__ */ _("div", {
|
|
305
|
+
let n = C[e.type];
|
|
306
|
+
return /* @__PURE__ */ _(e.isDefault ? y : "div", {
|
|
301
307
|
className: t("rounded-lg border bg-bg-surface p-4", e.isDefault ? "border-foreground/30" : "border-border-subtle"),
|
|
302
308
|
children: /* @__PURE__ */ v("div", {
|
|
303
309
|
className: "flex items-start justify-between gap-3",
|
|
@@ -312,10 +318,10 @@ function w() {
|
|
|
312
318
|
/* @__PURE__ */ v("div", {
|
|
313
319
|
className: "flex flex-wrap items-center gap-2",
|
|
314
320
|
children: [/* @__PURE__ */ _("span", {
|
|
315
|
-
className: t("inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-medium capitalize",
|
|
321
|
+
className: t("inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-medium capitalize", w[e.type]),
|
|
316
322
|
children: e.type
|
|
317
323
|
}), e.isDefault && /* @__PURE__ */ v("span", {
|
|
318
|
-
className: "inline-flex items-center gap-1 rounded-full bg-
|
|
324
|
+
className: "inline-flex items-center gap-1 rounded-full bg-status-success-bg-subtle/10 px-2 py-0.5 text-[10px] font-medium text-status-success-text",
|
|
319
325
|
children: [/* @__PURE__ */ _(s, { className: "h-3 w-3" }), "Default"]
|
|
320
326
|
})]
|
|
321
327
|
}),
|
|
@@ -372,21 +378,21 @@ function w() {
|
|
|
372
378
|
children: [
|
|
373
379
|
!e.isDefault && /* @__PURE__ */ _("button", {
|
|
374
380
|
type: "button",
|
|
375
|
-
onClick: () =>
|
|
381
|
+
onClick: () => B(e.id),
|
|
376
382
|
title: "Set as default",
|
|
377
383
|
className: "rounded-md p-2 text-text-secondary hover:bg-accent hover:text-text-primary transition-colors",
|
|
378
384
|
children: /* @__PURE__ */ _(m, { className: "h-4 w-4" })
|
|
379
385
|
}),
|
|
380
386
|
/* @__PURE__ */ _("button", {
|
|
381
387
|
type: "button",
|
|
382
|
-
onClick: () =>
|
|
388
|
+
onClick: () => A({ ...e }),
|
|
383
389
|
title: "Edit address",
|
|
384
390
|
className: "rounded-md p-2 text-text-secondary hover:bg-accent hover:text-text-primary transition-colors",
|
|
385
391
|
children: /* @__PURE__ */ _(f, { className: "h-4 w-4" })
|
|
386
392
|
}),
|
|
387
393
|
/* @__PURE__ */ _("button", {
|
|
388
394
|
type: "button",
|
|
389
|
-
onClick: () =>
|
|
395
|
+
onClick: () => z(e.id),
|
|
390
396
|
title: "Delete address",
|
|
391
397
|
className: "rounded-md p-2 text-text-secondary hover:bg-status-error-bg/10 hover:text-status-error-text transition-colors",
|
|
392
398
|
children: /* @__PURE__ */ _(h, { className: "h-4 w-4" })
|
|
@@ -397,17 +403,17 @@ function w() {
|
|
|
397
403
|
}, e.id);
|
|
398
404
|
})
|
|
399
405
|
}) : /* @__PURE__ */ _(r, {
|
|
400
|
-
|
|
406
|
+
illustration: "empty-generic",
|
|
401
407
|
title: "No saved addresses",
|
|
402
408
|
description: "Add a delivery address to get started.",
|
|
403
409
|
action: /* @__PURE__ */ _("button", {
|
|
404
410
|
type: "button",
|
|
405
|
-
onClick: () =>
|
|
411
|
+
onClick: () => O(!0),
|
|
406
412
|
className: "rounded-lg bg-foreground px-4 py-2 text-sm font-medium text-background hover:opacity-90 transition-opacity",
|
|
407
413
|
children: "Add Address"
|
|
408
414
|
})
|
|
409
415
|
}),
|
|
410
|
-
|
|
416
|
+
k && /* @__PURE__ */ _("div", {
|
|
411
417
|
className: "fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",
|
|
412
418
|
children: /* @__PURE__ */ _("div", {
|
|
413
419
|
className: "w-full max-w-2xl max-h-[90vh] overflow-y-auto rounded-lg border border-border-subtle bg-bg-surface shadow-lg",
|
|
@@ -420,15 +426,15 @@ function w() {
|
|
|
420
426
|
children: "Edit Address"
|
|
421
427
|
}), /* @__PURE__ */ _("button", {
|
|
422
428
|
type: "button",
|
|
423
|
-
onClick: () =>
|
|
429
|
+
onClick: () => A(null),
|
|
424
430
|
className: "rounded-md p-2 text-text-secondary hover:bg-accent hover:text-text-primary transition-colors",
|
|
425
431
|
children: /* @__PURE__ */ _(g, { className: "h-4 w-4" })
|
|
426
432
|
})]
|
|
427
|
-
}), /* @__PURE__ */ _(
|
|
428
|
-
data:
|
|
429
|
-
onChange: (e, t) =>
|
|
430
|
-
onSubmit:
|
|
431
|
-
onCancel: () =>
|
|
433
|
+
}), /* @__PURE__ */ _(T, {
|
|
434
|
+
data: k,
|
|
435
|
+
onChange: (e, t) => V(A, e, t),
|
|
436
|
+
onSubmit: R,
|
|
437
|
+
onCancel: () => A(null),
|
|
432
438
|
submitLabel: "Save Changes"
|
|
433
439
|
})]
|
|
434
440
|
})
|
|
@@ -438,6 +444,6 @@ function w() {
|
|
|
438
444
|
});
|
|
439
445
|
}
|
|
440
446
|
//#endregion
|
|
441
|
-
export {
|
|
447
|
+
export { E as SavedAddressesPage };
|
|
442
448
|
|
|
443
449
|
//# sourceMappingURL=SavedAddressesPage.js.map
|