@zeyolabs/shopping 2026.11.38 → 2026.11.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/basket/pages/Basket.svelte +36 -33
- package/bundles/admin/BundleEditPage.svelte +7 -4
- package/bundles/admin/BundleForm.svelte +10 -7
- package/bundles/admin/BundlesPage.svelte +14 -10
- package/bundles/pages/Bundle.svelte +44 -41
- package/catalogue/admin/CategoriesPage.svelte +13 -10
- package/catalogue/admin/CategoryForm.svelte +4 -3
- package/catalogue/admin/ProductEditPage.svelte +7 -4
- package/catalogue/admin/ProductForm.svelte +31 -29
- package/catalogue/admin/ProductsPage.svelte +16 -14
- package/catalogue/components/ProductCard.svelte +22 -14
- package/catalogue/pages/Category.svelte +10 -7
- package/catalogue/pages/Product.svelte +37 -30
- package/catalogue/pages/Search.svelte +12 -7
- package/catalogue/pages/Shop.svelte +6 -3
- package/checkout/pages/CheckoutSuccess.svelte +10 -8
- package/customers/pages/Account.svelte +19 -15
- package/fulfilment/admin/OrderPage.svelte +60 -56
- package/fulfilment/admin/OrdersPage.svelte +26 -22
- package/orders/pages/Order.svelte +35 -29
- package/package.json +5 -4
- package/reviews/admin/ReviewsPage.svelte +23 -19
- package/reviews/components/ReviewForm.svelte +3 -2
- package/reviews/components/Reviews.svelte +17 -13
- package/stock/admin/StockPage.svelte +12 -9
- package/stock/admin/StockRow.svelte +3 -2
- package/ui/PageLinks.svelte +3 -3
- package/ui/PageTitle.svelte +2 -1
- package/ui/Stars.svelte +3 -1
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { goto } from '$app/navigation';
|
|
3
3
|
import { resolve } from '$app/paths';
|
|
4
|
+
import { CheckboxField, Form, MessageField, NumberField, TextField } from '@zeyolabs/ui/form';
|
|
5
|
+
import Button from '@zeyolabs/ui/form/Button.svelte';
|
|
6
|
+
import Text from '@zeyolabs/ui/text/Text.svelte';
|
|
7
|
+
import Title from '@zeyolabs/ui/text/Title.svelte';
|
|
8
|
+
|
|
4
9
|
import type { getAdminProduct, getProductOptions } from '../admin.remote';
|
|
5
|
-
|
|
10
|
+
|
|
6
11
|
import { shopContext } from '../../context';
|
|
7
|
-
import { Images } from '../../utils/images';
|
|
8
12
|
import { FormInput } from '../../utils/form-input';
|
|
13
|
+
import { Images } from '../../utils/images';
|
|
14
|
+
import { saveProductForm } from '../admin.remote';
|
|
9
15
|
import { ProductFormSchema } from '../schema';
|
|
10
|
-
import { CheckboxField, Form, MessageField, NumberField, TextField } from '@zeyolabs/ui/form';
|
|
11
|
-
import Button from '@zeyolabs/ui/form/Button.svelte';
|
|
12
16
|
|
|
13
|
-
type Product = Awaited<ReturnType<typeof getAdminProduct>>;
|
|
14
17
|
type Options = Awaited<ReturnType<typeof getProductOptions>>;
|
|
18
|
+
type Product = Awaited<ReturnType<typeof getAdminProduct>>;
|
|
15
19
|
|
|
16
20
|
let { options, product }: { options: Options; product: null | Product } = $props();
|
|
17
21
|
|
|
@@ -34,8 +38,8 @@
|
|
|
34
38
|
return next;
|
|
35
39
|
}
|
|
36
40
|
|
|
37
|
-
const input = 'w-full rounded-md border border-[var(--
|
|
38
|
-
const section = 'grid gap-4 rounded-xl border border-[var(--
|
|
41
|
+
const input = 'w-full rounded-md border border-[var(--bd)] bg-white px-3 py-1.5';
|
|
42
|
+
const section = 'grid gap-4 rounded-xl border border-[var(--bd)] bg-white p-5';
|
|
39
43
|
</script>
|
|
40
44
|
|
|
41
45
|
<Form
|
|
@@ -69,7 +73,7 @@
|
|
|
69
73
|
schema={ProductFormSchema}
|
|
70
74
|
>
|
|
71
75
|
<section class={section}>
|
|
72
|
-
<
|
|
76
|
+
<Title level={2} size="sm">Basics</Title>
|
|
73
77
|
<TextField name="name" {form}>Name</TextField>
|
|
74
78
|
<div class="grid gap-4 sm:grid-cols-2">
|
|
75
79
|
<TextField name="slug" {form} optional placeholder="made from the name">Slug (URL)</TextField>
|
|
@@ -79,14 +83,14 @@
|
|
|
79
83
|
</div>
|
|
80
84
|
<CheckboxField name="active" {form}>On sale in the shop</CheckboxField>
|
|
81
85
|
{#if p && slug && p.slug !== slug}
|
|
82
|
-
<
|
|
86
|
+
<Text color="secondary">
|
|
83
87
|
The old URL /product/{p.slug} will redirect to the new one.
|
|
84
|
-
</
|
|
88
|
+
</Text>
|
|
85
89
|
{/if}
|
|
86
90
|
</section>
|
|
87
91
|
|
|
88
92
|
<section class={section}>
|
|
89
|
-
<
|
|
93
|
+
<Title level={2} size="sm">Description</Title>
|
|
90
94
|
<TextField name="shortDescription" {form} optional>
|
|
91
95
|
Short description (search results, top of the page)
|
|
92
96
|
</TextField>
|
|
@@ -97,17 +101,15 @@
|
|
|
97
101
|
|
|
98
102
|
<section class={section}>
|
|
99
103
|
<div>
|
|
100
|
-
<
|
|
101
|
-
<
|
|
102
|
-
File names in the product image bucket. The first is the cover.
|
|
103
|
-
</p>
|
|
104
|
+
<Title level={2} size="sm">Images</Title>
|
|
105
|
+
<Text color="secondary">File names in the product image bucket. The first is the cover.</Text>
|
|
104
106
|
</div>
|
|
105
107
|
<ul class="space-y-3">
|
|
106
108
|
{#each imageRows as row, i (i)}
|
|
107
109
|
<li class="flex flex-wrap items-center gap-3">
|
|
108
110
|
{#if row.src}
|
|
109
111
|
<img
|
|
110
|
-
class="size-14 rounded-md border border-[var(--
|
|
112
|
+
class="size-14 rounded-md border border-[var(--bd)] object-cover"
|
|
111
113
|
alt=""
|
|
112
114
|
src={Images.url(context.imageBaseUrl, row.src)}
|
|
113
115
|
/>
|
|
@@ -128,7 +130,7 @@
|
|
|
128
130
|
>Up</Button
|
|
129
131
|
>
|
|
130
132
|
<Button
|
|
131
|
-
onclick={() => images.set(imageRows.filter((_, j) => j !== i))}
|
|
133
|
+
onclick={() => images.set(imageRows.filter((_: unknown, j: number) => j !== i))}
|
|
132
134
|
size="sm"
|
|
133
135
|
variant="secondary">Remove</Button
|
|
134
136
|
>
|
|
@@ -143,7 +145,7 @@
|
|
|
143
145
|
</section>
|
|
144
146
|
|
|
145
147
|
<section class={section}>
|
|
146
|
-
<
|
|
148
|
+
<Title level={2} size="sm">Categories</Title>
|
|
147
149
|
<div class="grid gap-2 sm:grid-cols-2">
|
|
148
150
|
{#each options.categories as category (category.id)}
|
|
149
151
|
<label class="flex items-center gap-2 text-sm">
|
|
@@ -151,18 +153,18 @@
|
|
|
151
153
|
{category.name}
|
|
152
154
|
</label>
|
|
153
155
|
{:else}
|
|
154
|
-
<
|
|
156
|
+
<Text color="secondary">No categories yet.</Text>
|
|
155
157
|
{/each}
|
|
156
158
|
</div>
|
|
157
159
|
</section>
|
|
158
160
|
|
|
159
161
|
<section class={section}>
|
|
160
162
|
<div>
|
|
161
|
-
<
|
|
162
|
-
<
|
|
163
|
+
<Title level={2} size="sm">Variation</Title>
|
|
164
|
+
<Text color="secondary">
|
|
163
165
|
Products in the same group show as options of each other, e.g. group "Colour", option
|
|
164
166
|
"Black".
|
|
165
|
-
</
|
|
167
|
+
</Text>
|
|
166
168
|
</div>
|
|
167
169
|
<div class="grid gap-4 sm:grid-cols-2">
|
|
168
170
|
<label class="text-sm font-medium">
|
|
@@ -182,10 +184,10 @@
|
|
|
182
184
|
|
|
183
185
|
<section class={section}>
|
|
184
186
|
<div>
|
|
185
|
-
<
|
|
186
|
-
<
|
|
187
|
+
<Title level={2} size="sm">Stock and shipping</Title>
|
|
188
|
+
<Text color="secondary">
|
|
187
189
|
Stock itself is set on the Stock page{p ? ` (now ${p.stock} units)` : ''}.
|
|
188
|
-
</
|
|
190
|
+
</Text>
|
|
189
191
|
</div>
|
|
190
192
|
<div class="grid gap-4 sm:grid-cols-3">
|
|
191
193
|
<NumberField name="massGrams" {form} inputmode="numeric">Weight (g)</NumberField>
|
|
@@ -200,11 +202,11 @@
|
|
|
200
202
|
|
|
201
203
|
<section class={section}>
|
|
202
204
|
<div>
|
|
203
|
-
<
|
|
204
|
-
<
|
|
205
|
+
<Title level={2} size="sm">Made of other products</Title>
|
|
206
|
+
<Text color="secondary">
|
|
205
207
|
Leave empty for a normal product. A combined product has no stock of its own: it sells as
|
|
206
208
|
many complete sets as its parts allow, and selling one takes stock from the parts.
|
|
207
|
-
</
|
|
209
|
+
</Text>
|
|
208
210
|
</div>
|
|
209
211
|
<ul class="space-y-2">
|
|
210
212
|
{#each componentRows as _, i (i)}
|
|
@@ -222,7 +224,7 @@
|
|
|
222
224
|
min="1"
|
|
223
225
|
/>
|
|
224
226
|
<Button
|
|
225
|
-
onclick={() => components.set(componentRows.filter((_, j) => j !== i))}
|
|
227
|
+
onclick={() => components.set(componentRows.filter((_: unknown, j: number) => j !== i))}
|
|
226
228
|
size="sm"
|
|
227
229
|
variant="secondary">Remove</Button
|
|
228
230
|
>
|
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
import { goto } from '$app/navigation';
|
|
3
3
|
import { resolve } from '$app/paths';
|
|
4
4
|
import { page } from '$app/state';
|
|
5
|
-
import { getAdminProducts } from '../admin.remote';
|
|
6
|
-
import { Money } from '../../utils/money';
|
|
7
5
|
import Badge from '@zeyolabs/ui/badge/Badge.svelte';
|
|
8
6
|
import Boundary from '@zeyolabs/ui/boundary/Boundary.svelte';
|
|
7
|
+
import Text from '@zeyolabs/ui/text/Text.svelte';
|
|
8
|
+
import Title from '@zeyolabs/ui/text/Title.svelte';
|
|
9
|
+
|
|
10
|
+
import { Money } from '../../utils/money';
|
|
11
|
+
import { getAdminProducts } from '../admin.remote';
|
|
9
12
|
|
|
10
13
|
const q = $derived(page.url.searchParams.get('q') ?? '');
|
|
11
14
|
</script>
|
|
@@ -13,18 +16,17 @@
|
|
|
13
16
|
<svelte:head><title>Products · Admin</title></svelte:head>
|
|
14
17
|
|
|
15
18
|
<div class="flex flex-wrap items-center justify-between gap-3">
|
|
16
|
-
<
|
|
19
|
+
<Title level={1} size="md">Products</Title>
|
|
17
20
|
<div class="flex gap-2 text-sm">
|
|
18
21
|
<a
|
|
19
|
-
class="rounded-md border border-[var(--
|
|
22
|
+
class="rounded-md border border-[var(--bd)] bg-white px-3 py-1.5"
|
|
20
23
|
href={resolve('/categories')}>Categories</a
|
|
21
24
|
>
|
|
22
|
-
<a
|
|
23
|
-
|
|
24
|
-
href={resolve('/bundles')}>Bundles</a
|
|
25
|
+
<a class="rounded-md border border-[var(--bd)] bg-white px-3 py-1.5" href={resolve('/bundles')}
|
|
26
|
+
>Bundles</a
|
|
25
27
|
>
|
|
26
28
|
<a
|
|
27
|
-
class="rounded-md bg-[var(--
|
|
29
|
+
class="rounded-md bg-[var(--acc)] px-3 py-1.5 text-white no-underline"
|
|
28
30
|
href={resolve('/products/new')}>New product</a
|
|
29
31
|
>
|
|
30
32
|
</div>
|
|
@@ -44,7 +46,7 @@
|
|
|
44
46
|
<input
|
|
45
47
|
id="product-q"
|
|
46
48
|
name="q"
|
|
47
|
-
class="w-full max-w-sm rounded-md border border-[var(--
|
|
49
|
+
class="w-full max-w-sm rounded-md border border-[var(--bd)] bg-white px-3 py-1.5"
|
|
48
50
|
placeholder="Name or SKU"
|
|
49
51
|
type="search"
|
|
50
52
|
value={q}
|
|
@@ -53,9 +55,9 @@
|
|
|
53
55
|
|
|
54
56
|
<Boundary message="Could not load products.">
|
|
55
57
|
{let rows = $derived(await getAdminProducts(q))}
|
|
56
|
-
<div class="mt-4 overflow-x-auto rounded-xl border border-[var(--
|
|
58
|
+
<div class="mt-4 overflow-x-auto rounded-xl border border-[var(--bd)] bg-white">
|
|
57
59
|
<table class="w-full text-left text-sm">
|
|
58
|
-
<thead class="border-b border-[var(--
|
|
60
|
+
<thead class="border-b border-[var(--bd)] text-[var(--txs)]">
|
|
59
61
|
<tr>
|
|
60
62
|
<th class="px-4 py-2 font-medium">Product</th>
|
|
61
63
|
<th class="px-4 py-2 font-medium">SKU</th>
|
|
@@ -63,7 +65,7 @@
|
|
|
63
65
|
<th class="px-4 py-2 text-right font-medium">Stock</th>
|
|
64
66
|
</tr>
|
|
65
67
|
</thead>
|
|
66
|
-
<tbody class="divide-y divide-[var(--
|
|
68
|
+
<tbody class="divide-y divide-[var(--bd)]">
|
|
67
69
|
{#each rows as row (row.id)}
|
|
68
70
|
<tr>
|
|
69
71
|
<td class="px-4 py-2">
|
|
@@ -77,12 +79,12 @@
|
|
|
77
79
|
<td class="px-4 py-2 text-right">{row.stock}</td>
|
|
78
80
|
</tr>
|
|
79
81
|
{:else}
|
|
80
|
-
<tr><td class="px-4 py-6 text-[var(--
|
|
82
|
+
<tr><td class="px-4 py-6 text-[var(--txs)]" colspan="4">No products found.</td></tr>
|
|
81
83
|
{/each}
|
|
82
84
|
</tbody>
|
|
83
85
|
</table>
|
|
84
86
|
</div>
|
|
85
87
|
{#snippet pending()}
|
|
86
|
-
<
|
|
88
|
+
<Text class="mt-6" color="secondary">Loading…</Text>
|
|
87
89
|
{/snippet}
|
|
88
90
|
</Boundary>
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { resolve } from '$app/paths';
|
|
3
|
+
import Span from '@zeyolabs/ui/text/Span.svelte';
|
|
4
|
+
import Text from '@zeyolabs/ui/text/Text.svelte';
|
|
5
|
+
|
|
3
6
|
import { shopContext } from '../../context';
|
|
7
|
+
import { Stock } from '../../stock/library';
|
|
4
8
|
import { Images } from '../../utils/images';
|
|
5
9
|
import { Money } from '../../utils/money';
|
|
6
|
-
import { Stock } from '../../stock/library';
|
|
7
10
|
|
|
8
11
|
type Product = {
|
|
9
12
|
comparePricePence: null | number;
|
|
@@ -47,29 +50,34 @@
|
|
|
47
50
|
/>
|
|
48
51
|
{/if}
|
|
49
52
|
{#if badge.kind === 'out'}
|
|
50
|
-
<
|
|
51
|
-
class="absolute top-2 left-2 rounded-full bg-white/95 px-2.5 py-1
|
|
52
|
-
|
|
53
|
+
<Span
|
|
54
|
+
class="absolute top-2 left-2 rounded-full bg-white/95 px-2.5 py-1 shadow-sm"
|
|
55
|
+
bold
|
|
56
|
+
color="secondary"
|
|
57
|
+
size="sm">Out of stock</Span
|
|
53
58
|
>
|
|
54
59
|
{:else if badge.kind === 'low'}
|
|
55
|
-
<
|
|
56
|
-
class="absolute top-2 left-2 rounded-full bg-white/95 px-2.5 py-1
|
|
57
|
-
|
|
60
|
+
<Span
|
|
61
|
+
class="absolute top-2 left-2 rounded-full bg-white/95 px-2.5 py-1 shadow-sm"
|
|
62
|
+
bold
|
|
63
|
+
color="secondary"
|
|
64
|
+
size="sm">Only {badge.count} left</Span
|
|
58
65
|
>
|
|
59
66
|
{:else if onSale}
|
|
60
|
-
<
|
|
61
|
-
class="absolute top-2 left-2 rounded-full bg-[var(--primary-strong)] px-2.5 py-1 text-
|
|
62
|
-
|
|
67
|
+
<Span
|
|
68
|
+
class="absolute top-2 left-2 rounded-full bg-[var(--primary-strong)] px-2.5 py-1 text-white"
|
|
69
|
+
bold
|
|
70
|
+
size="sm">Sale</Span
|
|
63
71
|
>
|
|
64
72
|
{/if}
|
|
65
73
|
</div>
|
|
66
74
|
<div class="px-2 pt-3 pb-2">
|
|
67
|
-
<
|
|
68
|
-
<
|
|
69
|
-
<
|
|
75
|
+
<Text bold>{product.name}</Text>
|
|
76
|
+
<Text class="mt-1" color="secondary">
|
|
77
|
+
<Span bold>{Money.format(product.pricePence)}</Span>
|
|
70
78
|
{#if onSale}
|
|
71
79
|
<s class="ml-1 text-sm">{Money.format(product.comparePricePence!)}</s>
|
|
72
80
|
{/if}
|
|
73
|
-
</
|
|
81
|
+
</Text>
|
|
74
82
|
</div>
|
|
75
83
|
</a>
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { resolve } from '$app/paths';
|
|
3
|
+
import Text from '@zeyolabs/ui/text/Text.svelte';
|
|
4
|
+
|
|
5
|
+
import type { getCategoryPage } from '../client.remote';
|
|
6
|
+
|
|
3
7
|
import { shopContext } from '../../context';
|
|
4
8
|
import PageLinks from '../../ui/PageLinks.svelte';
|
|
5
9
|
import PageTitle from '../../ui/PageTitle.svelte';
|
|
6
10
|
import ProductCard from '../components/ProductCard.svelte';
|
|
7
|
-
import type { getCategoryPage } from '../client.remote';
|
|
8
11
|
|
|
9
12
|
/** From the route's server `load` (`categoryLoad`). */
|
|
10
13
|
let { data }: { data: Awaited<ReturnType<typeof getCategoryPage>> } = $props();
|
|
@@ -12,25 +15,25 @@
|
|
|
12
15
|
const context = shopContext();
|
|
13
16
|
</script>
|
|
14
17
|
|
|
15
|
-
<
|
|
18
|
+
<Text class="mb-2"><a class="underline" href={resolve('/shop')}>All products</a></Text>
|
|
16
19
|
<PageTitle
|
|
17
20
|
description="Buy {data.category.name} from {context.siteName}."
|
|
18
21
|
title={data.category.name}
|
|
19
22
|
/>
|
|
20
23
|
|
|
21
24
|
{#if data.category.description}
|
|
22
|
-
<
|
|
25
|
+
<Text class="-mt-6 mb-6 max-w-prose whitespace-pre-line" color="secondary">
|
|
23
26
|
{data.category.description}
|
|
24
|
-
</
|
|
27
|
+
</Text>
|
|
25
28
|
{/if}
|
|
26
29
|
|
|
27
30
|
{#if data.products.length === 0}
|
|
28
|
-
<
|
|
31
|
+
<Text>No products available right now. Please check back soon.</Text>
|
|
29
32
|
{:else}
|
|
30
|
-
<
|
|
33
|
+
<Text class="mb-4" color="secondary">
|
|
31
34
|
{data.total}
|
|
32
35
|
{data.total === 1 ? 'product' : 'products'}{#if data.pages > 1}, page {data.page} of {data.pages}{/if}
|
|
33
|
-
</
|
|
36
|
+
</Text>
|
|
34
37
|
<ul class="grid grid-cols-2 gap-3 sm:gap-6 md:grid-cols-3 xl:grid-cols-4">
|
|
35
38
|
{#each data.products as product (product.id)}
|
|
36
39
|
<li><ProductCard {product} /></li>
|
|
@@ -2,21 +2,26 @@
|
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
|
|
4
4
|
import { resolve } from '$app/paths';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
5
|
+
import ShoppingBasket from '@lucide/svelte/icons/shopping-basket';
|
|
6
|
+
import { Form } from '@zeyolabs/ui/form';
|
|
7
|
+
import Button from '@zeyolabs/ui/form/Button.svelte';
|
|
8
|
+
import ImageGallery from '@zeyolabs/ui/gallery/ImageGallery.svelte';
|
|
9
|
+
import Span from '@zeyolabs/ui/text/Span.svelte';
|
|
10
|
+
import Text from '@zeyolabs/ui/text/Text.svelte';
|
|
11
|
+
import Title from '@zeyolabs/ui/text/Title.svelte';
|
|
12
|
+
|
|
13
|
+
import type { getProduct } from '../client.remote';
|
|
14
|
+
|
|
8
15
|
import { addToBasketForm } from '../../basket/client.remote';
|
|
9
16
|
import { AddToBasketSchema } from '../../basket/schema';
|
|
10
|
-
import type { getProduct } from '../client.remote';
|
|
11
|
-
import ShoppingBasket from '@lucide/svelte/icons/shopping-basket';
|
|
12
17
|
import { shopContext } from '../../context';
|
|
18
|
+
import Reviews from '../../reviews/components/Reviews.svelte';
|
|
19
|
+
import { Stock } from '../../stock/library';
|
|
20
|
+
import PageTitle from '../../ui/PageTitle.svelte';
|
|
21
|
+
import Stars from '../../ui/Stars.svelte';
|
|
13
22
|
import { Images } from '../../utils/images';
|
|
14
23
|
import { Money } from '../../utils/money';
|
|
15
|
-
import { Stock } from '../../stock/library';
|
|
16
24
|
import { ProductText } from '../library';
|
|
17
|
-
import { Form } from '@zeyolabs/ui/form';
|
|
18
|
-
import Button from '@zeyolabs/ui/form/Button.svelte';
|
|
19
|
-
import ImageGallery from '@zeyolabs/ui/gallery/ImageGallery.svelte';
|
|
20
25
|
|
|
21
26
|
let {
|
|
22
27
|
data,
|
|
@@ -63,14 +68,12 @@
|
|
|
63
68
|
</div>
|
|
64
69
|
|
|
65
70
|
<div class="flex flex-col">
|
|
66
|
-
<
|
|
67
|
-
{product.name}
|
|
68
|
-
</h1>
|
|
71
|
+
<Title level={1} size="lg">{product.name}</Title>
|
|
69
72
|
|
|
70
73
|
{#if data.reviews.average !== null}
|
|
71
74
|
<a
|
|
72
75
|
class="mt-3 flex w-fit items-center gap-2 text-sm text-[var(--txs)] no-underline hover:text-[var(--tx)]"
|
|
73
|
-
href="#reviews
|
|
76
|
+
href="#reviews"
|
|
74
77
|
>
|
|
75
78
|
<Stars rating={data.reviews.average} size="text-sm" />
|
|
76
79
|
{data.reviews.count}
|
|
@@ -79,38 +82,39 @@
|
|
|
79
82
|
{/if}
|
|
80
83
|
|
|
81
84
|
<div class="mt-5 flex flex-wrap items-baseline gap-x-3 gap-y-1">
|
|
82
|
-
|
|
83
|
-
>
|
|
85
|
+
<!-- eslint-disable-next-line svelte/no-restricted-html-elements -- the price is display-sized, bigger than any Span size -->
|
|
86
|
+
<span class="text-3xl font-semibold">{Money.format(product.pricePence)}</span>
|
|
84
87
|
{#if saving > 0}
|
|
85
88
|
<s class="text-lg text-[var(--txt)]">{Money.format(product.comparePricePence!)}</s>
|
|
86
|
-
<
|
|
87
|
-
class="rounded-full bg-[var(--primary-soft)] px-2.5 py-0.5 text-
|
|
89
|
+
<Span
|
|
90
|
+
class="rounded-full bg-[var(--primary-soft)] px-2.5 py-0.5 text-[var(--primary-strong)]"
|
|
91
|
+
bold
|
|
88
92
|
>
|
|
89
93
|
Save {saving}%
|
|
90
|
-
</
|
|
94
|
+
</Span>
|
|
91
95
|
{/if}
|
|
92
96
|
</div>
|
|
93
97
|
{#if product.packSize > 1}
|
|
94
|
-
<
|
|
98
|
+
<Text class="mt-1" color="secondary">Pack of {product.packSize}</Text>
|
|
95
99
|
{/if}
|
|
96
100
|
|
|
97
101
|
{#if product.shortDescription}
|
|
98
|
-
<
|
|
102
|
+
<Text class="mt-5" color="secondary">{product.shortDescription}</Text>
|
|
99
103
|
{/if}
|
|
100
104
|
|
|
101
105
|
{#if data.options.length > 1}
|
|
102
106
|
<div class="mt-6">
|
|
103
|
-
<
|
|
107
|
+
<Text bold>{data.variationName}</Text>
|
|
104
108
|
<ul class="mt-2 flex flex-wrap gap-2">
|
|
105
109
|
{#each data.options as option (option.slug)}
|
|
106
110
|
<li>
|
|
107
111
|
{#if option.slug === product.slug}
|
|
108
|
-
<
|
|
112
|
+
<div
|
|
109
113
|
class="inline-flex rounded-full border-2 border-[var(--primary-strong)] bg-[var(--primary-soft)] px-4 py-1.5 text-sm font-medium text-[var(--primary-strong)]"
|
|
110
114
|
aria-current="true"
|
|
111
115
|
>
|
|
112
116
|
{option.label}
|
|
113
|
-
</
|
|
117
|
+
</div>
|
|
114
118
|
{:else}
|
|
115
119
|
<a
|
|
116
120
|
class="inline-flex rounded-full border-2 border-[var(--bd)] px-4 py-1.5 text-sm text-[var(--tx)] no-underline transition hover:border-[var(--primary-strong)] hover:text-[var(--tx)]"
|
|
@@ -125,11 +129,12 @@
|
|
|
125
129
|
</div>
|
|
126
130
|
{/if}
|
|
127
131
|
|
|
128
|
-
<
|
|
132
|
+
<Text class="mt-6 flex items-center gap-2" bold>
|
|
133
|
+
<!-- eslint-disable-next-line svelte/no-restricted-html-elements -- a colour dot inside the line of text -->
|
|
129
134
|
<span class="size-2.5 rounded-full {STOCK_DOT[stockBadge.kind]}" aria-hidden="true"></span>
|
|
130
135
|
{#if stockBadge.kind === 'out'}Out of stock{:else if stockBadge.kind === 'low'}Only {stockBadge.count}
|
|
131
136
|
left{:else}In stock{/if}
|
|
132
|
-
</
|
|
137
|
+
</Text>
|
|
133
138
|
|
|
134
139
|
{#if product.stock > 0}
|
|
135
140
|
{const form = addToBasketForm.for(product.id)}
|
|
@@ -173,13 +178,15 @@
|
|
|
173
178
|
>
|
|
174
179
|
{#if text.paragraphs.length > 0}
|
|
175
180
|
<div class="max-w-prose">
|
|
176
|
-
<
|
|
181
|
+
<Title level={2} size="md">About this product</Title>
|
|
177
182
|
{#snippet paragraph(p: { heading: null | string; text: string })}
|
|
178
183
|
<div class="mt-5">
|
|
179
|
-
{#if p.heading}<
|
|
184
|
+
{#if p.heading}<Title level={3} size="sm">
|
|
180
185
|
{p.heading}
|
|
181
|
-
</
|
|
182
|
-
<
|
|
186
|
+
</Title>{/if}
|
|
187
|
+
<Text class="whitespace-pre-line {p.heading ? 'mt-1' : ''}" color="secondary"
|
|
188
|
+
>{p.text}</Text
|
|
189
|
+
>
|
|
183
190
|
</div>
|
|
184
191
|
{/snippet}
|
|
185
192
|
{#each text.paragraphs.slice(0, visible) as p, i (i)}
|
|
@@ -201,7 +208,7 @@
|
|
|
201
208
|
{/if}
|
|
202
209
|
{#if text.specs.length > 4}
|
|
203
210
|
<div>
|
|
204
|
-
<
|
|
211
|
+
<Title level={2} size="md">Specifications</Title>
|
|
205
212
|
<dl class="mt-5 divide-y divide-[var(--bd)] border-y border-[var(--bd)] text-sm">
|
|
206
213
|
{#each text.specs as spec (spec.label)}
|
|
207
214
|
<div class="flex justify-between gap-6 py-2.5">
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import Text from '@zeyolabs/ui/text/Text.svelte';
|
|
3
|
+
|
|
4
|
+
import type { searchShop } from '../client.remote';
|
|
5
|
+
|
|
2
6
|
import PageTitle from '../../ui/PageTitle.svelte';
|
|
3
7
|
import ProductCard from '../components/ProductCard.svelte';
|
|
4
|
-
import type { searchShop } from '../client.remote';
|
|
5
8
|
|
|
6
9
|
let {
|
|
7
10
|
search,
|
|
@@ -36,14 +39,16 @@
|
|
|
36
39
|
</form>
|
|
37
40
|
|
|
38
41
|
{#if search.query === ''}
|
|
39
|
-
<
|
|
42
|
+
<Text color="secondary">Type what you are looking for.</Text>
|
|
40
43
|
{:else if search.products.length === 0}
|
|
41
|
-
<
|
|
44
|
+
<Text>Nothing matches "{search.query}". Try fewer or different words.</Text>
|
|
42
45
|
{:else}
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
<div class="mb-4" aria-live="polite">
|
|
47
|
+
<Text color="secondary">
|
|
48
|
+
{search.products.length === 48 ? 'Top 48' : search.products.length}
|
|
49
|
+
{search.products.length === 1 ? 'result' : 'results'} for "{search.query}"
|
|
50
|
+
</Text>
|
|
51
|
+
</div>
|
|
47
52
|
<ul class="grid gap-6 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4">
|
|
48
53
|
{#each search.products as product (product.id)}
|
|
49
54
|
<li><ProductCard {product} /></li>
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { resolve } from '$app/paths';
|
|
3
|
+
import Text from '@zeyolabs/ui/text/Text.svelte';
|
|
4
|
+
|
|
5
|
+
import type { getShop } from '../client.remote';
|
|
6
|
+
|
|
3
7
|
import PageLinks from '../../ui/PageLinks.svelte';
|
|
4
8
|
import PageTitle from '../../ui/PageTitle.svelte';
|
|
5
9
|
import ProductCard from '../components/ProductCard.svelte';
|
|
6
|
-
import type { getShop } from '../client.remote';
|
|
7
10
|
|
|
8
11
|
let {
|
|
9
12
|
description,
|
|
@@ -22,7 +25,7 @@
|
|
|
22
25
|
<PageTitle {description} title="Shop" />
|
|
23
26
|
|
|
24
27
|
{#if intro}
|
|
25
|
-
<
|
|
28
|
+
<Text class="-mt-6 mb-6 max-w-prose" color="secondary">{intro}</Text>
|
|
26
29
|
{/if}
|
|
27
30
|
|
|
28
31
|
<nav class="mb-8" aria-label="Categories">
|
|
@@ -40,7 +43,7 @@
|
|
|
40
43
|
|
|
41
44
|
<!-- In stock first (the query sorts by it, then sort order and name), one page at a time. -->
|
|
42
45
|
{#if shop.products.length === 0}
|
|
43
|
-
<
|
|
46
|
+
<Text>No products available right now. Please check back soon.</Text>
|
|
44
47
|
{:else}
|
|
45
48
|
<ul class="grid grid-cols-2 gap-3 sm:gap-6 md:grid-cols-3 xl:grid-cols-4">
|
|
46
49
|
{#each shop.products as product (product.id)}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { resolve } from '$app/paths';
|
|
3
3
|
import { page } from '$app/state';
|
|
4
|
-
import PageTitle from '../../ui/PageTitle.svelte';
|
|
5
|
-
import { getCheckoutOrder } from '../../orders/client.remote';
|
|
6
4
|
import Boundary from '@zeyolabs/ui/boundary/Boundary.svelte';
|
|
7
5
|
import SkeletonText from '@zeyolabs/ui/skeleton/SkeletonText.svelte';
|
|
6
|
+
import Text from '@zeyolabs/ui/text/Text.svelte';
|
|
7
|
+
|
|
8
|
+
import { getCheckoutOrder } from '../../orders/client.remote';
|
|
9
|
+
import PageTitle from '../../ui/PageTitle.svelte';
|
|
8
10
|
|
|
9
11
|
const sessionId = page.url.searchParams.get('session_id') ?? '';
|
|
10
12
|
</script>
|
|
@@ -15,22 +17,22 @@
|
|
|
15
17
|
<!-- `/checkout/complete` has already fulfilled the order and emptied the basket on the server. -->
|
|
16
18
|
{const order = $derived(sessionId ? await getCheckoutOrder(sessionId) : null)}
|
|
17
19
|
{#if order}
|
|
18
|
-
<
|
|
20
|
+
<Text>
|
|
19
21
|
Your order number is <strong>{order.number}</strong>. A confirmation email is on its way.
|
|
20
|
-
</
|
|
22
|
+
</Text>
|
|
21
23
|
{#if order.orderPath}
|
|
22
24
|
<!-- eslint-disable-next-line svelte/no-navigation-without-resolve -- token path built server-side -->
|
|
23
|
-
<
|
|
25
|
+
<Text class="mt-4"><a class="btn default" href={order.orderPath}>View your order</a></Text>
|
|
24
26
|
{/if}
|
|
25
27
|
{:else}
|
|
26
|
-
<
|
|
28
|
+
<Text>
|
|
27
29
|
Thank you. Your payment is being confirmed and your order number will be emailed to you
|
|
28
30
|
shortly.
|
|
29
|
-
</
|
|
31
|
+
</Text>
|
|
30
32
|
{/if}
|
|
31
33
|
|
|
32
34
|
{#snippet pending()}
|
|
33
35
|
<SkeletonText lines={2} />
|
|
34
36
|
{/snippet}
|
|
35
37
|
</Boundary>
|
|
36
|
-
<
|
|
38
|
+
<Text class="mt-6"><a class="underline" href={resolve('/')}>Back to the shop</a></Text>
|