hey-pharmacist-ecommerce 1.1.38 → 1.1.39
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/README.md +0 -3
- package/dist/index.d.mts +3 -6
- package/dist/index.d.ts +3 -6
- package/dist/index.js +67 -67
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +67 -67
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/AccountOrdersTab.tsx +6 -1
- package/src/components/AccountOverviewTab.tsx +6 -5
- package/src/components/AccountReviewsTab.tsx +1 -1
- package/src/components/CartItem.tsx +2 -2
- package/src/components/ProductCard.tsx +4 -21
- package/src/components/ReviewCard.tsx +4 -4
- package/src/lib/types/index.ts +4 -6
- package/src/providers/ThemeProvider.tsx +9 -15
- package/src/screens/CartScreen.tsx +3 -3
- package/src/screens/CheckoutScreen.tsx +9 -9
- package/src/screens/LoginScreen.tsx +1 -9
- package/src/screens/OrderDetailScreen.tsx +23 -2
- package/src/screens/ProductDetailScreen.tsx +1 -1
- package/src/screens/WishlistScreen.tsx +1 -1
- package/src/styles/globals.css +1 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hey-pharmacist-ecommerce",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.39",
|
|
4
4
|
"description": "Production-ready, multi-tenant e‑commerce UI + API adapter for Next.js with auth, carts, checkout, orders, theming, and pharmacist-focused UX.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -9,9 +9,13 @@ import { EmptyState } from './EmptyState';
|
|
|
9
9
|
import { Badge } from './ui/Badge';
|
|
10
10
|
import { formatPrice, formatDate } from '@/lib/utils/format';
|
|
11
11
|
import Image from 'next/image';
|
|
12
|
+
import { useRouter } from 'next/navigation';
|
|
13
|
+
import { useBasePath } from '@/providers/BasePathProvider';
|
|
12
14
|
|
|
13
15
|
export function AccountOrdersTab() {
|
|
14
16
|
const { orders, isLoading, error } = useCurrentOrders();
|
|
17
|
+
const router = useRouter();
|
|
18
|
+
const { buildPath } = useBasePath();
|
|
15
19
|
|
|
16
20
|
if (isLoading) {
|
|
17
21
|
return (
|
|
@@ -58,7 +62,8 @@ export function AccountOrdersTab() {
|
|
|
58
62
|
return (
|
|
59
63
|
<div
|
|
60
64
|
key={order._id}
|
|
61
|
-
|
|
65
|
+
onClick={() => router.push(buildPath(`/account/orders/${order._id}`))}
|
|
66
|
+
className="rounded-xl border border-slate-200 bg-white p-6 hover:shadow-md transition-shadow cursor-pointer"
|
|
62
67
|
>
|
|
63
68
|
{/* Order Header */}
|
|
64
69
|
<div className="flex items-start justify-between mb-4 pb-4 border-b border-slate-200">
|
|
@@ -96,7 +96,7 @@ export function AccountOverviewTab() {
|
|
|
96
96
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
97
97
|
<div className="flex items-start gap-3">
|
|
98
98
|
<div className="flex h-10 w-10 items-center justify-center rounded-lg bg-[#DBEAFE]">
|
|
99
|
-
<User className="h-5 w-5 text-
|
|
99
|
+
<User className="h-5 w-5 text-secondary" />
|
|
100
100
|
</div>
|
|
101
101
|
<div>
|
|
102
102
|
<p className="text-xs text-muted">Full Name</p>
|
|
@@ -107,7 +107,7 @@ export function AccountOverviewTab() {
|
|
|
107
107
|
</div>
|
|
108
108
|
<div className="flex items-start gap-3">
|
|
109
109
|
<div className="flex h-10 w-10 items-center justify-center rounded-lg bg-[#DBEAFE]">
|
|
110
|
-
<Mail className="h-5 w-5 text-
|
|
110
|
+
<Mail className="h-5 w-5 text-secondary" />
|
|
111
111
|
</div>
|
|
112
112
|
<div>
|
|
113
113
|
<p className="text-xs text-muted">E-mail Address</p>
|
|
@@ -116,7 +116,7 @@ export function AccountOverviewTab() {
|
|
|
116
116
|
</div>
|
|
117
117
|
<div className="flex items-start gap-3">
|
|
118
118
|
<div className="flex h-10 w-10 items-center justify-center rounded-lg bg-[#DBEAFE]">
|
|
119
|
-
<Phone className="h-5 w-5 text-
|
|
119
|
+
<Phone className="h-5 w-5 text-secondary" />
|
|
120
120
|
</div>
|
|
121
121
|
<div>
|
|
122
122
|
<p className="text-xs text-muted">Phone Number</p>
|
|
@@ -127,7 +127,7 @@ export function AccountOverviewTab() {
|
|
|
127
127
|
</div>
|
|
128
128
|
<div className="flex items-start gap-3">
|
|
129
129
|
<div className="flex h-10 w-10 items-center justify-center rounded-lg bg-[#DBEAFE]">
|
|
130
|
-
<MapPin className="h-5 w-5 text-
|
|
130
|
+
<MapPin className="h-5 w-5 text-secondary" />
|
|
131
131
|
</div>
|
|
132
132
|
<div>
|
|
133
133
|
<p className="text-xs text-muted">Date of Birth</p>
|
|
@@ -168,7 +168,8 @@ export function AccountOverviewTab() {
|
|
|
168
168
|
{recentOrders.map((order) => (
|
|
169
169
|
<div
|
|
170
170
|
key={order._id}
|
|
171
|
-
|
|
171
|
+
onClick={() => router.push(buildPath(`/account/orders/${order._id}`))}
|
|
172
|
+
className="flex items-center justify-between rounded-lg bg-slate-50 p-4 hover:bg-slate-100 transition-colors cursor-pointer"
|
|
172
173
|
>
|
|
173
174
|
<div className="flex items-center gap-3">
|
|
174
175
|
<div className="flex h-10 w-10 items-center justify-center rounded-lg bg-white">
|
|
@@ -76,7 +76,7 @@ export function AccountReviewsTab() {
|
|
|
76
76
|
</div>
|
|
77
77
|
<button
|
|
78
78
|
onClick={() => router.push(buildPath('/reviews'))}
|
|
79
|
-
className="inline-flex items-center gap-2 px-4 py-2 border border-
|
|
79
|
+
className="inline-flex items-center gap-2 px-4 py-2 border border-secondary text-secondary rounded-lg font-medium hover:bg-secondary/5 transition-colors text-sm"
|
|
80
80
|
>
|
|
81
81
|
<MessageSquare className="size-4" />
|
|
82
82
|
Write a Review
|
|
@@ -50,7 +50,7 @@ export function CartItem({ item }: CartItemProps) {
|
|
|
50
50
|
initial={{ opacity: 0, y: 20 }}
|
|
51
51
|
animate={{ opacity: 1, y: 0 }}
|
|
52
52
|
exit={{ opacity: 0, x: -100 }}
|
|
53
|
-
className="bg-white border-2 border-gray-100 rounded-[24px] p-6 hover:border-
|
|
53
|
+
className="bg-white border-2 border-gray-100 rounded-[24px] p-6 hover:border-secondary/30 transition-all duration-300"
|
|
54
54
|
>
|
|
55
55
|
|
|
56
56
|
|
|
@@ -122,7 +122,7 @@ export function CartItem({ item }: CartItemProps) {
|
|
|
122
122
|
|
|
123
123
|
{/* Price */}
|
|
124
124
|
<div className="text-right">
|
|
125
|
-
<p className="font-['Poppins',sans-serif] font-bold text-[18px] text-
|
|
125
|
+
<p className="font-['Poppins',sans-serif] font-bold text-[18px] text-secondary">
|
|
126
126
|
{formatPrice(itemTotal)}
|
|
127
127
|
</p>
|
|
128
128
|
<p className="font-['Poppins',sans-serif] text-[11px] text-[#676c80]">
|
|
@@ -180,7 +180,7 @@ export function ProductCard({
|
|
|
180
180
|
return (
|
|
181
181
|
<>
|
|
182
182
|
<motion.div
|
|
183
|
-
className="bg-white rounded-[16px] overflow-hidden border-2 border-gray-100 hover:border-
|
|
183
|
+
className="bg-white rounded-[16px] overflow-hidden border-2 border-gray-100 hover:border-secondary hover:shadow-lg transition-all duration-300 group h-full flex flex-col"
|
|
184
184
|
whileHover={{ y: -4 }}
|
|
185
185
|
onMouseEnter={() => setIsHovered(true)}
|
|
186
186
|
onMouseLeave={() => setIsHovered(false)}
|
|
@@ -236,27 +236,10 @@ export function ProductCard({
|
|
|
236
236
|
<span className="font-['Poppins',sans-serif] font-bold text-[8px] uppercase">-{displayDiscountAmount}%</span>
|
|
237
237
|
</span>
|
|
238
238
|
)}
|
|
239
|
-
|
|
240
|
-
<span className="bg-linear-to-r from-[#E67E50] to-[#d66f45] text-white rounded-full px-2 py-0.5 flex items-center gap-1">
|
|
241
|
-
<TrendingUp className="size-2.5" />
|
|
242
|
-
<span className="font-['Poppins',sans-serif] font-semibold text-[8px] uppercase">Deal</span>
|
|
243
|
-
</span>
|
|
244
|
-
)}
|
|
245
|
-
{product.bestseller && !product.dealOfWeek && (
|
|
246
|
-
<span className="bg-[#2B4B7C] text-white rounded-full px-2 py-0.5 flex items-center gap-1">
|
|
247
|
-
<TrendingUp className="size-2.5" />
|
|
248
|
-
<span className="font-['Poppins',sans-serif] font-semibold text-[8px] uppercase">Best</span>
|
|
249
|
-
</span>
|
|
250
|
-
)}
|
|
251
|
-
{product.newArrival && (
|
|
252
|
-
<span className="bg-[#5B9BD5] text-white rounded-full px-2 py-0.5 flex items-center gap-1">
|
|
253
|
-
<Sparkles className="size-2.5" />
|
|
254
|
-
<span className="font-['Poppins',sans-serif] font-semibold text-[8px] uppercase">New</span>
|
|
255
|
-
</span>
|
|
256
|
-
)} */}
|
|
239
|
+
|
|
257
240
|
</div>
|
|
258
241
|
<div className="mb-1">
|
|
259
|
-
<p className="font-['Poppins',sans-serif] text-xs text-
|
|
242
|
+
<p className="font-['Poppins',sans-serif] text-xs text-secondary uppercase tracking-wide font-medium">
|
|
260
243
|
{product.brand}
|
|
261
244
|
</p>
|
|
262
245
|
</div>
|
|
@@ -375,7 +358,7 @@ export function ProductCard({
|
|
|
375
358
|
}
|
|
376
359
|
}}
|
|
377
360
|
disabled={isAddingToCart || (variantImages.length > 0 && !selectedVariantId) || displayInventoryCount === 0}
|
|
378
|
-
className="w-full font-['Poppins',sans-serif] font-medium text-[11px] px-3 py-2 rounded-full bg-
|
|
361
|
+
className="w-full font-['Poppins',sans-serif] font-medium text-[11px] px-3 py-2 rounded-full bg-secondary text-white hover:bg-secondary/80 hover:shadow-lg transition-all duration-300 flex items-center justify-center gap-1.5 disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer"
|
|
379
362
|
>
|
|
380
363
|
<ShoppingCart className="h-4 w-4" />
|
|
381
364
|
{displayInventoryCount === 0 ? 'Out of Stock' : 'Add to Cart'}
|
|
@@ -19,8 +19,8 @@ export function ReviewCard({ review, showProductInfo = false }: ReviewCardProps)
|
|
|
19
19
|
<div className="border border-gray-200 rounded-lg p-4 bg-white">
|
|
20
20
|
<div className="flex items-start justify-between mb-3">
|
|
21
21
|
<div className="flex items-center gap-3">
|
|
22
|
-
<div className="w-10 h-10 bg-
|
|
23
|
-
<User className="size-5 text-
|
|
22
|
+
<div className="w-10 h-10 bg-secondary/10 rounded-full flex items-center justify-center">
|
|
23
|
+
<User className="size-5 text-secondary" />
|
|
24
24
|
</div>
|
|
25
25
|
<div>
|
|
26
26
|
<p className="font-medium text-gray-900">Customer Review</p>
|
|
@@ -41,9 +41,9 @@ export function ReviewCard({ review, showProductInfo = false }: ReviewCardProps)
|
|
|
41
41
|
<p className="text-gray-700 text-sm leading-relaxed mb-3">{review.review}</p>
|
|
42
42
|
|
|
43
43
|
{review.reply && (
|
|
44
|
-
<div className="mt-4 pl-4 border-l-2 border-
|
|
44
|
+
<div className="mt-4 pl-4 border-l-2 border-secondary bg-gray-50 p-3 rounded">
|
|
45
45
|
<div className="flex items-center gap-2 mb-2">
|
|
46
|
-
<MessageCircle className="size-4 text-
|
|
46
|
+
<MessageCircle className="size-4 text-secondary" />
|
|
47
47
|
<p className="text-xs font-medium text-gray-900">Store Response</p>
|
|
48
48
|
{replyDate && (
|
|
49
49
|
<p className="text-xs text-gray-500">
|
package/src/lib/types/index.ts
CHANGED
|
@@ -5,15 +5,13 @@ export interface EcommerceConfig {
|
|
|
5
5
|
logo: string;
|
|
6
6
|
colors: {
|
|
7
7
|
primary: string;
|
|
8
|
+
primaryDark: string;
|
|
8
9
|
secondary: string;
|
|
9
10
|
accent: string;
|
|
11
|
+
accentDark: string;
|
|
12
|
+
textMuted: string;
|
|
10
13
|
};
|
|
11
|
-
|
|
12
|
-
headerGradient?: {
|
|
13
|
-
from: string; // hex color like #123456
|
|
14
|
-
via: string; // hex color
|
|
15
|
-
to: string; // hex color
|
|
16
|
-
};
|
|
14
|
+
|
|
17
15
|
apiBaseUrl: string;
|
|
18
16
|
}
|
|
19
17
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { createContext, useContext, useEffect } from 'react';
|
|
4
4
|
import { EcommerceConfig } from '@/lib/types';
|
|
5
|
-
import { generateColorShades
|
|
5
|
+
import { generateColorShades } from '@/lib/utils/colors';
|
|
6
6
|
|
|
7
7
|
interface ThemeContextValue {
|
|
8
8
|
config: EcommerceConfig;
|
|
@@ -47,20 +47,14 @@ export function ThemeProvider({ config, children }: ThemeProviderProps) {
|
|
|
47
47
|
root.style.setProperty(`--color-accent-${shade}`, rgb);
|
|
48
48
|
});
|
|
49
49
|
|
|
50
|
-
//
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
} else {
|
|
59
|
-
// Fallback to theme shades matching existing design
|
|
60
|
-
root.style.setProperty(`--header-from`, primaryShades[700]);
|
|
61
|
-
root.style.setProperty(`--header-via`, primaryShades[600]);
|
|
62
|
-
root.style.setProperty(`--header-to`, secondaryShades[600]);
|
|
63
|
-
}
|
|
50
|
+
// Set base color variables from EcommerceConfig
|
|
51
|
+
root.style.setProperty('--color-primary', config.colors.primary);
|
|
52
|
+
root.style.setProperty('--color-primary-dark', config.colors.primaryDark);
|
|
53
|
+
root.style.setProperty('--color-secondary', config.colors.secondary);
|
|
54
|
+
root.style.setProperty('--color-accent', config.colors.accent);
|
|
55
|
+
root.style.setProperty('--color-accent-dark', config.colors.accentDark);
|
|
56
|
+
root.style.setProperty('--color-text-muted', config.colors.textMuted);
|
|
57
|
+
|
|
64
58
|
}, [config]);
|
|
65
59
|
|
|
66
60
|
return (
|
|
@@ -59,7 +59,7 @@ export function CartScreen() {
|
|
|
59
59
|
<button
|
|
60
60
|
type="button"
|
|
61
61
|
onClick={() => router.push(buildPath('/shop'))}
|
|
62
|
-
className="rounded-xl border-2 border-primary bg-
|
|
62
|
+
className="rounded-xl border-2 border-primary bg-secondary text-white px-6 py-3 text-sm font-medium transition-colors flex items-center justify-center gap-2 hover:opacity-80"
|
|
63
63
|
>
|
|
64
64
|
Discover products
|
|
65
65
|
<ArrowRight className="h-5 w-5" />
|
|
@@ -150,7 +150,7 @@ export function CartScreen() {
|
|
|
150
150
|
transition={{ delay: 0.1 }}
|
|
151
151
|
className="space-y-6 lg:sticky lg:top-24 h-fit lg:col-span-1"
|
|
152
152
|
>
|
|
153
|
-
<div className="bg-linear-to-br from-
|
|
153
|
+
<div className="bg-linear-to-br from-secondary/10 to-secondary/10 rounded-[24px] p-8 border-2 border-secondary/20 sticky top-24">
|
|
154
154
|
<h2 className="font-['Poppins',sans-serif] font-semibold text-secondary mb-6">Order Summary</h2>
|
|
155
155
|
|
|
156
156
|
<div className="space-y-4 mb-6">
|
|
@@ -176,7 +176,7 @@ export function CartScreen() {
|
|
|
176
176
|
<button
|
|
177
177
|
type="submit"
|
|
178
178
|
onClick={handleSubmit}
|
|
179
|
-
className="w-full rounded-full border-2 border-
|
|
179
|
+
className="w-full rounded-full border-2 border-secondary bg-secondary hover:bg-secondary/80 text-white px-4 py-3 text-sm font-medium transition-colors flex items-center justify-center gap-2"
|
|
180
180
|
>
|
|
181
181
|
Proceed to Checkout
|
|
182
182
|
<ArrowRight className="h-5 w-5" />
|
|
@@ -979,8 +979,8 @@ export function CheckoutScreen() {
|
|
|
979
979
|
className="space-y-10 lg:sticky lg:top-24 lg:col-span-1"
|
|
980
980
|
>
|
|
981
981
|
{/* Order Summary */}
|
|
982
|
-
<div className="bg-linear-to-br from-
|
|
983
|
-
<h2 className="font-['Poppins',sans-serif] font-semibold text-
|
|
982
|
+
<div className="bg-linear-to-br from-secondary/10 to-secondary/10 rounded-[24px] p-8 border-2 border-secondary/20 sticky top-24">
|
|
983
|
+
<h2 className="font-['Poppins',sans-serif] font-semibold text-secondary mb-6 text-2xl">Order Summary</h2>
|
|
984
984
|
|
|
985
985
|
|
|
986
986
|
{/* Cart Summary */}
|
|
@@ -998,7 +998,7 @@ export function CheckoutScreen() {
|
|
|
998
998
|
<p className="font-['Poppins',sans-serif] text-[11px] text-[#676c80]">
|
|
999
999
|
{item?.productVariantData?.brand} • Qty: {item.quantity}
|
|
1000
1000
|
</p>
|
|
1001
|
-
<p className="font-['Poppins',sans-serif] font-semibold text-[12px] text-
|
|
1001
|
+
<p className="font-['Poppins',sans-serif] font-semibold text-[12px] text-secondary mt-1">
|
|
1002
1002
|
{formatPrice(item.productVariantData.finalPrice * item.quantity)}
|
|
1003
1003
|
</p>
|
|
1004
1004
|
</div>
|
|
@@ -1006,7 +1006,7 @@ export function CheckoutScreen() {
|
|
|
1006
1006
|
))}
|
|
1007
1007
|
</div>
|
|
1008
1008
|
|
|
1009
|
-
<div className="h-px bg-
|
|
1009
|
+
<div className="h-px bg-secondary/20 my-4" />
|
|
1010
1010
|
|
|
1011
1011
|
{/* Coupon Code Section */}
|
|
1012
1012
|
<div className="mb-6">
|
|
@@ -1042,11 +1042,11 @@ export function CheckoutScreen() {
|
|
|
1042
1042
|
<span>Estimated tax</span>
|
|
1043
1043
|
<span className="font-semibold">{formatPrice(tax)}</span>
|
|
1044
1044
|
</div>
|
|
1045
|
-
<div className="h-px bg-
|
|
1045
|
+
<div className="h-px bg-secondary/20 mt-6" />
|
|
1046
1046
|
|
|
1047
1047
|
<div className="flex items-center justify-between mb-6">
|
|
1048
|
-
<span className="font-['Poppins',sans-serif] font-semibold text-[16px] text-
|
|
1049
|
-
<span className="font-['Poppins',sans-serif] font-bold text-[24px] text-
|
|
1048
|
+
<span className="font-['Poppins',sans-serif] font-semibold text-[16px] text-secondary">Total</span>
|
|
1049
|
+
<span className="font-['Poppins',sans-serif] font-bold text-[24px] text-secondary">{formatPrice(total)}</span>
|
|
1050
1050
|
</div>
|
|
1051
1051
|
{/* <p className="mt-1 text-xs text-slate-500">
|
|
1052
1052
|
Tax is estimated. Final amount confirmed after payment.
|
|
@@ -1055,7 +1055,7 @@ export function CheckoutScreen() {
|
|
|
1055
1055
|
|
|
1056
1056
|
<div className="bg-white/80 rounded-xl p-4">
|
|
1057
1057
|
<p className="font-['Poppins',sans-serif] text-[11px] text-[#676c80] leading-[1.6]">
|
|
1058
|
-
<strong className="text-
|
|
1058
|
+
<strong className="text-secondary">Payment:</strong> We'll contact you to arrange payment upon pickup or delivery. We accept cash, credit cards, and all major payment methods.
|
|
1059
1059
|
</p>
|
|
1060
1060
|
</div>
|
|
1061
1061
|
</section>
|
|
@@ -1093,7 +1093,7 @@ export function CheckoutScreen() {
|
|
|
1093
1093
|
<button
|
|
1094
1094
|
type="submit"
|
|
1095
1095
|
disabled={isSubmitting}
|
|
1096
|
-
className="font-['Poppins',sans-serif] font-medium text-[14px] px-6 py-3 rounded-full text-white hover:bg-[#d66f45] hover:shadow-lg transition-all duration-300 mt-4 w-full bg-
|
|
1096
|
+
className="font-['Poppins',sans-serif] font-medium text-[14px] px-6 py-3 rounded-full text-white hover:bg-[#d66f45] hover:shadow-lg transition-all duration-300 mt-4 w-full bg-secondary hover:bg-[#2B4B7C] flex items-center justify-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed"
|
|
1097
1097
|
>
|
|
1098
1098
|
<CreditCard className="h-5 w-5" />
|
|
1099
1099
|
{isSubmitting ? 'Placing order...' : 'Place Secure Order'}
|
|
@@ -99,7 +99,6 @@ export function LoginScreen() {
|
|
|
99
99
|
: 'border-red-200 bg-red-50 text-red-700'
|
|
100
100
|
}`}
|
|
101
101
|
>
|
|
102
|
-
<span className=" text-base">{status.type === 'success' ? '✔' : '!'}</span>
|
|
103
102
|
<span>{status.message}</span>
|
|
104
103
|
</div>
|
|
105
104
|
)}
|
|
@@ -133,14 +132,7 @@ export function LoginScreen() {
|
|
|
133
132
|
</button>
|
|
134
133
|
</div>
|
|
135
134
|
|
|
136
|
-
<div className="flex items-center justify-
|
|
137
|
-
<label className="flex items-center gap-2 text-slate-600">
|
|
138
|
-
<input
|
|
139
|
-
type="checkbox"
|
|
140
|
-
className="h-4 w-4 rounded-sm border-slate-300 text-primary-600 focus:ring-primary-500"
|
|
141
|
-
/>
|
|
142
|
-
Remember me
|
|
143
|
-
</label>
|
|
135
|
+
<div className="flex items-center justify-end text-sm">
|
|
144
136
|
<Link
|
|
145
137
|
href={buildPath('/forgot-password')}
|
|
146
138
|
className="font-medium text-primary transition hover:opacity-80"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { PLACEHOLDER_IMAGE_SRC } from '@/lib/constants/assets';
|
|
4
4
|
|
|
5
|
-
import React from 'react';
|
|
5
|
+
import React, { useState, useEffect } from 'react';
|
|
6
6
|
import { motion } from 'framer-motion';
|
|
7
7
|
import {
|
|
8
8
|
ChevronLeft,
|
|
@@ -25,6 +25,8 @@ import { formatPrice, formatDate } from '@/lib/utils/format';
|
|
|
25
25
|
import { Badge } from '@/components/ui/Badge';
|
|
26
26
|
import { Button } from '@/components/ui/Button';
|
|
27
27
|
import Image from 'next/image';
|
|
28
|
+
import { ShippingApi } from '@/lib/Apis/apis/shipping-api';
|
|
29
|
+
import { AXIOS_CONFIG } from '@/lib/Apis/wrapper';
|
|
28
30
|
|
|
29
31
|
interface OrderDetailScreenProps {
|
|
30
32
|
id: string;
|
|
@@ -34,6 +36,25 @@ export function OrderDetailScreen({ id }: OrderDetailScreenProps) {
|
|
|
34
36
|
const router = useRouter();
|
|
35
37
|
const { buildPath } = useBasePath();
|
|
36
38
|
const { order, isLoading, error } = useOrder(id);
|
|
39
|
+
const [storeAddress, setStoreAddress] = useState<any>(null);
|
|
40
|
+
|
|
41
|
+
// Fetch store address for pickup orders
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (order && order.orderType !== 'Delivery' && !order.pickUpAddress) {
|
|
44
|
+
const fetchStoreAddress = async () => {
|
|
45
|
+
try {
|
|
46
|
+
const api = new ShippingApi(AXIOS_CONFIG);
|
|
47
|
+
const res = await api.getStoreAddress();
|
|
48
|
+
if (res.data) {
|
|
49
|
+
setStoreAddress(res.data);
|
|
50
|
+
}
|
|
51
|
+
} catch (e) {
|
|
52
|
+
console.error('Failed to fetch store address:', e);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
fetchStoreAddress();
|
|
56
|
+
}
|
|
57
|
+
}, [order]);
|
|
37
58
|
|
|
38
59
|
if (isLoading) {
|
|
39
60
|
return (
|
|
@@ -76,7 +97,7 @@ export function OrderDetailScreen({ id }: OrderDetailScreenProps) {
|
|
|
76
97
|
};
|
|
77
98
|
|
|
78
99
|
const shippingAddress = order.shippingInfo?.addressTo;
|
|
79
|
-
const pickupAddress = order.pickUpAddress;
|
|
100
|
+
const pickupAddress = order.pickUpAddress || storeAddress;
|
|
80
101
|
const activeAddress = isDelivery ? shippingAddress : pickupAddress;
|
|
81
102
|
|
|
82
103
|
return (
|
|
@@ -669,7 +669,7 @@ export function ProductDetailScreen({ productId }: ProductDetailScreenProps) {
|
|
|
669
669
|
</div>
|
|
670
670
|
|
|
671
671
|
{/* Benefits */}
|
|
672
|
-
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4 p-6 bg-linear-to-br from-
|
|
672
|
+
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4 p-6 bg-linear-to-br from-secondary/5 to-secondary/5 rounded-[24px]">
|
|
673
673
|
<div className="flex items-start gap-3">
|
|
674
674
|
<div className="size-10 rounded-full bg-white flex items-center justify-center shrink-0">
|
|
675
675
|
<Truck className="size-5 text-primary" />
|
|
@@ -296,7 +296,7 @@ export default function WishlistScreen() {
|
|
|
296
296
|
<button
|
|
297
297
|
type="button"
|
|
298
298
|
onClick={() => router.push(buildPath('/shop'))}
|
|
299
|
-
className="rounded-xl border-2 border-
|
|
299
|
+
className="rounded-xl border-2 border-secondary bg-secondary text-white px-6 py-3 text-sm font-medium transition-colors flex items-center justify-center gap-2 hover:opacity-80"
|
|
300
300
|
>
|
|
301
301
|
Discover products
|
|
302
302
|
</button>
|
package/src/styles/globals.css
CHANGED
|
@@ -127,12 +127,7 @@
|
|
|
127
127
|
|
|
128
128
|
@layer base {
|
|
129
129
|
:root {
|
|
130
|
-
|
|
131
|
-
--color-primary-dark: #4a8ac4;
|
|
132
|
-
--color-secondary: #2B4B7C;
|
|
133
|
-
--color-accent: #E67E50;
|
|
134
|
-
--color-accent-dark: #d66f45;
|
|
135
|
-
--color-text-muted: #676c80;
|
|
130
|
+
/* Base colors are set dynamically by ThemeProvider from EcommerceConfig */
|
|
136
131
|
}
|
|
137
132
|
|
|
138
133
|
* {
|