@doswiftly/cli 0.1.19 → 0.1.21
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/commands/deploy.d.ts +20 -0
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +225 -6
- package/dist/commands/deploy.js.map +1 -1
- package/package.json +4 -4
- package/templates/storefront-minimal/.github/workflows/build-template.yml +10 -0
- package/templates/storefront-minimal/wrangler.toml +11 -0
- package/templates/storefront-nextjs/.github/workflows/build-template.yml +10 -0
- package/templates/storefront-nextjs/wrangler.toml +11 -0
- package/templates/storefront-nextjs-shadcn/.github/workflows/build-template.yml +10 -0
- package/templates/storefront-nextjs-shadcn/CLAUDE.md +29 -5
- package/templates/storefront-nextjs-shadcn/app/{about → [locale]/about}/page.tsx +17 -14
- package/templates/storefront-nextjs-shadcn/app/{account → [locale]/account}/addresses/page.tsx +19 -15
- package/templates/storefront-nextjs-shadcn/app/{account → [locale]/account}/error.tsx +8 -5
- package/templates/storefront-nextjs-shadcn/app/{account → [locale]/account}/loyalty/page.tsx +39 -34
- package/templates/storefront-nextjs-shadcn/app/{account → [locale]/account}/orders/[id]/page.tsx +9 -7
- package/templates/storefront-nextjs-shadcn/app/{account → [locale]/account}/orders/[id]/tracking/page.tsx +27 -25
- package/templates/storefront-nextjs-shadcn/app/{account → [locale]/account}/orders/page.tsx +13 -9
- package/templates/storefront-nextjs-shadcn/app/{account → [locale]/account}/page.tsx +1 -2
- package/templates/storefront-nextjs-shadcn/app/{account → [locale]/account}/settings/page.tsx +1 -1
- package/templates/storefront-nextjs-shadcn/app/{auth → [locale]/auth}/forgot-password/page.tsx +14 -12
- package/templates/storefront-nextjs-shadcn/app/{auth → [locale]/auth}/login/page.tsx +5 -2
- package/templates/storefront-nextjs-shadcn/app/{auth → [locale]/auth}/register/page.tsx +5 -2
- package/templates/storefront-nextjs-shadcn/app/{blog → [locale]/blog}/[slug]/page.tsx +1 -1
- package/templates/storefront-nextjs-shadcn/app/{cart → [locale]/cart}/page.tsx +14 -10
- package/templates/storefront-nextjs-shadcn/app/{categories → [locale]/categories}/[slug]/category-products-client.tsx +4 -2
- package/templates/storefront-nextjs-shadcn/app/{categories → [locale]/categories}/page.tsx +13 -8
- package/templates/storefront-nextjs-shadcn/app/{checkout → [locale]/checkout}/error.tsx +1 -1
- package/templates/storefront-nextjs-shadcn/app/{checkout → [locale]/checkout}/page.tsx +228 -184
- package/templates/storefront-nextjs-shadcn/app/{checkout → [locale]/checkout}/success/[orderId]/page.tsx +36 -34
- package/templates/storefront-nextjs-shadcn/app/{collections → [locale]/collections}/[handle]/page.tsx +5 -3
- package/templates/storefront-nextjs-shadcn/app/{collections → [locale]/collections}/page.tsx +13 -8
- package/templates/storefront-nextjs-shadcn/app/{contact → [locale]/contact}/page.tsx +24 -21
- package/templates/storefront-nextjs-shadcn/app/{error.tsx → [locale]/error.tsx} +13 -8
- package/templates/storefront-nextjs-shadcn/app/[locale]/layout.tsx +92 -0
- package/templates/storefront-nextjs-shadcn/app/{not-found.tsx → [locale]/not-found.tsx} +13 -18
- package/templates/storefront-nextjs-shadcn/app/{page.tsx → [locale]/page.tsx} +8 -4
- package/templates/storefront-nextjs-shadcn/app/{products → [locale]/products}/[slug]/error.tsx +1 -1
- package/templates/storefront-nextjs-shadcn/app/{products → [locale]/products}/[slug]/page.tsx +11 -8
- package/templates/storefront-nextjs-shadcn/app/{products → [locale]/products}/[slug]/product-client.tsx +3 -1
- package/templates/storefront-nextjs-shadcn/app/{products → [locale]/products}/page.tsx +6 -3
- package/templates/storefront-nextjs-shadcn/app/{products → [locale]/products}/products-client.tsx +14 -10
- package/templates/storefront-nextjs-shadcn/app/{wishlist → [locale]/wishlist}/page.tsx +21 -25
- package/templates/storefront-nextjs-shadcn/app/layout.tsx +6 -68
- package/templates/storefront-nextjs-shadcn/components/account/address-form.tsx +25 -20
- package/templates/storefront-nextjs-shadcn/components/account/address-list.tsx +11 -10
- package/templates/storefront-nextjs-shadcn/components/account/order-details.tsx +14 -12
- package/templates/storefront-nextjs-shadcn/components/account/order-history.tsx +28 -18
- package/templates/storefront-nextjs-shadcn/components/auth/account-menu.tsx +10 -8
- package/templates/storefront-nextjs-shadcn/components/auth/login-form.tsx +27 -22
- package/templates/storefront-nextjs-shadcn/components/auth/register-form.tsx +48 -43
- package/templates/storefront-nextjs-shadcn/components/blog/blog-card.tsx +1 -1
- package/templates/storefront-nextjs-shadcn/components/blog/blog-sidebar.tsx +1 -1
- package/templates/storefront-nextjs-shadcn/components/brand/brand-card.tsx +1 -1
- package/templates/storefront-nextjs-shadcn/components/cart/cart-drawer.tsx +7 -4
- package/templates/storefront-nextjs-shadcn/components/cart/cart-icon.tsx +1 -1
- package/templates/storefront-nextjs-shadcn/components/cart/cart-item.tsx +7 -5
- package/templates/storefront-nextjs-shadcn/components/cart/cart-summary.tsx +9 -7
- package/templates/storefront-nextjs-shadcn/components/cart/promo-code-input.tsx +8 -5
- package/templates/storefront-nextjs-shadcn/components/cart/shipping-estimator.tsx +18 -15
- package/templates/storefront-nextjs-shadcn/components/checkout/payment-method-card.tsx +15 -25
- package/templates/storefront-nextjs-shadcn/components/checkout/payment-step.tsx +10 -8
- package/templates/storefront-nextjs-shadcn/components/checkout/tax-breakdown.tsx +9 -6
- package/templates/storefront-nextjs-shadcn/components/commerce/currency-selector.tsx +5 -3
- package/templates/storefront-nextjs-shadcn/components/commerce/pagination.tsx +8 -5
- package/templates/storefront-nextjs-shadcn/components/commerce/product-actions.tsx +5 -3
- package/templates/storefront-nextjs-shadcn/components/commerce/search-input.tsx +8 -7
- package/templates/storefront-nextjs-shadcn/components/common/category-card.tsx +1 -1
- package/templates/storefront-nextjs-shadcn/components/common/collection-card.tsx +1 -1
- package/templates/storefront-nextjs-shadcn/components/common/social-share.tsx +9 -6
- package/templates/storefront-nextjs-shadcn/components/discount/discount-breakdown.tsx +21 -11
- package/templates/storefront-nextjs-shadcn/components/discount/discount-code-input.tsx +16 -13
- package/templates/storefront-nextjs-shadcn/components/error/error-boundary.tsx +53 -28
- package/templates/storefront-nextjs-shadcn/components/filters/dynamic-attribute-filters.tsx +7 -5
- package/templates/storefront-nextjs-shadcn/components/gift-card/gift-card-balance.tsx +19 -15
- package/templates/storefront-nextjs-shadcn/components/gift-card/gift-card-input.tsx +12 -9
- package/templates/storefront-nextjs-shadcn/components/home/category-grid.tsx +8 -5
- package/templates/storefront-nextjs-shadcn/components/home/featured-collections.tsx +1 -1
- package/templates/storefront-nextjs-shadcn/components/home/featured-products.tsx +12 -8
- package/templates/storefront-nextjs-shadcn/components/home/hero-section.tsx +13 -8
- package/templates/storefront-nextjs-shadcn/components/home/newsletter-signup.tsx +10 -8
- package/templates/storefront-nextjs-shadcn/components/layout/breadcrumbs.tsx +37 -12
- package/templates/storefront-nextjs-shadcn/components/layout/currency-selector.tsx +5 -2
- package/templates/storefront-nextjs-shadcn/components/layout/footer.tsx +24 -23
- package/templates/storefront-nextjs-shadcn/components/layout/header.tsx +20 -12
- package/templates/storefront-nextjs-shadcn/components/layout/language-switcher.tsx +54 -0
- package/templates/storefront-nextjs-shadcn/components/layout/mobile-menu.tsx +33 -30
- package/templates/storefront-nextjs-shadcn/components/layout/navigation.tsx +27 -24
- package/templates/storefront-nextjs-shadcn/components/loyalty/referral-section.tsx +23 -24
- package/templates/storefront-nextjs-shadcn/components/product/add-to-cart-button.tsx +6 -14
- package/templates/storefront-nextjs-shadcn/components/product/b2b-price-display.tsx +1 -1
- package/templates/storefront-nextjs-shadcn/components/product/filter-active-pills.tsx +4 -1
- package/templates/storefront-nextjs-shadcn/components/product/filter-mobile-sheet.tsx +7 -4
- package/templates/storefront-nextjs-shadcn/components/product/filter-price-range.tsx +5 -3
- package/templates/storefront-nextjs-shadcn/components/product/product-card.tsx +8 -6
- package/templates/storefront-nextjs-shadcn/components/product/product-filters.tsx +3 -1
- package/templates/storefront-nextjs-shadcn/components/product/product-image.tsx +3 -7
- package/templates/storefront-nextjs-shadcn/components/product/product-sort.tsx +26 -13
- package/templates/storefront-nextjs-shadcn/components/product/review-form.tsx +25 -27
- package/templates/storefront-nextjs-shadcn/components/providers/language-sync-provider.tsx +27 -0
- package/templates/storefront-nextjs-shadcn/components/providers/stores-provider.tsx +40 -7
- package/templates/storefront-nextjs-shadcn/components/returns/return-request-form.tsx +56 -70
- package/templates/storefront-nextjs-shadcn/components/search/search-bar.tsx +7 -4
- package/templates/storefront-nextjs-shadcn/components/shipping/shipping-method-selector.tsx +12 -9
- package/templates/storefront-nextjs-shadcn/components/ui/empty-state.tsx +23 -12
- package/templates/storefront-nextjs-shadcn/components/wishlist/wishlist-button.tsx +7 -4
- package/templates/storefront-nextjs-shadcn/components/wishlist/wishlist-icon.tsx +1 -1
- package/templates/storefront-nextjs-shadcn/components/wishlist/wishlist-item.tsx +2 -10
- package/templates/storefront-nextjs-shadcn/generated/graphql.ts +1159 -551
- package/templates/storefront-nextjs-shadcn/hooks/index.ts +1 -0
- package/templates/storefront-nextjs-shadcn/hooks/use-cart-actions.ts +22 -249
- package/templates/storefront-nextjs-shadcn/hooks/use-cart-di.ts +67 -0
- package/templates/storefront-nextjs-shadcn/hooks/use-cart-sync.ts +3 -3
- package/templates/storefront-nextjs-shadcn/i18n/navigation.ts +12 -0
- package/templates/storefront-nextjs-shadcn/i18n/request.ts +17 -0
- package/templates/storefront-nextjs-shadcn/i18n/routing.ts +17 -0
- package/templates/storefront-nextjs-shadcn/lib/graphql/config.ts +1 -0
- package/templates/storefront-nextjs-shadcn/lib/graphql/hooks.ts +41 -8
- package/templates/storefront-nextjs-shadcn/lib/graphql/query-keys.ts +20 -18
- package/templates/storefront-nextjs-shadcn/lib/graphql/server.ts +2 -1
- package/templates/storefront-nextjs-shadcn/messages/en.json +869 -0
- package/templates/storefront-nextjs-shadcn/messages/pl.json +869 -0
- package/templates/storefront-nextjs-shadcn/next.config.ts +6 -5
- package/templates/storefront-nextjs-shadcn/package.json +3 -2
- package/templates/storefront-nextjs-shadcn/proxy.ts +115 -46
- package/templates/storefront-nextjs-shadcn/stores/cart-store.ts +24 -58
- package/templates/storefront-nextjs-shadcn/wrangler.toml +11 -0
- /package/templates/storefront-nextjs-shadcn/app/{account → [locale]/account}/loading.tsx +0 -0
- /package/templates/storefront-nextjs-shadcn/app/{account → [locale]/account}/orders/[id]/loading.tsx +0 -0
- /package/templates/storefront-nextjs-shadcn/app/{blog → [locale]/blog}/[slug]/loading.tsx +0 -0
- /package/templates/storefront-nextjs-shadcn/app/{blog → [locale]/blog}/loading.tsx +0 -0
- /package/templates/storefront-nextjs-shadcn/app/{blog → [locale]/blog}/page.tsx +0 -0
- /package/templates/storefront-nextjs-shadcn/app/{brands → [locale]/brands}/[slug]/page.tsx +0 -0
- /package/templates/storefront-nextjs-shadcn/app/{brands → [locale]/brands}/page.tsx +0 -0
- /package/templates/storefront-nextjs-shadcn/app/{cart → [locale]/cart}/loading.tsx +0 -0
- /package/templates/storefront-nextjs-shadcn/app/{categories → [locale]/categories}/[slug]/loading.tsx +0 -0
- /package/templates/storefront-nextjs-shadcn/app/{categories → [locale]/categories}/[slug]/page.tsx +0 -0
- /package/templates/storefront-nextjs-shadcn/app/{checkout → [locale]/checkout}/loading.tsx +0 -0
- /package/templates/storefront-nextjs-shadcn/app/{collections → [locale]/collections}/[handle]/loading.tsx +0 -0
- /package/templates/storefront-nextjs-shadcn/app/{collections → [locale]/collections}/loading.tsx +0 -0
- /package/templates/storefront-nextjs-shadcn/app/{products → [locale]/products}/[slug]/loading.tsx +0 -0
- /package/templates/storefront-nextjs-shadcn/app/{products → [locale]/products}/loading.tsx +0 -0
- /package/templates/storefront-nextjs-shadcn/app/{returns → [locale]/returns}/page.tsx +0 -0
- /package/templates/storefront-nextjs-shadcn/app/{search → [locale]/search}/loading.tsx +0 -0
- /package/templates/storefront-nextjs-shadcn/app/{search → [locale]/search}/page.tsx +0 -0
- /package/templates/storefront-nextjs-shadcn/app/{search → [locale]/search}/search-client.tsx +0 -0
- /package/templates/storefront-nextjs-shadcn/app/{shipping → [locale]/shipping}/page.tsx +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { useState, useEffect } from "react";
|
|
4
|
+
import { useTranslations } from "next-intl";
|
|
4
5
|
import { Truck, Package, Clock, Check, AlertCircle } from "lucide-react";
|
|
5
6
|
import { cn } from "@/lib/utils";
|
|
6
7
|
import { Spinner } from "@/components/ui/spinner";
|
|
@@ -77,6 +78,7 @@ export function ShippingMethodSelector({
|
|
|
77
78
|
currencyCode = "PLN",
|
|
78
79
|
className,
|
|
79
80
|
}: ShippingMethodSelectorProps) {
|
|
81
|
+
const t = useTranslations("checkout.delivery");
|
|
80
82
|
const formatPrice = (money: Money) => {
|
|
81
83
|
const amount = parseFloat(money.amount);
|
|
82
84
|
return new Intl.NumberFormat("pl-PL", {
|
|
@@ -90,12 +92,12 @@ export function ShippingMethodSelector({
|
|
|
90
92
|
<div className={cn("space-y-4", className)}>
|
|
91
93
|
<div className="flex items-center gap-2">
|
|
92
94
|
<Truck className="h-5 w-5 text-muted-foreground" />
|
|
93
|
-
<h3 className="text-sm font-medium text-foreground">
|
|
95
|
+
<h3 className="text-sm font-medium text-foreground">{t("title")}</h3>
|
|
94
96
|
</div>
|
|
95
97
|
<div className="flex items-center justify-center py-8">
|
|
96
98
|
<Spinner className="h-6 w-6" />
|
|
97
99
|
<span className="ml-2 text-sm text-muted-foreground">
|
|
98
|
-
|
|
100
|
+
{t("loading")}
|
|
99
101
|
</span>
|
|
100
102
|
</div>
|
|
101
103
|
</div>
|
|
@@ -107,7 +109,7 @@ export function ShippingMethodSelector({
|
|
|
107
109
|
<div className={cn("space-y-4", className)}>
|
|
108
110
|
<div className="flex items-center gap-2">
|
|
109
111
|
<Truck className="h-5 w-5 text-muted-foreground" />
|
|
110
|
-
<h3 className="text-sm font-medium text-foreground">
|
|
112
|
+
<h3 className="text-sm font-medium text-foreground">{t("title")}</h3>
|
|
111
113
|
</div>
|
|
112
114
|
<div className="rounded-lg border border-destructive/50 bg-destructive/10 p-4">
|
|
113
115
|
<div className="flex items-center gap-2">
|
|
@@ -124,11 +126,11 @@ export function ShippingMethodSelector({
|
|
|
124
126
|
<div className={cn("space-y-4", className)}>
|
|
125
127
|
<div className="flex items-center gap-2">
|
|
126
128
|
<Truck className="h-5 w-5 text-muted-foreground" />
|
|
127
|
-
<h3 className="text-sm font-medium text-foreground">
|
|
129
|
+
<h3 className="text-sm font-medium text-foreground">{t("title")}</h3>
|
|
128
130
|
</div>
|
|
129
131
|
<div className="rounded-lg border border-border bg-muted/50 p-4">
|
|
130
132
|
<p className="text-sm text-muted-foreground text-center">
|
|
131
|
-
|
|
133
|
+
{t("noMethodsAvailable")}
|
|
132
134
|
</p>
|
|
133
135
|
</div>
|
|
134
136
|
</div>
|
|
@@ -140,7 +142,7 @@ export function ShippingMethodSelector({
|
|
|
140
142
|
{/* Header */}
|
|
141
143
|
<div className="flex items-center gap-2">
|
|
142
144
|
<Truck className="h-5 w-5 text-muted-foreground" />
|
|
143
|
-
<h3 className="text-sm font-medium text-foreground">
|
|
145
|
+
<h3 className="text-sm font-medium text-foreground">{t("title")}</h3>
|
|
144
146
|
</div>
|
|
145
147
|
|
|
146
148
|
{/* Free Shipping Progress Banner */}
|
|
@@ -167,7 +169,7 @@ export function ShippingMethodSelector({
|
|
|
167
169
|
<div className="flex items-center gap-2">
|
|
168
170
|
<Check className="h-4 w-4 text-green-600" />
|
|
169
171
|
<p className="text-sm font-medium text-green-700">
|
|
170
|
-
{freeShippingProgress.message || "
|
|
172
|
+
{freeShippingProgress.message || t("freeShippingQualified")}
|
|
171
173
|
</p>
|
|
172
174
|
</div>
|
|
173
175
|
</div>
|
|
@@ -190,6 +192,7 @@ function ShippingMethodCard({
|
|
|
190
192
|
onSelect: () => void;
|
|
191
193
|
formatPrice: (money: Money) => string;
|
|
192
194
|
}) {
|
|
195
|
+
const t = useTranslations("checkout.delivery");
|
|
193
196
|
return (
|
|
194
197
|
<button
|
|
195
198
|
type="button"
|
|
@@ -225,7 +228,7 @@ function ShippingMethodCard({
|
|
|
225
228
|
</p>
|
|
226
229
|
{method.isFree && (
|
|
227
230
|
<span className="rounded bg-green-500/10 px-1.5 py-0.5 text-xs font-medium text-green-700">
|
|
228
|
-
|
|
231
|
+
{t("free")}
|
|
229
232
|
</span>
|
|
230
233
|
)}
|
|
231
234
|
</div>
|
|
@@ -264,7 +267,7 @@ function ShippingMethodCard({
|
|
|
264
267
|
method.isFree ? "text-green-600" : "text-foreground"
|
|
265
268
|
)}
|
|
266
269
|
>
|
|
267
|
-
{method.isFree ? "
|
|
270
|
+
{method.isFree ? t("free") : formatPrice(method.price)}
|
|
268
271
|
</p>
|
|
269
272
|
|
|
270
273
|
{/* Selection Indicator */}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import * as React from 'react';
|
|
4
|
+
import { useTranslations } from 'next-intl';
|
|
2
5
|
import { cn } from '@/lib/utils';
|
|
3
6
|
|
|
4
7
|
export interface EmptyStateProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
@@ -44,6 +47,8 @@ EmptyState.displayName = 'EmptyState';
|
|
|
44
47
|
export const EmptyCart: React.FC<{ onContinueShopping?: () => void }> = ({
|
|
45
48
|
onContinueShopping,
|
|
46
49
|
}) => {
|
|
50
|
+
const t = useTranslations('emptyState');
|
|
51
|
+
|
|
47
52
|
return (
|
|
48
53
|
<EmptyState
|
|
49
54
|
icon={
|
|
@@ -62,15 +67,15 @@ export const EmptyCart: React.FC<{ onContinueShopping?: () => void }> = ({
|
|
|
62
67
|
/>
|
|
63
68
|
</svg>
|
|
64
69
|
}
|
|
65
|
-
title=
|
|
66
|
-
description=
|
|
70
|
+
title={t('cartEmpty')}
|
|
71
|
+
description={t('cartEmptyDescription')}
|
|
67
72
|
action={
|
|
68
73
|
onContinueShopping && (
|
|
69
74
|
<button
|
|
70
75
|
onClick={onContinueShopping}
|
|
71
76
|
className="rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2"
|
|
72
77
|
>
|
|
73
|
-
|
|
78
|
+
{t('continueShopping')}
|
|
74
79
|
</button>
|
|
75
80
|
)
|
|
76
81
|
}
|
|
@@ -84,6 +89,8 @@ EmptyCart.displayName = 'EmptyCart';
|
|
|
84
89
|
* EmptyProducts - Pre-configured empty state for product listings
|
|
85
90
|
*/
|
|
86
91
|
export const EmptyProducts: React.FC<{ onReset?: () => void }> = ({ onReset }) => {
|
|
92
|
+
const t = useTranslations('emptyState');
|
|
93
|
+
|
|
87
94
|
return (
|
|
88
95
|
<EmptyState
|
|
89
96
|
icon={
|
|
@@ -102,15 +109,15 @@ export const EmptyProducts: React.FC<{ onReset?: () => void }> = ({ onReset }) =
|
|
|
102
109
|
/>
|
|
103
110
|
</svg>
|
|
104
111
|
}
|
|
105
|
-
title=
|
|
106
|
-
description=
|
|
112
|
+
title={t('noProducts')}
|
|
113
|
+
description={t('noProductsDescription')}
|
|
107
114
|
action={
|
|
108
115
|
onReset && (
|
|
109
116
|
<button
|
|
110
117
|
onClick={onReset}
|
|
111
118
|
className="rounded-md border border-border bg-background px-4 py-2 text-sm font-medium text-foreground hover:bg-accent hover:text-accent-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2"
|
|
112
119
|
>
|
|
113
|
-
|
|
120
|
+
{t('clearFilters')}
|
|
114
121
|
</button>
|
|
115
122
|
)
|
|
116
123
|
}
|
|
@@ -126,6 +133,8 @@ EmptyProducts.displayName = 'EmptyProducts';
|
|
|
126
133
|
export const EmptyOrders: React.FC<{ onStartShopping?: () => void }> = ({
|
|
127
134
|
onStartShopping,
|
|
128
135
|
}) => {
|
|
136
|
+
const t = useTranslations('emptyState');
|
|
137
|
+
|
|
129
138
|
return (
|
|
130
139
|
<EmptyState
|
|
131
140
|
icon={
|
|
@@ -144,15 +153,15 @@ export const EmptyOrders: React.FC<{ onStartShopping?: () => void }> = ({
|
|
|
144
153
|
/>
|
|
145
154
|
</svg>
|
|
146
155
|
}
|
|
147
|
-
title=
|
|
148
|
-
description=
|
|
156
|
+
title={t('noOrders')}
|
|
157
|
+
description={t('noOrdersDescription')}
|
|
149
158
|
action={
|
|
150
159
|
onStartShopping && (
|
|
151
160
|
<button
|
|
152
161
|
onClick={onStartShopping}
|
|
153
162
|
className="rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2"
|
|
154
163
|
>
|
|
155
|
-
|
|
164
|
+
{t('startShopping')}
|
|
156
165
|
</button>
|
|
157
166
|
)
|
|
158
167
|
}
|
|
@@ -168,6 +177,8 @@ EmptyOrders.displayName = 'EmptyOrders';
|
|
|
168
177
|
export const EmptyWishlist: React.FC<{ onBrowseProducts?: () => void }> = ({
|
|
169
178
|
onBrowseProducts,
|
|
170
179
|
}) => {
|
|
180
|
+
const t = useTranslations('emptyState');
|
|
181
|
+
|
|
171
182
|
return (
|
|
172
183
|
<EmptyState
|
|
173
184
|
icon={
|
|
@@ -186,15 +197,15 @@ export const EmptyWishlist: React.FC<{ onBrowseProducts?: () => void }> = ({
|
|
|
186
197
|
/>
|
|
187
198
|
</svg>
|
|
188
199
|
}
|
|
189
|
-
title=
|
|
190
|
-
description=
|
|
200
|
+
title={t('wishlistEmpty')}
|
|
201
|
+
description={t('wishlistEmptyDescription')}
|
|
191
202
|
action={
|
|
192
203
|
onBrowseProducts && (
|
|
193
204
|
<button
|
|
194
205
|
onClick={onBrowseProducts}
|
|
195
206
|
className="rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2"
|
|
196
207
|
>
|
|
197
|
-
|
|
208
|
+
{t('browseProducts')}
|
|
198
209
|
</button>
|
|
199
210
|
)
|
|
200
211
|
}
|
|
@@ -13,6 +13,7 @@ import { Button } from '@/components/ui/button';
|
|
|
13
13
|
import { cn } from '@/lib/utils';
|
|
14
14
|
import { useWishlistStore } from '@/stores/wishlist-store';
|
|
15
15
|
import { toast } from 'sonner';
|
|
16
|
+
import { useTranslations } from 'next-intl';
|
|
16
17
|
|
|
17
18
|
interface WishlistButtonProps {
|
|
18
19
|
productId: string;
|
|
@@ -41,6 +42,7 @@ export function WishlistButton({
|
|
|
41
42
|
variant = 'default',
|
|
42
43
|
className,
|
|
43
44
|
}: WishlistButtonProps) {
|
|
45
|
+
const t = useTranslations('product');
|
|
44
46
|
const [isAnimating, setIsAnimating] = useState(false);
|
|
45
47
|
|
|
46
48
|
const {
|
|
@@ -68,7 +70,7 @@ export function WishlistButton({
|
|
|
68
70
|
);
|
|
69
71
|
if (item) {
|
|
70
72
|
removeItem(wishlist.id, item.id);
|
|
71
|
-
toast.success('
|
|
73
|
+
toast.success(t('removedFromWishlist'));
|
|
72
74
|
}
|
|
73
75
|
}
|
|
74
76
|
} else {
|
|
@@ -85,9 +87,10 @@ export function WishlistButton({
|
|
|
85
87
|
notifyOnSale: false,
|
|
86
88
|
notifyOnRestock: false,
|
|
87
89
|
});
|
|
88
|
-
toast.success('
|
|
90
|
+
toast.success(t('addedToWishlist'));
|
|
89
91
|
}
|
|
90
92
|
}, [
|
|
93
|
+
t,
|
|
91
94
|
inWishlist,
|
|
92
95
|
productId,
|
|
93
96
|
variantId,
|
|
@@ -113,7 +116,7 @@ export function WishlistButton({
|
|
|
113
116
|
className
|
|
114
117
|
)}
|
|
115
118
|
onClick={handleToggle}
|
|
116
|
-
aria-label={inWishlist ? '
|
|
119
|
+
aria-label={inWishlist ? t('removeFromWishlist') : t('addToWishlist')}
|
|
117
120
|
>
|
|
118
121
|
<Heart
|
|
119
122
|
className={cn(
|
|
@@ -142,7 +145,7 @@ export function WishlistButton({
|
|
|
142
145
|
inWishlist && 'fill-current text-red-500'
|
|
143
146
|
)}
|
|
144
147
|
/>
|
|
145
|
-
{inWishlist ? '
|
|
148
|
+
{inWishlist ? t('inWishlist') : t('addToWishlist')}
|
|
146
149
|
</Button>
|
|
147
150
|
);
|
|
148
151
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import Image from 'next/image';
|
|
11
|
-
import Link from '
|
|
11
|
+
import { Link } from '@/i18n/navigation';
|
|
12
12
|
import { ShoppingCart, Trash2, TrendingDown, TrendingUp } from 'lucide-react';
|
|
13
13
|
import { Button } from '@/components/ui/button';
|
|
14
14
|
import { Card, CardContent } from '@/components/ui/card';
|
|
@@ -33,15 +33,7 @@ export function WishlistItem({ item, wishlistId }: WishlistItemProps) {
|
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
const handleAddToCart = async () => {
|
|
36
|
-
await addToCart(
|
|
37
|
-
variantId: item.variantId || item.productId,
|
|
38
|
-
productId: item.productId,
|
|
39
|
-
productTitle: item.productTitle,
|
|
40
|
-
variantTitle: item.variantTitle || '',
|
|
41
|
-
price: item.price,
|
|
42
|
-
image: item.image,
|
|
43
|
-
available: true,
|
|
44
|
-
});
|
|
36
|
+
await addToCart(item.variantId || item.productId);
|
|
45
37
|
};
|
|
46
38
|
|
|
47
39
|
// Calculate price change since added
|