create-brainerce-store 1.51.0 → 1.52.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.
Files changed (173) hide show
  1. package/README.md +71 -0
  2. package/dist/index.js +24 -80
  3. package/messages/en.json +32 -0
  4. package/messages/he.json +32 -0
  5. package/package.json +1 -1
  6. package/templates/nextjs/base/.claude/commands/design.md +9 -0
  7. package/templates/nextjs/base/AI-GUIDE.md +52 -3
  8. package/templates/nextjs/base/CLAUDE.md +10 -0
  9. package/templates/nextjs/base/package.json.ejs +52 -39
  10. package/templates/nextjs/base/src/app/globals.css +36 -30
  11. package/templates/nextjs/base/src/components/checkout/payment-step.tsx +14 -10
  12. package/templates/nextjs/base/src/components/ui/accordion.tsx +53 -0
  13. package/templates/nextjs/base/src/components/ui/badge.tsx +32 -0
  14. package/templates/nextjs/base/src/components/ui/button.tsx +49 -0
  15. package/templates/nextjs/base/src/components/ui/card.tsx +55 -0
  16. package/templates/nextjs/base/src/components/ui/checkbox.tsx +28 -0
  17. package/templates/nextjs/base/src/components/ui/dialog.tsx +107 -0
  18. package/templates/nextjs/base/src/components/ui/input.tsx +22 -0
  19. package/templates/nextjs/base/src/components/ui/label.tsx +21 -0
  20. package/templates/nextjs/base/src/components/ui/radio-group.tsx +38 -0
  21. package/templates/nextjs/base/src/components/ui/select.tsx +153 -0
  22. package/templates/nextjs/base/src/components/ui/separator.tsx +26 -0
  23. package/templates/nextjs/base/src/components/ui/sheet.tsx +125 -0
  24. package/templates/nextjs/base/src/components/ui/skeleton.tsx +7 -0
  25. package/templates/nextjs/base/src/components/ui/tabs.tsx +55 -0
  26. package/templates/nextjs/base/src/components/ui/textarea.tsx +21 -0
  27. package/templates/nextjs/base/src/components/ui/tooltip.tsx +32 -0
  28. package/templates/nextjs/base/src/ui/cart/cart-bundle-offer.tsx +17 -11
  29. package/templates/nextjs/base/src/ui/cart/cart-item.tsx +2 -8
  30. package/templates/nextjs/base/src/ui/cart/cart-nudges.tsx +28 -39
  31. package/templates/nextjs/base/src/ui/cart/cart-summary.tsx +3 -1
  32. package/templates/nextjs/base/src/ui/cart/cart-upgrade-banner.tsx +8 -23
  33. package/templates/nextjs/base/src/ui/cart/cart-view.tsx +18 -27
  34. package/templates/nextjs/base/src/ui/cart/coupon-input.tsx +10 -21
  35. package/templates/nextjs/base/src/ui/cart/free-shipping-bar.tsx +2 -3
  36. package/templates/nextjs/base/src/ui/cart/reservation-countdown.tsx +95 -103
  37. package/templates/nextjs/base/src/ui/home/hero-section.tsx +4 -6
  38. package/templates/nextjs/base/src/ui/layout/announcement-bar.tsx.ejs +116 -125
  39. package/templates/nextjs/base/src/ui/layout/faq-section.tsx.ejs +90 -103
  40. package/templates/nextjs/base/src/ui/layout/header-account.tsx +2 -17
  41. package/templates/nextjs/base/src/ui/layout/language-switcher.tsx.ejs +80 -70
  42. package/templates/nextjs/base/src/ui/layout/site-footer.tsx.ejs +144 -164
  43. package/templates/nextjs/base/src/ui/layout/site-header.tsx.ejs +152 -182
  44. package/templates/nextjs/base/src/ui/product/customization-fields.tsx +456 -444
  45. package/templates/nextjs/base/src/ui/product/discount-badge.tsx +18 -22
  46. package/templates/nextjs/base/src/ui/product/frequently-bought-together.tsx +15 -27
  47. package/templates/nextjs/base/src/ui/product/modifier-group-selector.tsx +206 -175
  48. package/templates/nextjs/base/src/ui/product/price-display.tsx +3 -2
  49. package/templates/nextjs/base/src/ui/product/product-card.tsx +238 -271
  50. package/templates/nextjs/base/src/ui/product/product-client-section.tsx +455 -470
  51. package/templates/nextjs/base/src/ui/product/product-listing.tsx +96 -79
  52. package/templates/nextjs/base/src/ui/product/recommendation-section.tsx +102 -107
  53. package/templates/nextjs/base/src/ui/product/review-form.tsx +44 -43
  54. package/templates/nextjs/{designs/passepartout → base/src}/ui/product/reviews-section.tsx.ejs +108 -96
  55. package/templates/nextjs/base/src/ui/product/stock-badge.tsx +61 -63
  56. package/templates/nextjs/base/tailwind.config.ts +69 -42
  57. package/templates/nextjs/designs/{passepartout → atelier}/app-overlay/layout.tsx.ejs +23 -25
  58. package/templates/nextjs/designs/atelier/globals.css +396 -0
  59. package/templates/nextjs/designs/atelier/messages-patch/en.json +99 -0
  60. package/templates/nextjs/designs/atelier/messages-patch/he.json +99 -0
  61. package/templates/nextjs/designs/{passepartout → atelier}/ui/cart/cart-bundle-offer.tsx +110 -111
  62. package/templates/nextjs/designs/atelier/ui/cart/cart-drawer.tsx +163 -0
  63. package/templates/nextjs/designs/atelier/ui/cart/cart-item.tsx +140 -0
  64. package/templates/nextjs/designs/atelier/ui/cart/cart-nudges.tsx +34 -0
  65. package/templates/nextjs/designs/atelier/ui/cart/cart-summary.tsx +107 -0
  66. package/templates/nextjs/designs/{passepartout → atelier}/ui/cart/cart-upgrade-banner.tsx +123 -141
  67. package/templates/nextjs/designs/atelier/ui/cart/cart-view.tsx +147 -0
  68. package/templates/nextjs/designs/atelier/ui/cart/coupon-input.tsx +142 -0
  69. package/templates/nextjs/designs/{passepartout → atelier}/ui/cart/free-shipping-bar.tsx +77 -62
  70. package/templates/nextjs/designs/{passepartout → atelier}/ui/cart/reservation-countdown.tsx +89 -103
  71. package/templates/nextjs/designs/atelier/ui/home/benefits-band.tsx +34 -0
  72. package/templates/nextjs/designs/atelier/ui/home/category-tiles.tsx +148 -0
  73. package/templates/nextjs/designs/atelier/ui/home/discount-banner-strip.tsx +27 -0
  74. package/templates/nextjs/designs/atelier/ui/home/editorial-band.tsx +73 -0
  75. package/templates/nextjs/designs/atelier/ui/home/featured-products-section.tsx +36 -0
  76. package/templates/nextjs/designs/atelier/ui/home/hero-section.tsx +148 -0
  77. package/templates/nextjs/designs/atelier/ui/home/home-client.tsx +54 -0
  78. package/templates/nextjs/designs/atelier/ui/home/newsletter-section.tsx +78 -0
  79. package/templates/nextjs/designs/atelier/ui/home/testimonials-band.tsx +46 -0
  80. package/templates/nextjs/designs/atelier/ui/layout/announcement-bar.tsx +118 -0
  81. package/templates/nextjs/designs/atelier/ui/layout/faq-section.tsx +96 -0
  82. package/templates/nextjs/designs/atelier/ui/layout/header-account.tsx +36 -0
  83. package/templates/nextjs/designs/atelier/ui/layout/header-cart.tsx +36 -0
  84. package/templates/nextjs/designs/atelier/ui/layout/language-switcher.tsx.ejs +137 -0
  85. package/templates/nextjs/designs/atelier/ui/layout/nav-url.ts +14 -0
  86. package/templates/nextjs/designs/atelier/ui/layout/rich-text-block.tsx +34 -0
  87. package/templates/nextjs/designs/atelier/ui/layout/site-footer.tsx.ejs +141 -0
  88. package/templates/nextjs/designs/atelier/ui/layout/site-header.tsx.ejs +138 -0
  89. package/templates/nextjs/designs/atelier/ui/product/customization-fields.tsx +466 -0
  90. package/templates/nextjs/designs/{passepartout → atelier}/ui/product/discount-badge.tsx +17 -22
  91. package/templates/nextjs/designs/{passepartout → atelier}/ui/product/frequently-bought-together.tsx +196 -205
  92. package/templates/nextjs/designs/atelier/ui/product/modifier-group-selector.tsx +193 -0
  93. package/templates/nextjs/designs/atelier/ui/product/price-display.tsx +69 -0
  94. package/templates/nextjs/designs/atelier/ui/product/product-card.tsx +260 -0
  95. package/templates/nextjs/designs/atelier/ui/product/product-client-section.tsx +471 -0
  96. package/templates/nextjs/designs/atelier/ui/product/product-grid.tsx +47 -0
  97. package/templates/nextjs/designs/atelier/ui/product/product-listing.tsx +260 -0
  98. package/templates/nextjs/designs/atelier/ui/product/recommendation-section.tsx +95 -0
  99. package/templates/nextjs/designs/{passepartout → atelier}/ui/product/review-form.tsx +267 -294
  100. package/templates/nextjs/designs/atelier/ui/product/reviews-section.tsx.ejs +148 -0
  101. package/templates/nextjs/designs/atelier/ui/product/stock-badge.tsx +66 -0
  102. package/templates/nextjs/designs/atelier/ui/product/variant-selector.tsx +206 -0
  103. package/templates/nextjs/designs/atelier/ui/shared/cdn-image.tsx +29 -0
  104. package/templates/nextjs/designs/{passepartout → atelier}/ui/shared/fly-to-cart.ts +86 -85
  105. package/templates/nextjs/designs/atelier/ui/shared/icons.tsx +269 -0
  106. package/templates/nextjs/designs/atelier/ui/shared/loading-spinner.tsx +64 -0
  107. package/templates/nextjs/designs/atelier/ui/shared/reveal.tsx +71 -0
  108. package/templates/nextjs/designs/atelier/ui/shared/select-menu.tsx +125 -0
  109. package/templates/nextjs/ui-canvas/cart/cart-bundle-offer.tsx +2 -0
  110. package/templates/nextjs/ui-canvas/cart/cart-item.tsx +2 -0
  111. package/templates/nextjs/ui-canvas/cart/cart-nudges.tsx +2 -0
  112. package/templates/nextjs/ui-canvas/cart/cart-summary.tsx +2 -0
  113. package/templates/nextjs/ui-canvas/cart/cart-upgrade-banner.tsx +2 -0
  114. package/templates/nextjs/ui-canvas/cart/cart-view.tsx +2 -2
  115. package/templates/nextjs/ui-canvas/cart/coupon-input.tsx +2 -0
  116. package/templates/nextjs/ui-canvas/cart/free-shipping-bar.tsx +2 -0
  117. package/templates/nextjs/ui-canvas/cart/reservation-countdown.tsx +2 -0
  118. package/templates/nextjs/ui-canvas/home/discount-banner-strip.tsx +1 -1
  119. package/templates/nextjs/ui-canvas/home/featured-products-section.tsx +1 -1
  120. package/templates/nextjs/ui-canvas/home/hero-section.tsx +1 -1
  121. package/templates/nextjs/ui-canvas/home/home-client.tsx +1 -1
  122. package/templates/nextjs/ui-canvas/layout/announcement-bar.tsx.ejs +1 -1
  123. package/templates/nextjs/ui-canvas/layout/faq-section.tsx.ejs +2 -2
  124. package/templates/nextjs/ui-canvas/layout/header-account.tsx +1 -1
  125. package/templates/nextjs/ui-canvas/layout/language-switcher.tsx.ejs +2 -0
  126. package/templates/nextjs/ui-canvas/layout/rich-text-block.tsx.ejs +2 -0
  127. package/templates/nextjs/ui-canvas/layout/site-footer.tsx.ejs +2 -2
  128. package/templates/nextjs/ui-canvas/layout/site-header.tsx.ejs +2 -2
  129. package/templates/nextjs/ui-canvas/product/customization-fields.tsx +2 -0
  130. package/templates/nextjs/ui-canvas/product/discount-badge.tsx +2 -0
  131. package/templates/nextjs/ui-canvas/product/frequently-bought-together.tsx +2 -0
  132. package/templates/nextjs/ui-canvas/product/modifier-group-selector.tsx +2 -0
  133. package/templates/nextjs/ui-canvas/product/price-display.tsx +2 -0
  134. package/templates/nextjs/ui-canvas/product/product-card.tsx +1 -1
  135. package/templates/nextjs/ui-canvas/product/product-client-section.tsx +1 -1
  136. package/templates/nextjs/ui-canvas/product/product-grid.tsx +1 -1
  137. package/templates/nextjs/ui-canvas/product/product-listing.tsx +1 -1
  138. package/templates/nextjs/ui-canvas/product/recommendation-section.tsx +4 -0
  139. package/templates/nextjs/ui-canvas/product/review-form.tsx +29 -32
  140. package/templates/nextjs/ui-canvas/product/{reviews-section.tsx → reviews-section.tsx.ejs} +26 -8
  141. package/templates/nextjs/ui-canvas/product/stock-badge.tsx +2 -0
  142. package/templates/nextjs/ui-canvas/product/variant-selector.tsx +2 -0
  143. package/templates/nextjs/ui-canvas/shared/cdn-image.tsx +2 -0
  144. package/templates/nextjs/ui-canvas/shared/loading-spinner.tsx +2 -0
  145. package/templates/nextjs/base/src/ui/product/reviews-section.tsx +0 -85
  146. package/templates/nextjs/designs/passepartout/globals.css +0 -412
  147. package/templates/nextjs/designs/passepartout/messages-patch/en.json +0 -87
  148. package/templates/nextjs/designs/passepartout/messages-patch/he.json +0 -87
  149. package/templates/nextjs/designs/passepartout/ui/cart/cart-nudges.tsx +0 -39
  150. package/templates/nextjs/designs/passepartout/ui/cart/cart-view.tsx +0 -149
  151. package/templates/nextjs/designs/passepartout/ui/home/home-client.tsx +0 -401
  152. package/templates/nextjs/designs/passepartout/ui/layout/announcement-bar.tsx +0 -139
  153. package/templates/nextjs/designs/passepartout/ui/layout/cart-link.tsx +0 -45
  154. package/templates/nextjs/designs/passepartout/ui/layout/faq-section.tsx +0 -103
  155. package/templates/nextjs/designs/passepartout/ui/layout/site-footer.tsx +0 -159
  156. package/templates/nextjs/designs/passepartout/ui/layout/site-header.tsx.ejs +0 -155
  157. package/templates/nextjs/designs/passepartout/ui/layout/trust-icons.tsx +0 -60
  158. package/templates/nextjs/designs/passepartout/ui/layout/whatsapp-button.tsx +0 -34
  159. package/templates/nextjs/designs/passepartout/ui/product/price-display.tsx +0 -111
  160. package/templates/nextjs/designs/passepartout/ui/product/product-card.tsx +0 -265
  161. package/templates/nextjs/designs/passepartout/ui/product/product-client-section.tsx +0 -667
  162. package/templates/nextjs/designs/passepartout/ui/product/product-grid.tsx +0 -35
  163. package/templates/nextjs/designs/passepartout/ui/product/product-listing.tsx +0 -427
  164. package/templates/nextjs/designs/passepartout/ui/product/recommendation-section.tsx +0 -113
  165. package/templates/nextjs/designs/passepartout/ui/product/stock-badge.tsx +0 -52
  166. package/templates/nextjs/designs/passepartout/ui/product/variant-selector.tsx +0 -307
  167. package/templates/nextjs/designs/passepartout/ui/shared/loading-spinner.tsx +0 -33
  168. package/templates/nextjs/themes/luxury/globals.css +0 -399
  169. package/templates/nextjs/themes/luxury/theme.json +0 -23
  170. package/templates/nextjs/themes/minimal/globals.css +0 -30
  171. package/templates/nextjs/themes/minimal/theme.json +0 -23
  172. package/templates/nextjs/themes/playful/globals.css +0 -400
  173. package/templates/nextjs/themes/playful/theme.json +0 -23
