create-brainerce-store 1.4.1 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/messages/en.json +9 -1
- package/messages/he.json +9 -1
- package/package.json +1 -1
- package/templates/nextjs/base/src/app/account/page.tsx +8 -4
- package/templates/nextjs/base/src/app/auth/callback/page.tsx +90 -90
- package/templates/nextjs/base/src/app/cart/page.tsx +110 -110
- package/templates/nextjs/base/src/app/checkout/page.tsx +614 -614
- package/templates/nextjs/base/src/app/login/page.tsx +58 -58
- package/templates/nextjs/base/src/app/order-confirmation/page.tsx +193 -193
- package/templates/nextjs/base/src/app/page.tsx +98 -98
- package/templates/nextjs/base/src/app/products/[slug]/page.tsx +435 -435
- package/templates/nextjs/base/src/app/products/page.tsx +246 -246
- package/templates/nextjs/base/src/app/register/page.tsx +68 -68
- package/templates/nextjs/base/src/app/verify-email/page.tsx +293 -293
- package/templates/nextjs/base/src/components/account/order-history.tsx +198 -198
- package/templates/nextjs/base/src/components/account/profile-section.tsx +189 -40
- package/templates/nextjs/base/src/components/auth/login-form.tsx +94 -94
- package/templates/nextjs/base/src/components/auth/oauth-buttons.tsx +137 -137
- package/templates/nextjs/base/src/components/auth/register-form.tsx +184 -184
- package/templates/nextjs/base/src/components/cart/cart-item.tsx +153 -153
- package/templates/nextjs/base/src/components/cart/cart-summary.tsx +70 -70
- package/templates/nextjs/base/src/components/cart/coupon-input.tsx +134 -134
- package/templates/nextjs/base/src/components/cart/reservation-countdown.tsx +103 -103
- package/templates/nextjs/base/src/components/checkout/checkout-form.tsx +305 -305
- package/templates/nextjs/base/src/components/checkout/delivery-method-step.tsx +64 -64
- package/templates/nextjs/base/src/components/checkout/payment-step.tsx +350 -344
- package/templates/nextjs/base/src/components/checkout/pickup-step.tsx +199 -199
- package/templates/nextjs/base/src/components/checkout/shipping-step.tsx +110 -110
- package/templates/nextjs/base/src/components/checkout/tax-display.tsx +65 -65
- package/templates/nextjs/base/src/components/layout/footer.tsx +38 -38
- package/templates/nextjs/base/src/components/layout/header.tsx +332 -332
- package/templates/nextjs/base/src/components/products/product-card.tsx +96 -96
- package/templates/nextjs/base/src/components/products/product-grid.tsx +35 -35
- package/templates/nextjs/base/src/components/shared/loading-spinner.tsx +32 -32
- package/templates/nextjs/base/src/lib/translations.ts +11 -11
- package/templates/nextjs/base/src/providers/store-provider.tsx.ejs +5 -1
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import type { TaxBreakdown } from 'brainerce';
|
|
4
|
-
import { formatPrice } from 'brainerce';
|
|
5
|
-
import { useTranslations } from '@/lib/translations';
|
|
6
|
-
import { useStoreInfo } from '@/providers/store-provider';
|
|
7
|
-
import { cn } from '@/lib/utils';
|
|
8
|
-
|
|
9
|
-
interface TaxDisplayProps {
|
|
10
|
-
/** Whether shipping address has been set */
|
|
11
|
-
addressSet: boolean;
|
|
12
|
-
/** Tax amount string from checkout (only available after address is set) */
|
|
13
|
-
taxAmount?: string;
|
|
14
|
-
/** Detailed tax breakdown (optional) */
|
|
15
|
-
taxBreakdown?: TaxBreakdown | null;
|
|
16
|
-
className?: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export function TaxDisplay({ addressSet, taxAmount, taxBreakdown, className }: TaxDisplayProps) {
|
|
20
|
-
const t = useTranslations('checkout');
|
|
21
|
-
const tc = useTranslations('common');
|
|
22
|
-
const { storeInfo } = useStoreInfo();
|
|
23
|
-
const currency = storeInfo?.currency || 'USD';
|
|
24
|
-
|
|
25
|
-
// Before address is set
|
|
26
|
-
if (!addressSet) {
|
|
27
|
-
return (
|
|
28
|
-
<div className={cn('flex items-center justify-between text-sm', className)}>
|
|
29
|
-
<span className="text-muted-foreground">{tc('tax')}</span>
|
|
30
|
-
<span className="text-muted-foreground text-xs">{t('calculatedAfterAddress')}</span>
|
|
31
|
-
</div>
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// After address, show tax amount
|
|
36
|
-
const tax = taxAmount ? parseFloat(taxAmount) : 0;
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
<div className={cn('space-y-1', className)}>
|
|
40
|
-
<div className="flex items-center justify-between text-sm">
|
|
41
|
-
<span className="text-muted-foreground">{tc('tax')}</span>
|
|
42
|
-
<span className="text-foreground font-medium">
|
|
43
|
-
{tax > 0 ? (formatPrice(tax, { currency }) as string) : t('noTax')}
|
|
44
|
-
</span>
|
|
45
|
-
</div>
|
|
46
|
-
|
|
47
|
-
{/* Tax breakdown details */}
|
|
48
|
-
{taxBreakdown && taxBreakdown.breakdown?.length > 0 && tax > 0 && (
|
|
49
|
-
<div className="space-y-0.5 ps-4">
|
|
50
|
-
{taxBreakdown.breakdown.map((item, index) => (
|
|
51
|
-
<div
|
|
52
|
-
key={index}
|
|
53
|
-
className="text-muted-foreground flex items-center justify-between text-xs"
|
|
54
|
-
>
|
|
55
|
-
<span>
|
|
56
|
-
{item.name} ({(item.rate * 100).toFixed(1)}%)
|
|
57
|
-
</span>
|
|
58
|
-
<span>{formatPrice(item.amount, { currency }) as string}</span>
|
|
59
|
-
</div>
|
|
60
|
-
))}
|
|
61
|
-
</div>
|
|
62
|
-
)}
|
|
63
|
-
</div>
|
|
64
|
-
);
|
|
65
|
-
}
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import type { TaxBreakdown } from 'brainerce';
|
|
4
|
+
import { formatPrice } from 'brainerce';
|
|
5
|
+
import { useTranslations } from '@/lib/translations';
|
|
6
|
+
import { useStoreInfo } from '@/providers/store-provider';
|
|
7
|
+
import { cn } from '@/lib/utils';
|
|
8
|
+
|
|
9
|
+
interface TaxDisplayProps {
|
|
10
|
+
/** Whether shipping address has been set */
|
|
11
|
+
addressSet: boolean;
|
|
12
|
+
/** Tax amount string from checkout (only available after address is set) */
|
|
13
|
+
taxAmount?: string;
|
|
14
|
+
/** Detailed tax breakdown (optional) */
|
|
15
|
+
taxBreakdown?: TaxBreakdown | null;
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function TaxDisplay({ addressSet, taxAmount, taxBreakdown, className }: TaxDisplayProps) {
|
|
20
|
+
const t = useTranslations('checkout');
|
|
21
|
+
const tc = useTranslations('common');
|
|
22
|
+
const { storeInfo } = useStoreInfo();
|
|
23
|
+
const currency = storeInfo?.currency || 'USD';
|
|
24
|
+
|
|
25
|
+
// Before address is set
|
|
26
|
+
if (!addressSet) {
|
|
27
|
+
return (
|
|
28
|
+
<div className={cn('flex items-center justify-between text-sm', className)}>
|
|
29
|
+
<span className="text-muted-foreground">{tc('tax')}</span>
|
|
30
|
+
<span className="text-muted-foreground text-xs">{t('calculatedAfterAddress')}</span>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// After address, show tax amount
|
|
36
|
+
const tax = taxAmount ? parseFloat(taxAmount) : 0;
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<div className={cn('space-y-1', className)}>
|
|
40
|
+
<div className="flex items-center justify-between text-sm">
|
|
41
|
+
<span className="text-muted-foreground">{tc('tax')}</span>
|
|
42
|
+
<span className="text-foreground font-medium">
|
|
43
|
+
{tax > 0 ? (formatPrice(tax, { currency }) as string) : t('noTax')}
|
|
44
|
+
</span>
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
{/* Tax breakdown details */}
|
|
48
|
+
{taxBreakdown && taxBreakdown.breakdown?.length > 0 && tax > 0 && (
|
|
49
|
+
<div className="space-y-0.5 ps-4">
|
|
50
|
+
{taxBreakdown.breakdown.map((item, index) => (
|
|
51
|
+
<div
|
|
52
|
+
key={index}
|
|
53
|
+
className="text-muted-foreground flex items-center justify-between text-xs"
|
|
54
|
+
>
|
|
55
|
+
<span>
|
|
56
|
+
{item.name} ({(item.rate * 100).toFixed(1)}%)
|
|
57
|
+
</span>
|
|
58
|
+
<span>{formatPrice(item.amount, { currency }) as string}</span>
|
|
59
|
+
</div>
|
|
60
|
+
))}
|
|
61
|
+
</div>
|
|
62
|
+
)}
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import Link from 'next/link';
|
|
4
|
-
import { useTranslations } from '@/lib/translations';
|
|
5
|
-
import { useStoreInfo } from '@/providers/store-provider';
|
|
6
|
-
|
|
7
|
-
export function Footer() {
|
|
8
|
-
const t = useTranslations('common');
|
|
9
|
-
const tn = useTranslations('nav');
|
|
10
|
-
const { storeInfo } = useStoreInfo();
|
|
11
|
-
const year = new Date().getFullYear();
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<footer className="border-border bg-background border-t">
|
|
15
|
-
<div className="mx-auto max-w-7xl px-4 py-8 sm:px-6 lg:px-8">
|
|
16
|
-
<div className="flex flex-col items-center justify-between gap-4 sm:flex-row">
|
|
17
|
-
<p className="text-muted-foreground text-sm">
|
|
18
|
-
{year} {storeInfo?.name || t('store')}. {t('allRightsReserved')}
|
|
19
|
-
</p>
|
|
20
|
-
<nav className="flex items-center gap-4">
|
|
21
|
-
<Link
|
|
22
|
-
href="/products"
|
|
23
|
-
className="text-muted-foreground hover:text-foreground text-sm transition-colors"
|
|
24
|
-
>
|
|
25
|
-
{tn('products')}
|
|
26
|
-
</Link>
|
|
27
|
-
<Link
|
|
28
|
-
href="/account"
|
|
29
|
-
className="text-muted-foreground hover:text-foreground text-sm transition-colors"
|
|
30
|
-
>
|
|
31
|
-
{tn('account')}
|
|
32
|
-
</Link>
|
|
33
|
-
</nav>
|
|
34
|
-
</div>
|
|
35
|
-
</div>
|
|
36
|
-
</footer>
|
|
37
|
-
);
|
|
38
|
-
}
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import Link from 'next/link';
|
|
4
|
+
import { useTranslations } from '@/lib/translations';
|
|
5
|
+
import { useStoreInfo } from '@/providers/store-provider';
|
|
6
|
+
|
|
7
|
+
export function Footer() {
|
|
8
|
+
const t = useTranslations('common');
|
|
9
|
+
const tn = useTranslations('nav');
|
|
10
|
+
const { storeInfo } = useStoreInfo();
|
|
11
|
+
const year = new Date().getFullYear();
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<footer className="border-border bg-background border-t">
|
|
15
|
+
<div className="mx-auto max-w-7xl px-4 py-8 sm:px-6 lg:px-8">
|
|
16
|
+
<div className="flex flex-col items-center justify-between gap-4 sm:flex-row">
|
|
17
|
+
<p className="text-muted-foreground text-sm">
|
|
18
|
+
{year} {storeInfo?.name || t('store')}. {t('allRightsReserved')}
|
|
19
|
+
</p>
|
|
20
|
+
<nav className="flex items-center gap-4">
|
|
21
|
+
<Link
|
|
22
|
+
href="/products"
|
|
23
|
+
className="text-muted-foreground hover:text-foreground text-sm transition-colors"
|
|
24
|
+
>
|
|
25
|
+
{tn('products')}
|
|
26
|
+
</Link>
|
|
27
|
+
<Link
|
|
28
|
+
href="/account"
|
|
29
|
+
className="text-muted-foreground hover:text-foreground text-sm transition-colors"
|
|
30
|
+
>
|
|
31
|
+
{tn('account')}
|
|
32
|
+
</Link>
|
|
33
|
+
</nav>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
</footer>
|
|
37
|
+
);
|
|
38
|
+
}
|