@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,13 +1,16 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { resolve } from '$app/paths';
|
|
3
3
|
import { page } from '$app/state';
|
|
4
|
-
import
|
|
5
|
-
import { getReviews, moderateReviewForm } from '../admin.remote';
|
|
6
|
-
import { ModerateReviewSchema } from '../schema';
|
|
4
|
+
import Boundary from '@zeyolabs/ui/boundary/Boundary.svelte';
|
|
7
5
|
import { Form } from '@zeyolabs/ui/form';
|
|
8
6
|
import Button from '@zeyolabs/ui/form/Button.svelte';
|
|
9
|
-
import
|
|
7
|
+
import Text from '@zeyolabs/ui/text/Text.svelte';
|
|
8
|
+
import Title from '@zeyolabs/ui/text/Title.svelte';
|
|
9
|
+
|
|
10
10
|
import { shopContext } from '../../context';
|
|
11
|
+
import { REVIEW_STATUSES, type ReviewStatus } from '../../db/schema';
|
|
12
|
+
import { getReviews, moderateReviewForm } from '../admin.remote';
|
|
13
|
+
import { ModerateReviewSchema } from '../schema';
|
|
11
14
|
|
|
12
15
|
const context = shopContext();
|
|
13
16
|
const status = $derived.by((): ReviewStatus => {
|
|
@@ -24,17 +27,17 @@
|
|
|
24
27
|
|
|
25
28
|
<svelte:head><title>Reviews · Admin</title></svelte:head>
|
|
26
29
|
|
|
27
|
-
<
|
|
28
|
-
<
|
|
30
|
+
<Title level={1} size="md">Reviews</Title>
|
|
31
|
+
<Text class="mt-1" color="secondary">
|
|
29
32
|
Customers review items from their order page. A review shows on the product page once approved.
|
|
30
|
-
</
|
|
33
|
+
</Text>
|
|
31
34
|
|
|
32
35
|
<nav class="mt-4 flex gap-2" aria-label="Review status">
|
|
33
36
|
{#each REVIEW_STATUSES as s (s)}
|
|
34
37
|
<a
|
|
35
38
|
class="rounded-full border px-3 py-1 text-sm no-underline {s === status
|
|
36
|
-
? 'border-[var(--
|
|
37
|
-
: 'border-[var(--
|
|
39
|
+
? 'border-[var(--acc)] bg-[var(--acc)] text-white'
|
|
40
|
+
: 'border-[var(--bd)] bg-white text-[var(--tx)]'}"
|
|
38
41
|
aria-current={s === status ? 'page' : undefined}
|
|
39
42
|
href="{resolve('/reviews')}?status={s}">{LABELS[s]}</a
|
|
40
43
|
>
|
|
@@ -44,13 +47,13 @@
|
|
|
44
47
|
<Boundary message="Could not load reviews.">
|
|
45
48
|
{let rows = $derived(await getReviews(status))}
|
|
46
49
|
{#if rows.length === 0}
|
|
47
|
-
<
|
|
50
|
+
<Text class="mt-6" color="secondary">Nothing here.</Text>
|
|
48
51
|
{:else}
|
|
49
52
|
<ul class="mt-4 space-y-4">
|
|
50
53
|
{#each rows as review (review.id)}
|
|
51
54
|
{const form = moderateReviewForm.for(review.id)}
|
|
52
|
-
<li class="rounded-xl border border-[var(--
|
|
53
|
-
<
|
|
55
|
+
<li class="rounded-xl border border-[var(--bd)] bg-white p-4">
|
|
56
|
+
<Text color="secondary">
|
|
54
57
|
<!-- eslint-disable-next-line svelte/no-navigation-without-resolve -- the shop's own domain -->
|
|
55
58
|
<a href="{context.siteUrl}/product/{review.productSlug}" rel="noopener" target="_blank"
|
|
56
59
|
>{review.productName}</a
|
|
@@ -60,15 +63,16 @@
|
|
|
60
63
|
>{review.orderNumber}</a
|
|
61
64
|
>
|
|
62
65
|
· {review.email} · {date.format(review.createdAt)}
|
|
63
|
-
</
|
|
64
|
-
<
|
|
65
|
-
|
|
66
|
+
</Text>
|
|
67
|
+
<Text class="mt-2">
|
|
68
|
+
<!-- eslint-disable-next-line svelte/no-restricted-html-elements -- star glyphs with an aria-label, which Span does not take -->
|
|
69
|
+
<span class="text-[var(--acc)]" aria-label="{review.rating} out of 5"
|
|
66
70
|
>{'★'.repeat(review.rating)}{'☆'.repeat(5 - review.rating)}</span
|
|
67
71
|
>
|
|
68
72
|
{#if review.title}<strong class="ml-2">{review.title}</strong>{/if}
|
|
69
|
-
</
|
|
70
|
-
<
|
|
71
|
-
<
|
|
73
|
+
</Text>
|
|
74
|
+
<Text class="mt-2 whitespace-pre-line">{review.body}</Text>
|
|
75
|
+
<Text class="mt-2">by {review.name}</Text>
|
|
72
76
|
<Form
|
|
73
77
|
class="mt-3 flex gap-2"
|
|
74
78
|
{form}
|
|
@@ -90,6 +94,6 @@
|
|
|
90
94
|
</ul>
|
|
91
95
|
{/if}
|
|
92
96
|
{#snippet pending()}
|
|
93
|
-
<
|
|
97
|
+
<Text class="mt-6" color="secondary">Loading…</Text>
|
|
94
98
|
{/snippet}
|
|
95
99
|
</Boundary>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { reviewForm } from '../client.remote';
|
|
3
|
-
import { ReviewSchema } from '../schema';
|
|
4
2
|
import { Form, MessageField, SelectField, TextField } from '@zeyolabs/ui/form';
|
|
5
3
|
import Button from '@zeyolabs/ui/form/Button.svelte';
|
|
6
4
|
|
|
5
|
+
import { reviewForm } from '../client.remote';
|
|
6
|
+
import { ReviewSchema } from '../schema';
|
|
7
|
+
|
|
7
8
|
let {
|
|
8
9
|
name,
|
|
9
10
|
number,
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import Span from '@zeyolabs/ui/text/Span.svelte';
|
|
3
|
+
import Text from '@zeyolabs/ui/text/Text.svelte';
|
|
4
|
+
import Title from '@zeyolabs/ui/text/Title.svelte';
|
|
5
|
+
|
|
2
6
|
import Stars from '../../ui/Stars.svelte';
|
|
3
7
|
|
|
4
8
|
type Review = {
|
|
@@ -16,31 +20,31 @@
|
|
|
16
20
|
const date = new Intl.DateTimeFormat('en-GB', { dateStyle: 'medium', timeZone: 'Europe/London' });
|
|
17
21
|
</script>
|
|
18
22
|
|
|
19
|
-
<section class="mt-12" aria-
|
|
20
|
-
<
|
|
23
|
+
<section id="reviews" class="mt-12" aria-label="Reviews">
|
|
24
|
+
<Title level={2} size="md">Reviews</Title>
|
|
21
25
|
{#if reviews.count === 0 || reviews.average === null}
|
|
22
|
-
<
|
|
26
|
+
<Text class="mt-2" color="secondary">
|
|
23
27
|
No reviews yet. Bought this? You can review it from your order page.
|
|
24
|
-
</
|
|
28
|
+
</Text>
|
|
25
29
|
{:else}
|
|
26
|
-
<
|
|
30
|
+
<Text class="mt-2 flex items-center gap-2">
|
|
27
31
|
<Stars rating={reviews.average} />
|
|
28
|
-
<
|
|
32
|
+
<Span
|
|
29
33
|
>{reviews.average} out of 5, from {reviews.count}
|
|
30
|
-
{reviews.count === 1 ? 'review' : 'reviews'}</
|
|
34
|
+
{reviews.count === 1 ? 'review' : 'reviews'}</Span
|
|
31
35
|
>
|
|
32
|
-
</
|
|
36
|
+
</Text>
|
|
33
37
|
<ul class="mt-4 divide-y divide-[var(--bd)] border-y border-[var(--bd)]">
|
|
34
38
|
{#each reviews.list as review (review.id)}
|
|
35
39
|
<li class="py-4">
|
|
36
|
-
<
|
|
40
|
+
<Text class="flex flex-wrap items-center gap-2">
|
|
37
41
|
<Stars rating={review.rating} size="text-sm" />
|
|
38
42
|
{#if review.title}<strong>{review.title}</strong>{/if}
|
|
39
|
-
</
|
|
40
|
-
<
|
|
41
|
-
<
|
|
43
|
+
</Text>
|
|
44
|
+
<Text class="mt-2 whitespace-pre-line">{review.body}</Text>
|
|
45
|
+
<Text class="mt-2" color="secondary">
|
|
42
46
|
{review.name}, verified buyer, {date.format(review.createdAt)}
|
|
43
|
-
</
|
|
47
|
+
</Text>
|
|
44
48
|
</li>
|
|
45
49
|
{/each}
|
|
46
50
|
</ul>
|
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { getStock } from '../admin.remote';
|
|
3
|
-
import StockRow from './StockRow.svelte';
|
|
4
2
|
import Badge from '@zeyolabs/ui/badge/Badge.svelte';
|
|
5
3
|
import Boundary from '@zeyolabs/ui/boundary/Boundary.svelte';
|
|
4
|
+
import Text from '@zeyolabs/ui/text/Text.svelte';
|
|
5
|
+
import Title from '@zeyolabs/ui/text/Title.svelte';
|
|
6
|
+
|
|
7
|
+
import { getStock } from '../admin.remote';
|
|
8
|
+
import StockRow from './StockRow.svelte';
|
|
6
9
|
</script>
|
|
7
10
|
|
|
8
11
|
<svelte:head><title>Stock</title></svelte:head>
|
|
9
12
|
|
|
10
|
-
<
|
|
11
|
-
<
|
|
13
|
+
<Title level={1} size="md">Stock</Title>
|
|
14
|
+
<Text class="mt-1" color="secondary">
|
|
12
15
|
Setting a sold-out product above 0 emails the customers waiting for it, up to 50 a minute, and
|
|
13
16
|
removes them from the list.
|
|
14
|
-
</
|
|
17
|
+
</Text>
|
|
15
18
|
|
|
16
19
|
<Boundary message="Could not load stock.">
|
|
17
20
|
{let rows = $derived(await getStock())}
|
|
18
|
-
<div class="mt-4 overflow-x-auto rounded-xl border border-[var(--
|
|
21
|
+
<div class="mt-4 overflow-x-auto rounded-xl border border-[var(--bd)] bg-white">
|
|
19
22
|
<table class="w-full text-left text-sm">
|
|
20
|
-
<thead class="border-b border-[var(--
|
|
23
|
+
<thead class="border-b border-[var(--bd)] text-[var(--txs)]">
|
|
21
24
|
<tr>
|
|
22
25
|
<th class="px-4 py-2 font-medium">Product</th>
|
|
23
26
|
<th class="px-4 py-2 font-medium">SKU</th>
|
|
@@ -25,7 +28,7 @@
|
|
|
25
28
|
<th class="px-4 py-2 text-right font-medium">Stock</th>
|
|
26
29
|
</tr>
|
|
27
30
|
</thead>
|
|
28
|
-
<tbody class="divide-y divide-[var(--
|
|
31
|
+
<tbody class="divide-y divide-[var(--bd)]">
|
|
29
32
|
{#each rows as row (row.id)}
|
|
30
33
|
<tr>
|
|
31
34
|
<td class="px-4 py-2 font-medium">
|
|
@@ -47,6 +50,6 @@
|
|
|
47
50
|
</table>
|
|
48
51
|
</div>
|
|
49
52
|
{#snippet pending()}
|
|
50
|
-
<
|
|
53
|
+
<Text class="mt-6" color="secondary">Loading…</Text>
|
|
51
54
|
{/snippet}
|
|
52
55
|
</Boundary>
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { setStockForm } from '../admin.remote';
|
|
3
|
-
import { StockSchema } from '../schema';
|
|
4
2
|
import { Form, NumberField } from '@zeyolabs/ui/form';
|
|
5
3
|
import Button from '@zeyolabs/ui/form/Button.svelte';
|
|
6
4
|
import Span from '@zeyolabs/ui/text/Span.svelte';
|
|
7
5
|
|
|
6
|
+
import { setStockForm } from '../admin.remote';
|
|
7
|
+
import { StockSchema } from '../schema';
|
|
8
|
+
|
|
8
9
|
let { id, name, stock }: { id: number; name: string; stock: number } = $props();
|
|
9
10
|
|
|
10
11
|
const form = $derived(setStockForm.for(id));
|
package/ui/PageLinks.svelte
CHANGED
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
{/if}
|
|
27
27
|
{#each Paging.window(page, pages) as n, i (n ?? `gap-${i}`)}
|
|
28
28
|
{#if n === null}
|
|
29
|
-
<
|
|
29
|
+
<div class="{box} text-[var(--txt)]" aria-hidden="true">…</div>
|
|
30
30
|
{:else if n === page}
|
|
31
|
-
<
|
|
31
|
+
<div class="{box} bg-[var(--primary-strong)] font-medium text-white" aria-current="page">
|
|
32
32
|
{n}
|
|
33
|
-
</
|
|
33
|
+
</div>
|
|
34
34
|
{:else}
|
|
35
35
|
<a class={link} aria-label="Page {n}" href={href(n)}>{n}</a>
|
|
36
36
|
{/if}
|
package/ui/PageTitle.svelte
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { page } from '$app/state';
|
|
3
|
+
import Title from '@zeyolabs/ui/text/Title.svelte';
|
|
3
4
|
|
|
4
5
|
import { shopContext } from '../context';
|
|
5
6
|
|
|
@@ -35,5 +36,5 @@
|
|
|
35
36
|
</svelte:head>
|
|
36
37
|
|
|
37
38
|
{#if heading}
|
|
38
|
-
<
|
|
39
|
+
<Title class="mb-10 text-[var(--primary-strong)]" level={1}>{title}</Title>
|
|
39
40
|
{/if}
|
package/ui/Stars.svelte
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
const pct = $derived(`${Math.max(0, Math.min(5, rating)) * 20}%`);
|
|
5
5
|
</script>
|
|
6
6
|
|
|
7
|
+
<!-- eslint-disable svelte/no-restricted-html-elements -- an inline glyph graphic, not text -->
|
|
7
8
|
<span
|
|
8
9
|
class="relative inline-block leading-none {size}"
|
|
9
10
|
aria-label="{rating} out of 5 stars"
|
|
@@ -11,8 +12,9 @@
|
|
|
11
12
|
>
|
|
12
13
|
<span class="text-[var(--bd)]" aria-hidden="true">★★★★★</span>
|
|
13
14
|
<span
|
|
14
|
-
class="absolute inset-0 overflow-hidden whitespace-nowrap text-[var(--primary-strong)]"
|
|
15
15
|
style:width={pct}
|
|
16
|
+
class="absolute inset-0 overflow-hidden whitespace-nowrap text-[var(--primary-strong)]"
|
|
16
17
|
aria-hidden="true">★★★★★</span
|
|
17
18
|
>
|
|
18
19
|
</span>
|
|
20
|
+
<!-- eslint-enable svelte/no-restricted-html-elements -->
|