@@ -1,667 +0,0 @@
1
- 'use client';
2
-
3
- import { useEffect, useRef, useState } from 'react';
4
- import { CdnImage as Image } from '@/ui/shared/cdn-image';
5
- import type { Product, ProductMetafield, DownloadFile } from 'brainerce';
6
- import { useProductPage } from '@/core/hooks/use-product-page';
7
- import { PriceDisplay } from '@/ui/product/price-display';
8
- import { LoadingSpinner } from '@/ui/shared/loading-spinner';
9
- import { VariantSelector } from '@/ui/product/variant-selector';
10
- import { StockBadge } from '@/ui/product/stock-badge';
11
- import { RecommendationSection } from '@/ui/product/recommendation-section';
12
- import { FrequentlyBoughtTogether } from '@/ui/product/frequently-bought-together';
13
- import { CustomizationFields } from '@/ui/product/customization-fields';
14
- import { ModifierGroupSelector } from '@/ui/product/modifier-group-selector';
15
- import { useTranslations } from '@/core/lib/translations';
16
- import { cn } from '@/core/lib/utils';
17
- import { sanitizeProductHtml } from '@/core/lib/sanitize-html';
18
- import { flyToCart, firstVisible } from '@/ui/shared/fly-to-cart';
19
-
20
- /** Render a metafield value based on its type */
21
- function MetafieldValue({ field }: { field: ProductMetafield }) {
22
- const tc = useTranslations('common');
23
- switch (field.type) {
24
- case 'IMAGE': {
25
- if (!field.value) return <span className="text-muted-foreground">-</span>;
26
- return (
27
- <img
28
- src={field.value}
29
- alt={field.definitionName}
30
- className="h-16 w-16 rounded object-cover"
31
- />
32
- );
33
- }
34
- case 'GALLERY': {
35
- let urls: string[] = [];
36
- try {
37
- const parsed = JSON.parse(field.value);
38
- urls = Array.isArray(parsed)
39
- ? parsed.filter((u: unknown) => typeof u === 'string' && u)
40
- : [];
41
- } catch {
42
- urls = field.value ? [field.value] : [];
43
- }
44
- if (urls.length === 0) return <span className="text-muted-foreground">-</span>;
45
- return (
46
- <div className="flex flex-wrap gap-2">
47
- {urls.map((url, i) => (
48
- <img
49
- key={i}
50
- src={url}
51
- alt={`${field.definitionName} ${i + 1}`}
52
- className="h-16 w-16 rounded object-cover"
53
- />
54
- ))}
55
- </div>
56
- );
57
- }
58
- case 'URL':
59
- return field.value ? (
60
- <a
61
- href={field.value}
62
- target="_blank"
63
- rel="noopener noreferrer"
64
- className="text-primary break-all hover:underline"
65
- >
66
- {field.value}
67
- </a>
68
- ) : (
69
- <span className="text-muted-foreground">-</span>
70
- );
71
- case 'COLOR':
72
- return field.value ? (
73
- <span className="inline-flex items-center gap-2">
74
- <span
75
- className="border-border inline-block h-4 w-4 rounded-full border"
76
- style={{ backgroundColor: field.value }}
77
- />
78
- {field.value}
79
- </span>
80
- ) : (
81
- <span className="text-muted-foreground">-</span>
82
- );
83
- case 'BOOLEAN':
84
- return <span>{field.value === 'true' ? tc('yes') : tc('no')}</span>;
85
- case 'DATE':
86
- case 'DATETIME': {
87
- if (!field.value) return <span className="text-muted-foreground">-</span>;
88
- try {
89
- const date = new Date(field.value);
90
- return (
91
- <span>
92
- {field.type === 'DATETIME' ? date.toLocaleString() : date.toLocaleDateString()}
93
- </span>
94
- );
95
- } catch {
96
- return <span>{field.value}</span>;
97
- }
98
- }
99
- default:
100
- return <span>{field.value || '-'}</span>;
101
- }
102
- }
103
-
104
- interface ProductClientSectionProps {
105
- product: Product;
106
- }
107
-
108
- export function ProductClientSection({ product: initialProduct }: ProductClientSectionProps) {
109
- const t = useTranslations('productDetail');
110
-
111
- const {
112
- product,
113
- recommendations,
114
- images,
115
- selectedImageIndex,
116
- setSelectedImageIndex,
117
- mainImageUrl,
118
- selectedVariant,
119
- setSelectedVariant,
120
- priceInfo,
121
- inventory,
122
- canPurchase,
123
- description,
124
- quantity,
125
- setQuantity,
126
- addingToCart,
127
- addedMessage,
128
- handleAddToCart,
129
- customizationFields,
130
- customizationValues,
131
- setCustomizationValues,
132
- customizationErrors,
133
- modifierGroups,
134
- modifierSelections,
135
- setModifierSelection,
136
- modifierError,
137
- } = useProductPage(initialProduct);
138
-
139
- // Presentation-only flourish: the product photo lifts off and drifts into
140
- // the header cart before the (core-owned) add-to-cart flow runs.
141
- function handleBuyClick() {
142
- if (!addingToCart && canPurchase) {
143
- flyToCart(firstVisible('[data-pdp-image]'));
144
- }
145
- void handleAddToCart();
146
- }
147
-
148
- // Mobile sticky buy bar — appears once the in-flow add-to-cart scrolls
149
- // above the viewport, so purchase stays one thumb away.
150
- const buyButtonRef = useRef<HTMLButtonElement | null>(null);
151
- const [showStickyBar, setShowStickyBar] = useState(false);
152
- useEffect(() => {
153
- const el = buyButtonRef.current;
154
- if (!el || typeof IntersectionObserver === 'undefined') return;
155
- const observer = new IntersectionObserver(
156
- ([entry]) => setShowStickyBar(!entry.isIntersecting && entry.boundingClientRect.top < 0),
157
- { threshold: 0 }
158
- );
159
- observer.observe(el);
160
- return () => observer.disconnect();
161
- }, []);
162
-
163
- return (
164
- <div className="mx-auto max-w-7xl px-4 py-8 sm:px-6 lg:px-8 lg:py-14">
165
- <div className="grid grid-cols-1 gap-8 lg:grid-cols-12 lg:gap-10">
166
- {/* Gallery — works hung one under the other, each in its own frame */}
167
- <div className="lg:order-2 lg:col-span-7">
168
- {/* Main frame (mobile + variant-aware) */}
169
- <div className="lg:hidden">
170
- <div
171
- data-pdp-image
172
- className="bg-surface border-border hung relative aspect-square overflow-hidden border"
173
- >
174
- {mainImageUrl ? (
175
- <Image
176
- src={mainImageUrl}
177
- alt={product.name}
178
- fill
179
- sizes="100vw"
180
- className="object-contain"
181
- priority
182
- />
183
- ) : (
184
- <div className="text-muted-foreground absolute inset-0 flex items-center justify-center">
185
- <svg className="h-24 w-24" fill="none" viewBox="0 0 24 24" stroke="currentColor">
186
- <path
187
- strokeLinecap="round"
188
- strokeLinejoin="round"
189
- strokeWidth={1}
190
- d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"
191
- />
192
- </svg>
193
- </div>
194
- )}
195
- </div>
196
-
197
- {/* Thumbnails — small hairline frames */}
198
- {images.length > 1 && (
199
- <div className="mt-4 flex gap-2 overflow-x-auto pb-2">
200
- {images.map((img, idx) => (
201
- <button
202
- key={idx}
203
- type="button"
204
- onClick={() => setSelectedImageIndex(idx)}
205
- className={cn(
206
- 'bg-surface relative h-16 w-16 flex-shrink-0 overflow-hidden border transition-colors',
207
- selectedImageIndex === idx
208
- ? 'border-foreground'
209
- : 'border-border hover:border-muted-foreground'
210
- )}
211
- >
212
- <Image
213
- src={img.url}
214
- alt={img.alt || `${product.name} ${idx + 1}`}
215
- fill
216
- sizes="64px"
217
- className="object-cover"
218
- />
219
- </button>
220
- ))}
221
- </div>
222
- )}
223
- </div>
224
-
225
- {/* Desktop — the museum hang: every image framed, numbered, stacked */}
226
- <div className="hidden space-y-6 lg:block">
227
- {selectedImageIndex === -1 && mainImageUrl ? (
228
- <figure>
229
- <div className="bg-surface border-border relative aspect-[4/5] overflow-hidden border">
230
- <Image
231
- src={mainImageUrl}
232
- alt={product.name}
233
- fill
234
- sizes="(max-width: 1024px) 100vw, 58vw"
235
- className="object-contain"
236
- priority
237
- />
238
- </div>
239
- </figure>
240
- ) : null}
241
- {images.length > 0 ? (
242
- images.map((img, idx) => (
243
- <figure key={idx}>
244
- <div
245
- data-pdp-image
246
- className="bg-surface border-border hung relative aspect-[4/5] overflow-hidden border"
247
- >
248
- <Image
249
- src={img.url}
250
- alt={img.alt || `${product.name} ${idx + 1}`}
251
- fill
252
- sizes="(max-width: 1024px) 100vw, 58vw"
253
- className="object-contain"
254
- priority={idx === 0}
255
- />
256
- </div>
257
- {images.length > 1 && (
258
- <figcaption className="text-muted-foreground tabular mt-2 text-[0.6875rem] tracking-[0.08em]">
259
- {idx + 1} / {images.length}
260
- </figcaption>
261
- )}
262
- </figure>
263
- ))
264
- ) : (
265
- <div className="bg-surface border-border relative aspect-[4/5] overflow-hidden border">
266
- <div className="text-muted-foreground absolute inset-0 flex items-center justify-center">
267
- <svg className="h-24 w-24" fill="none" viewBox="0 0 24 24" stroke="currentColor">
268
- <path
269
- strokeLinecap="round"
270
- strokeLinejoin="round"
271
- strokeWidth={1}
272
- d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"
273
- />
274
- </svg>
275
- </div>
276
- </div>
277
- )}
278
- </div>
279
- </div>
280
-
281
- {/* The placard wall — buy column, sticky on desktop */}
282
- <div className="space-y-6 lg:order-1 lg:col-span-5 lg:sticky lg:top-24 lg:self-start">
283
- {/* Category placard */}
284
- {product.categories && product.categories.length > 0 && (
285
- <p className="placard">{product.categories.map((cat) => cat.name).join(' · ')}</p>
286
- )}
287
-
288
- {/* Brand */}
289
- {(product as { brands?: Array<{ id: string; name: string }> }).brands &&
290
- (product as { brands: Array<{ id: string; name: string }> }).brands.length > 0 && (
291
- <div className="placard">
292
- {t('by')}{' '}
293
- {(product as { brands: Array<{ id: string; name: string }> }).brands
294
- .map((b) => b.name)
295
- .join(', ')}
296
- </div>
297
- )}
298
-
299
- {/* Title */}
300
- <h1 className="text-foreground font-serif text-[clamp(1.5rem,4vw,2.25rem)] font-light leading-[1.25]">
301
- {product.name}
302
- </h1>
303
-
304
- {/* Catalog line — the museum touch */}
305
- {(selectedVariant?.sku || product.sku) && (
306
- <p className="text-muted-foreground tabular text-[0.6875rem] tracking-[0.08em]">
307
- {t('itemNo').replace('{sku}', String(selectedVariant?.sku || product.sku))}
308
- </p>
309
- )}
310
-
311
- <div className="brass-rule w-16" />
312
-
313
- {/* Tags — quiet captions */}
314
- {(product as unknown as { tags?: Array<{ id: string; name: string }> }).tags &&
315
- (product as unknown as { tags: Array<{ id: string; name: string }> }).tags.length >
316
- 0 && (
317
- <div className="flex flex-wrap gap-x-3 gap-y-1">
318
- {(product as unknown as { tags: Array<{ id: string; name: string }> }).tags.map(
319
- (tag) => (
320
- <span
321
- key={tag.id}
322
- className="text-muted-foreground text-[0.6875rem] tracking-[0.08em]"
323
- >
324
- {tag.name}
325
- </span>
326
- )
327
- )}
328
- </div>
329
- )}
330
-
331
- {/* Price */}
332
- <div>
333
- <PriceDisplay
334
- price={priceInfo.originalPrice}
335
- salePrice={priceInfo.isOnSale ? priceInfo.price : undefined}
336
- size="lg"
337
- />
338
- <p className="text-muted-foreground tabular mt-1.5 text-[0.6875rem] tracking-[0.08em]">
339
- {t('installments')}
340
- </p>
341
- </div>
342
-
343
- {/* Stock / Digital note — placard captions */}
344
- {product.isDownloadable ? (
345
- <span className="text-muted-foreground inline-flex items-center gap-1.5 text-[0.6875rem] tracking-[0.08em]">
346
- <svg
347
- className="text-accent h-3.5 w-3.5"
348
- fill="none"
349
- viewBox="0 0 24 24"
350
- stroke="currentColor"
351
- >
352
- <path
353
- strokeLinecap="round"
354
- strokeLinejoin="round"
355
- strokeWidth={1.5}
356
- d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"
357
- />
358
- </svg>
359
- {t('instantDownload')}
360
- </span>
361
- ) : (
362
- <>
363
- <StockBadge inventory={inventory} lowStockThreshold={5} />
364
- {inventory?.inStock &&
365
- (inventory.trackingMode !== 'TRACKED' || inventory.available > 5) && (
366
- <span className="text-muted-foreground text-[0.6875rem] tracking-[0.08em]">
367
- {t('inStockShip')}
368
- </span>
369
- )}
370
- </>
371
- )}
372
-
373
- {/* Downloadable files info */}
374
- {product.isDownloadable && product.downloads && product.downloads.length > 0 && (
375
- <div className="bg-surface border-border border p-4">
376
- <p className="text-foreground mb-2 text-sm font-medium">
377
- {t('filesIncluded')} ({product.downloads.length})
378
- </p>
379
- <ul className="space-y-1.5">
380
- {product.downloads.map((file: DownloadFile) => (
381
- <li
382
- key={file.id}
383
- className="text-muted-foreground flex items-center gap-2 text-sm"
384
- >
385
- <svg
386
- className="h-4 w-4 flex-shrink-0"
387
- fill="none"
388
- viewBox="0 0 24 24"
389
- stroke="currentColor"
390
- >
391
- <path
392
- strokeLinecap="round"
393
- strokeLinejoin="round"
394
- strokeWidth={1.5}
395
- d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"
396
- />
397
- </svg>
398
- <span className="truncate">{file.name}</span>
399
- {file.size && (
400
- <span className="flex-shrink-0 text-xs">
401
- (
402
- {file.size < 1024 * 1024
403
- ? `${(file.size / 1024).toFixed(0)} KB`
404
- : `${(file.size / (1024 * 1024)).toFixed(1)} MB`}
405
- )
406
- </span>
407
- )}
408
- </li>
409
- ))}
410
- </ul>
411
- </div>
412
- )}
413
-
414
- {/* Variant Selector */}
415
- {product.type === 'VARIABLE' && product.variants && product.variants.length > 0 && (
416
- <VariantSelector
417
- product={product}
418
- selectedVariant={selectedVariant}
419
- onVariantChange={setSelectedVariant}
420
- />
421
- )}
422
-
423
- {/* The gift panel — personalization framed as the ritual it is */}
424
- {(customizationFields.length > 0 || modifierGroups.length > 0) && (
425
- <div className="border-border space-y-4 border p-4">
426
- <p className="placard">{t('giftPanel')}</p>
427
-
428
- {customizationFields.length > 0 && (
429
- <CustomizationFields
430
- fields={customizationFields}
431
- values={customizationValues}
432
- onChange={setCustomizationValues}
433
- errors={customizationErrors}
434
- />
435
- )}
436
-
437
- {modifierGroups.length > 0 && (
438
- <div className="space-y-4">
439
- {modifierGroups.map((group) => (
440
- <ModifierGroupSelector
441
- key={group.attachmentId ?? group.id}
442
- group={group}
443
- value={modifierSelections[group.id] ?? []}
444
- onChange={(next) => setModifierSelection(group.id, next)}
445
- disabled={addingToCart}
446
- />
447
- ))}
448
- {modifierError && (
449
- <p className="text-destructive text-sm" role="alert">
450
- {modifierError}
451
- </p>
452
- )}
453
- </div>
454
- )}
455
- </div>
456
- )}
457
-
458
- {/* Quantity + Add to Cart */}
459
- <div className="space-y-3">
460
- <div className="border-border inline-flex items-center border">
461
- <button
462
- type="button"
463
- onClick={() => setQuantity((q) => Math.max(1, q - 1))}
464
- className="text-foreground active:bg-muted hover:bg-muted px-4 py-2.5 transition-colors"
465
- aria-label={t('decreaseQuantity')}
466
- >
467
-
468
- </button>
469
- <span className="text-foreground tabular min-w-[3rem] px-4 py-2.5 text-center text-sm">
470
- {quantity}
471
- </span>
472
- <button
473
- type="button"
474
- onClick={() => setQuantity((q) => q + 1)}
475
- className="text-foreground active:bg-muted hover:bg-muted px-4 py-2.5 transition-colors"
476
- aria-label={t('increaseQuantity')}
477
- >
478
- +
479
- </button>
480
- </div>
481
-
482
- <button
483
- ref={buyButtonRef}
484
- type="button"
485
- onClick={handleBuyClick}
486
- disabled={!canPurchase || addingToCart}
487
- className={cn(
488
- 'w-full px-6 py-4 text-[0.8125rem] font-semibold transition-colors',
489
- canPurchase
490
- ? 'bg-primary text-primary-foreground'
491
- : 'bg-muted text-muted-foreground cursor-not-allowed'
492
- )}
493
- >
494
- {addingToCart ? (
495
- <span className="inline-flex items-center gap-2">
496
- <LoadingSpinner size="sm" className="bg-primary-foreground" />
497
- {t('addingToCart')}
498
- </span>
499
- ) : addedMessage ? (
500
- t('addedToCart')
501
- ) : !canPurchase ? (
502
- t('outOfStock')
503
- ) : (
504
- t('addToCart')
505
- )}
506
- </button>
507
-
508
- {/* Trust line — quiet purchase confidence */}
509
- <p className="text-muted-foreground text-center text-[0.6875rem] tracking-[0.08em]">
510
- {t('trustLine')}
511
- </p>
512
- </div>
513
-
514
- {/* Download after purchase note */}
515
- {product.isDownloadable && (
516
- <p className="text-muted-foreground text-[0.6875rem] tracking-[0.08em]">
517
- {t('downloadAfterPurchase')}
518
- </p>
519
- )}
520
-
521
- {/* Below the fold — the placard accordion stack (Details / Specs /
522
- Shipping / Care), keeping the buy box tight above the fold */}
523
- <div className="border-border border-t">
524
- {description && (
525
- <details open className="group/acc border-border border-b">
526
- <summary className="flex cursor-pointer list-none items-center justify-between py-4 [&::-webkit-details-marker]:hidden">
527
- <span className="placard font-sans">{t('aboutWork')}</span>
528
- <span aria-hidden="true" className="text-accent text-base leading-none">
529
- <span className="group-open/acc:hidden">+</span>
530
- <span className="hidden group-open/acc:inline">−</span>
531
- </span>
532
- </summary>
533
- <div className="pb-6">
534
- {'html' in description ? (
535
- <div
536
- className="text-foreground/80 max-w-prose font-serif text-[1.0625rem] leading-[1.9]"
537
- dangerouslySetInnerHTML={{ __html: sanitizeProductHtml(description.html) }}
538
- />
539
- ) : (
540
- <p className="text-foreground/80 max-w-prose whitespace-pre-wrap font-serif text-[1.0625rem] leading-[1.9]">
541
- {description.text}
542
- </p>
543
- )}
544
- </div>
545
- </details>
546
- )}
547
-
548
- {product.metafields && product.metafields.length > 0 && (
549
- <details className="group/acc border-border border-b">
550
- <summary className="flex cursor-pointer list-none items-center justify-between py-4 [&::-webkit-details-marker]:hidden">
551
- <span className="placard font-sans">{t('specifications')}</span>
552
- <span aria-hidden="true" className="text-accent text-base leading-none">
553
- <span className="group-open/acc:hidden">+</span>
554
- <span className="hidden group-open/acc:inline">−</span>
555
- </span>
556
- </summary>
557
- <div className="pb-6">
558
- <table className="w-full">
559
- <tbody>
560
- {product.metafields.map((field) => (
561
- <tr key={field.id} className="border-border border-b last:border-0">
562
- <td className="text-muted-foreground whitespace-nowrap py-3 pe-4 text-[0.6875rem] tracking-[0.08em]">
563
- {field.definitionName}
564
- </td>
565
- <td className="text-foreground py-3 text-end text-sm">
566
- <MetafieldValue field={field} />
567
- </td>
568
- </tr>
569
- ))}
570
- </tbody>
571
- </table>
572
- </div>
573
- </details>
574
- )}
575
-
576
- <details className="group/acc border-border border-b">
577
- <summary className="flex cursor-pointer list-none items-center justify-between py-4 [&::-webkit-details-marker]:hidden">
578
- <span className="placard font-sans">{t('shippingReturnsTitle')}</span>
579
- <span aria-hidden="true" className="text-accent text-base leading-none">
580
- <span className="group-open/acc:hidden">+</span>
581
- <span className="hidden group-open/acc:inline">−</span>
582
- </span>
583
- </summary>
584
- <p className="text-foreground/75 max-w-prose pb-6 text-sm leading-[1.9]">
585
- {t('shippingReturnsBody')}
586
- </p>
587
- </details>
588
-
589
- <details className="group/acc border-border border-b">
590
- <summary className="flex cursor-pointer list-none items-center justify-between py-4 [&::-webkit-details-marker]:hidden">
591
- <span className="placard font-sans">{t('careWarrantyTitle')}</span>
592
- <span aria-hidden="true" className="text-accent text-base leading-none">
593
- <span className="group-open/acc:hidden">+</span>
594
- <span className="hidden group-open/acc:inline">−</span>
595
- </span>
596
- </summary>
597
- <p className="text-foreground/75 max-w-prose pb-6 text-sm leading-[1.9]">
598
- {t('careWarrantyBody')}
599
- </p>
600
- </details>
601
- </div>
602
- </div>
603
- </div>
604
-
605
- {/* Mobile sticky buy bar — price at the start, ink button at the end */}
606
- {showStickyBar && (
607
- <div className="bg-background/95 border-border fixed inset-x-0 bottom-0 z-40 border-t pb-[env(safe-area-inset-bottom)] backdrop-blur lg:hidden">
608
- <div className="flex items-center justify-between gap-4 px-4 py-3">
609
- <PriceDisplay
610
- price={priceInfo.originalPrice}
611
- salePrice={priceInfo.isOnSale ? priceInfo.price : undefined}
612
- size="md"
613
- />
614
- <button
615
- type="button"
616
- onClick={handleBuyClick}
617
- disabled={!canPurchase || addingToCart}
618
- className={cn(
619
- 'px-6 py-3 text-xs font-semibold transition-colors',
620
- canPurchase
621
- ? 'bg-primary text-primary-foreground'
622
- : 'bg-muted text-muted-foreground cursor-not-allowed'
623
- )}
624
- >
625
- {addingToCart
626
- ? t('addingToCart')
627
- : addedMessage
628
- ? t('addedToCart')
629
- : !canPurchase
630
- ? t('outOfStock')
631
- : t('addToCart')}
632
- </button>
633
- </div>
634
- </div>
635
- )}
636
-
637
- {/* Frequently Bought Together (cross-sells) */}
638
- {recommendations?.crossSells && recommendations.crossSells.length > 0 && (
639
- <FrequentlyBoughtTogether
640
- items={recommendations.crossSells}
641
- currentProduct={product}
642
- className="mt-12"
643
- />
644
- )}
645
-
646
- {/* Upsells */}
647
- {recommendations?.upsells && recommendations.upsells.length > 0 && (
648
- <RecommendationSection
649
- title={t('upgradeYourChoice')}
650
- kicker={t('upsellsKicker')}
651
- items={recommendations.upsells}
652
- className="mt-16"
653
- />
654
- )}
655
-
656
- {/* Related products */}
657
- {recommendations?.related && recommendations.related.length > 0 && (
658
- <RecommendationSection
659
- title={t('similarProducts')}
660
- kicker={t('relatedKicker')}
661
- items={recommendations.related}
662
- className="mt-16"
663
- />
664
- )}
665
- </div>
666
- );
667
- }