@shopbite-de/storefront 1.28.0 β†’ 1.29.0

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/README.md CHANGED
@@ -32,20 +32,20 @@ talking to the Store API and to the custom routes added by the
32
32
 
33
33
  ## Features
34
34
 
35
- | | |
36
- | ----------------------------- | --------------------------------------------------------------------------- |
37
- | πŸ•’ **Opening hours** | Multi-interval business hours per weekday, live open/closed state |
38
- | πŸ“… **Delivery slots** | 5-minute increments, respects prep time, holidays and closing times |
39
- | πŸ§€ **Extras & toppings** | Configurable products grouped into container line items (UUID v5 reference) |
40
- | πŸ“ **Address autocomplete** | Geoapify via a server proxy β€” the API key never reaches the browser |
41
- | 🚚 **Delivery zones** | City/postcode validation before checkout even starts |
42
- | 🎟️ **Vouchers** | Discount codes backed by the ShopBite plugin |
43
- | πŸ“± **Installable PWA** | Offline-aware service worker, app manifest, mobile bottom navigation |
44
- | ⚑ **SSR + caching** | Server routes with tuned TTLs for products, listings, categories |
45
- | πŸ” **SEO ready** | Sitemap, canonical URLs, share previews, title template, structured data |
46
- | πŸ“Š **Analytics & monitoring** | Matomo via `@nuxt/scripts`, error tracking via Sentry |
47
- | 🎨 **Themeable** | Nuxt UI + Tailwind v4 tokens β€” brand a shop by overriding CSS variables |
48
- | 🌐 **Multi-channel** | Optional sales channel switching for multi-location businesses |
35
+ | | |
36
+ | --------------------------- | --------------------------------------------------------------------------- |
37
+ | πŸ•’ **Opening hours** | Multi-interval business hours per weekday, live open/closed state |
38
+ | πŸ“… **Delivery slots** | 5-minute increments, respects prep time, holidays and closing times |
39
+ | πŸ§€ **Extras & toppings** | Configurable products grouped into container line items (UUID v5 reference) |
40
+ | πŸ“ **Address autocomplete** | Geoapify via a server proxy β€” the API key never reaches the browser |
41
+ | 🚚 **Delivery zones** | City/postcode validation before checkout even starts |
42
+ | 🎟️ **Vouchers** | Discount codes backed by the ShopBite plugin |
43
+ | πŸ“± **Installable PWA** | Offline-aware service worker, app manifest, mobile bottom navigation |
44
+ | ⚑ **SSR + caching** | Server routes with tuned TTLs for products, listings, categories |
45
+ | πŸ” **SEO ready** | Sitemap, canonical URLs, share previews, title template, structured data |
46
+ | πŸ“Š **Analytics** | Matomo via `@nuxt/scripts` |
47
+ | 🎨 **Themeable** | Nuxt UI + Tailwind v4 tokens β€” brand a shop by overriding CSS variables |
48
+ | 🌐 **Multi-channel** | Optional sales channel switching for multi-location businesses |
49
49
 
50
50
  ## Quick start
51
51
 
@@ -0,0 +1,68 @@
1
+ <script setup lang="ts">
2
+ import ProductCard from "~/components/Product/Card.vue";
3
+
4
+ // The top sellers (`markAsTopseller`) as a grid of the regular product
5
+ // cards; a tap opens the quick view (#325). Replaces the horizontal
6
+ // scroller and the marquee of the old home page (#388). Renders nothing
7
+ // without top sellers.
8
+ withDefaults(
9
+ defineProps<{
10
+ title?: string;
11
+ description?: string;
12
+ headline?: string;
13
+ }>(),
14
+ {
15
+ title: "Beliebt bei unseren GΓ€sten",
16
+ description: undefined,
17
+ headline: undefined,
18
+ },
19
+ );
20
+
21
+ const { loadTopSellers } = useTopSellers();
22
+
23
+ const { data: topSellers } = await useAsyncData("top-sellers", () =>
24
+ loadTopSellers(),
25
+ );
26
+
27
+ const products = computed(() => topSellers.value ?? []);
28
+ const quickView = useProductQuickView(products);
29
+ </script>
30
+
31
+ <template>
32
+ <UPageSection
33
+ v-if="products.length > 0"
34
+ id="highlights"
35
+ :title="title"
36
+ :description="description"
37
+ :headline="headline"
38
+ :links="[
39
+ {
40
+ label: 'Zur Speisekarte',
41
+ to: '/speisekarte/',
42
+ color: 'primary',
43
+ variant: 'subtle',
44
+ trailingIcon: 'i-lucide-arrow-right',
45
+ },
46
+ ]"
47
+ :ui="{ container: 'py-12 sm:py-16 lg:py-20' }"
48
+ >
49
+ <div
50
+ class="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4"
51
+ data-testid="highlights"
52
+ >
53
+ <ProductCard
54
+ v-for="product in products"
55
+ :key="product.id"
56
+ :product="product"
57
+ :with-favorite-button="false"
58
+ :selectable="true"
59
+ @select="quickView.show"
60
+ />
61
+ </div>
62
+ <LazyProductQuickView
63
+ v-if="quickView.mounted.value"
64
+ v-model:open="quickView.open.value"
65
+ :product="quickView.product.value"
66
+ />
67
+ </UPageSection>
68
+ </template>
@@ -0,0 +1,148 @@
1
+ <script setup lang="ts">
2
+ import type { Schemas } from "#shopware";
3
+
4
+ // Tiles of the menu sections directly below the hero (#388): the children
5
+ // of the menu root (`menuCategoryId`, else the navigation root) with the
6
+ // category photo from Shopware (`category.media`) or, without one, the
7
+ // section icon on the brand colour. Every tile links to its listing.
8
+ const props = withDefaults(
9
+ defineProps<{
10
+ title?: string;
11
+ description?: string;
12
+ headline?: string;
13
+ /** Tiles shown before the "all sections" tile. */
14
+ limit?: number;
15
+ }>(),
16
+ {
17
+ title: "Unsere Speisekarte",
18
+ description: undefined,
19
+ headline: undefined,
20
+ limit: 8,
21
+ },
22
+ );
23
+
24
+ const { apiClient } = useShopwareContext();
25
+ const config = useRuntimeConfig();
26
+ const rootId = config.public.shopBite.menuCategoryId || "main-navigation";
27
+
28
+ const { data: categories } = await useAsyncData(
29
+ "home-menu-categories",
30
+ async () => {
31
+ const response = await apiClient.invoke(
32
+ "readNavigation post /navigation/{activeId}/{rootId}",
33
+ {
34
+ body: {
35
+ depth: 1,
36
+ // Sent as a POST body so the projection is honoured (#312).
37
+ includes: {
38
+ category: [
39
+ "id",
40
+ "name",
41
+ "translated",
42
+ "seoUrl",
43
+ "customFields",
44
+ "media",
45
+ ],
46
+ media: ["url", "thumbnails", "metaData"],
47
+ media_thumbnail: ["url", "width"],
48
+ },
49
+ },
50
+ pathParams: { activeId: "main-navigation", rootId },
51
+ },
52
+ );
53
+ return response.data;
54
+ },
55
+ );
56
+
57
+ const tiles = computed(() =>
58
+ (categories.value ?? []).filter((category) => category.seoUrl),
59
+ );
60
+ const visible = computed(() => tiles.value.slice(0, props.limit));
61
+ const hasMore = computed(() => tiles.value.length > props.limit);
62
+
63
+ function name(category: Schemas["Category"]) {
64
+ return category.translated?.name ?? category.name;
65
+ }
66
+
67
+ function icon(category: Schemas["Category"]) {
68
+ return (
69
+ (category.customFields as Record<string, string> | null)
70
+ ?.shopbite_category_icon ?? "i-lucide-utensils"
71
+ );
72
+ }
73
+ </script>
74
+
75
+ <template>
76
+ <UPageSection
77
+ v-if="tiles.length > 0"
78
+ id="speisekarte"
79
+ :title="title"
80
+ :description="description"
81
+ :headline="headline"
82
+ :ui="{ container: 'py-12 sm:py-16 lg:py-20' }"
83
+ >
84
+ <ul
85
+ class="grid grid-cols-2 gap-3 sm:grid-cols-3 sm:gap-4 lg:grid-cols-4"
86
+ data-testid="menu-categories"
87
+ >
88
+ <li v-for="category in visible" :key="category.id">
89
+ <NuxtLink
90
+ :to="category.seoUrl"
91
+ class="group relative isolate flex aspect-[4/3] overflow-hidden rounded-xl bg-neutral-950 ring ring-default transition-shadow hover:shadow-lg hover:ring-primary/40 focus-visible:outline-2 focus-visible:outline-primary"
92
+ >
93
+ <img
94
+ v-if="category.media?.url"
95
+ :src="category.media.url"
96
+ :srcset="mediaSrcSet(category.media)"
97
+ sizes="(min-width: 1024px) 300px, (min-width: 640px) 33vw, 50vw"
98
+ :width="mediaSize(category.media)?.width"
99
+ :height="mediaSize(category.media)?.height"
100
+ alt=""
101
+ loading="lazy"
102
+ decoding="async"
103
+ class="absolute inset-0 -z-20 h-full w-full object-cover transition-transform duration-500 group-hover:scale-105"
104
+ />
105
+ <div
106
+ v-else
107
+ class="absolute inset-0 -z-20 flex items-center justify-center bg-gradient-to-br from-brand-500 to-brand-800 text-white/80"
108
+ aria-hidden="true"
109
+ >
110
+ <UIcon :name="icon(category)" class="size-12 sm:size-16" />
111
+ </div>
112
+ <div
113
+ class="absolute inset-0 -z-10 bg-gradient-to-t from-neutral-950/85 via-neutral-950/30 to-transparent"
114
+ aria-hidden="true"
115
+ />
116
+ <span
117
+ class="mt-auto flex w-full items-center justify-between gap-2 p-3 text-white sm:p-4"
118
+ >
119
+ <span class="flex min-w-0 items-center gap-2">
120
+ <UIcon
121
+ v-if="category.media?.url"
122
+ :name="icon(category)"
123
+ class="size-4 shrink-0 text-white/80"
124
+ />
125
+ <span class="truncate text-base font-bold sm:text-lg">
126
+ {{ name(category) }}
127
+ </span>
128
+ </span>
129
+ <UIcon
130
+ name="i-lucide-arrow-right"
131
+ class="size-4 shrink-0 text-white/80 transition-transform group-hover:translate-x-0.5"
132
+ />
133
+ </span>
134
+ </NuxtLink>
135
+ </li>
136
+ <li v-if="hasMore">
137
+ <NuxtLink
138
+ to="/speisekarte/"
139
+ class="flex aspect-[4/3] flex-col items-center justify-center gap-2 rounded-xl bg-elevated text-primary ring ring-default transition-shadow hover:shadow-lg hover:ring-primary/40 focus-visible:outline-2 focus-visible:outline-primary"
140
+ >
141
+ <UIcon name="i-lucide-layout-grid" class="size-8" />
142
+ <span class="font-bold">Alle Kategorien</span>
143
+ <span class="text-sm text-muted">{{ tiles.length }} Bereiche</span>
144
+ </NuxtLink>
145
+ </li>
146
+ </ul>
147
+ </UPageSection>
148
+ </template>
@@ -44,7 +44,17 @@ useRestaurantSchema();
44
44
  :usps="page.hero.usps"
45
45
  />
46
46
 
47
- <Topseller />
47
+ <HomeMenuCategories
48
+ :title="page.menu?.title"
49
+ :description="page.menu?.description"
50
+ :headline="page.menu?.headline"
51
+ />
52
+
53
+ <HomeHighlights
54
+ :title="page.highlights?.title"
55
+ :description="page.highlights?.description"
56
+ :headline="page.highlights?.headline"
57
+ />
48
58
 
49
59
  <USeparator :ui="{ border: 'border-primary/30' }" />
50
60
 
@@ -55,16 +65,6 @@ useRestaurantSchema();
55
65
  :features="page.features.features"
56
66
  />
57
67
 
58
- <USeparator :ui="{ border: 'border-primary/30' }" />
59
-
60
- <LazyFoodMarquee
61
- v-if="page.marquee.items?.length > 0"
62
- :title="page.marquee.title"
63
- :description="page.marquee.description"
64
- :headline="page.marquee.headline"
65
- :items="page.marquee.items"
66
- />
67
-
68
68
  <UPageSection
69
69
  v-if="page.mittagstisch"
70
70
  :reverse="page.mittagstisch.reverse"
@@ -85,6 +85,7 @@ useRestaurantSchema();
85
85
  </UPageSection>
86
86
 
87
87
  <ImageGallery
88
+ v-if="page.gallery?.images?.length"
88
89
  :title="page.gallery.title"
89
90
  :description="page.gallery.description"
90
91
  :headline="page.gallery.headline"
package/content/index.yml CHANGED
@@ -58,11 +58,14 @@ features:
58
58
  link:
59
59
  label: 06104 77777 anrufen
60
60
  to: "tel:+490610477777"
61
- marquee:
62
- title: Das lieben unsere Kunden
63
- description: Kundenbilder
61
+ menu:
64
62
  headline: SHOPBITE
65
- items:
63
+ title: Unsere Speisekarte
64
+ description: Pizza, Pasta, Fleisch und Fisch, frisch aus der KΓΌche.
65
+ highlights:
66
+ headline: SHOPBITE
67
+ title: Beliebt bei unseren GΓ€sten
68
+ description: Die Gerichte, die am hΓ€ufigsten bestellt werden.
66
69
  gallery:
67
70
  title: Restaurant
68
71
  description: Genießen Sie leckeres Essen in einem rustikalen und gemΓΌtlichen Ambiente.
package/content.config.ts CHANGED
@@ -84,23 +84,21 @@ export default defineContentConfig({
84
84
  features: createBaseSchema().extend({
85
85
  features: z.array(createFeatureSchema()),
86
86
  }),
87
- marquee: createBaseSchema().extend({
88
- items: z.array(
89
- z.object({
90
- image: z.string().nonempty(),
91
- productId: z.string().nonempty(),
92
- }),
93
- ),
94
- }),
95
- gallery: createBaseSchema().extend({
96
- images: z.array(
97
- z.object({
98
- image: z.string().nonempty(),
99
- alt: z.string().nonempty(),
100
- }),
101
- ),
102
- links: z.array(createLinkSchema()),
103
- }),
87
+ // Headings of the menu tiles and the top seller grid below the hero
88
+ // (#388); the components carry German defaults.
89
+ menu: createBaseSchema().partial().optional(),
90
+ highlights: createBaseSchema().partial().optional(),
91
+ gallery: createBaseSchema()
92
+ .extend({
93
+ images: z.array(
94
+ z.object({
95
+ image: z.string().nonempty(),
96
+ alt: z.string().nonempty(),
97
+ }),
98
+ ),
99
+ links: z.array(createLinkSchema()),
100
+ })
101
+ .optional(),
104
102
  mittagstisch: createBaseSchema().extend({
105
103
  reverse: z.boolean().optional(),
106
104
  orientation: createEnum(["horizontal", "vertical"]).optional(),
@@ -0,0 +1,45 @@
1
+ # Issue #388: Menu tiles and a dish grid instead of the product sliders
2
+
3
+ As of 2026-09-23, branch `feat/388-home-sections`.
4
+
5
+ ## Why
6
+
7
+ The home page below the hero was two product sliders in a row with the
8
+ same pictures: the top seller scroller (`Topseller.vue`, #327) and the
9
+ marquee (`Food/Marquee.vue`, one product request per item while rendering,
10
+ hand-maintained `productId`/`image` pairs in the content). Visitors could
11
+ not get from the hero into the menu. The automatically generated lead
12
+ demos (`leads/demo_create.py` in the monorepo) made the sameness obvious.
13
+
14
+ ## Changes
15
+
16
+ - `Home/MenuCategories.vue`: the children of the menu root (`menuCategoryId`,
17
+ else the navigation root) as tiles with the category photo
18
+ (`category.media`, set on the category in the Shopware admin) or the
19
+ section icon (`shopbite_category_icon`) on the brand gradient, name and
20
+ arrow, linking to the listing. `readNavigation` with `depth: 1` and an
21
+ `includes` projection as POST body (#312). Up to `limit` (8) tiles, then
22
+ one "Alle Kategorien" tile. Renders nothing without sections.
23
+ - `Home/Highlights.vue`: the top sellers from `useTopSellers` as a grid of
24
+ the regular `ProductCard` (quick view via `useProductQuickView`, #325),
25
+ 1/2/4 columns. Renders nothing without top sellers.
26
+ - `pages/index.vue`: hero, menu tiles, highlights, features, optional
27
+ Mittagstisch, gallery (only with images), CTA. `Topseller.vue`,
28
+ `Food/Marquee.vue` and `Food/MarqueeItem.vue` are deleted.
29
+ - Content schema: `marquee` removed, `menu` and `highlights` (headline,
30
+ title, description; all optional, German defaults in the components),
31
+ `gallery` optional. Existing `index.yml` files keep working; an old
32
+ `marquee` block is ignored by Zod.
33
+ - Homepage docs (`content/{de,en}/docs/8.storefront/3.content.md`).
34
+
35
+ ## Verification
36
+
37
+ - `HomeMenuCategories.test.ts`: tiles with photo/icon, cap and "all" tile,
38
+ empty state. Prettier, ESLint, typecheck and the unit suite pass.
39
+ - Production build against a lead demo channel (Da Piero): tiles show the
40
+ category photos, the grid the eight top sellers, quick view opens.
41
+
42
+ ## Follow-ups
43
+
44
+ - Category photos need a media on the category; `demo_create.py` sets the
45
+ first dish photo of each section, real shops set it in the admin.
@@ -0,0 +1,55 @@
1
+ # Dependency update β€” 2026-09-25
2
+
3
+ Branch `chore/dependency-update-2026-09-25`. Previous round:
4
+ `2026-09-21-dependency-update.md`.
5
+
6
+ ## Packages
7
+
8
+ | Package | From | To |
9
+ | ------------------------------------------------ | ------- | ------- |
10
+ | @nuxt/ui | 4.11.1 | 4.11.2 |
11
+ | dotenv | 18.0.1 | 18.0.3 |
12
+ | @typescript-eslint/eslint-plugin, parser | 8.70.0 | 8.70.1 |
13
+ | jsdom | 30.1.0 | 30.1.1 |
14
+ | prettier | 3.9.8 | 3.9.9 |
15
+ | @sentry/nuxt | 10.75.0 | removed |
16
+
17
+ Transitive packages were refreshed within their ranges (`pnpm update`).
18
+
19
+ Held back, as in the previous rounds:
20
+
21
+ - **typescript 7**: typescript-eslint 8.70.1 still declares
22
+ `typescript >=4.8.4 <6.1.0`.
23
+ - **@nuxt/devtools-kit 4**: only a beta (`4.0.0-beta.1`).
24
+
25
+ ## Sentry removed
26
+
27
+ `@sentry/nuxt` 11.0.0 is a major release (data collection and span streaming
28
+ on by default, `sendDefaultPii` replaced by `dataCollection`, orchestrion
29
+ build-time instrumentation auto-wired into the Nitro build). The storefront
30
+ only registered the module in `nuxt.config.ts`; it had no
31
+ `sentry.client.config.ts` / `sentry.server.config.ts`, no module options and
32
+ no shop uses it. Instead of migrating an unused integration, it is dropped:
33
+
34
+ - `@sentry/nuxt` removed from `package.json`, `@sentry/nuxt/module` from
35
+ `modules` in `nuxt.config.ts`, `@sentry/cli` from `allowBuilds` in
36
+ `pnpm-workspace.yaml` (the CLI was the only package needing a postinstall
37
+ build for Sentry).
38
+ - README feature table: "Analytics & monitoring" is now "Analytics" (Matomo).
39
+ - Lockfile shrinks by the whole `@sentry/*` and OpenTelemetry tree
40
+ (`pnpm-lock.yaml`: βˆ’556 lines net).
41
+ - `NUXT_PUBLIC_SENTRY_DSN` / `SENTRY_AUTH_TOKEN` in a local `.env` or in
42
+ Dokploy are now ignored and can be deleted. A shop that wants error
43
+ tracking adds `@sentry/nuxt` to its own dependencies and `modules`.
44
+
45
+ `pnpm peers check` now lists two unmet peers (`oxc-parser` and `unplugin`
46
+ for `unctx`); the `cac` peer from the previous round is gone.
47
+
48
+ ## Verification
49
+
50
+ - `pnpm eslint`, `pnpm prettier`, `pnpm typecheck` (0 errors),
51
+ `pnpm test:unit` (305 tests), `pnpm build`, `pnpm install --frozen-lockfile`
52
+ β€” all with pnpm 12.5.1.
53
+ - Production build against the demo backend (`node .output/server/index.mjs`
54
+ with the local `.env`): `/`, `/bestellung/warenkorb` and `/sitemap.xml`
55
+ return 200, no `sentry` string in the HTML, nothing in the server log.
package/nuxt.config.ts CHANGED
@@ -176,7 +176,6 @@ export default defineNuxtConfig({
176
176
  "@nuxt/content",
177
177
  "@nuxtjs/robots",
178
178
  "@vite-pwa/nuxt",
179
- "@sentry/nuxt/module",
180
179
  "@nuxt/ui",
181
180
  "@nuxt/scripts",
182
181
  "nuxt-vitalizer",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopbite-de/storefront",
3
- "version": "1.28.0",
3
+ "version": "1.29.0",
4
4
  "main": "nuxt.config.ts",
5
5
  "description": "Shopware storefront for food delivery shops",
6
6
  "keywords": [
@@ -20,15 +20,14 @@
20
20
  "dependencies": {
21
21
  "@headlessui/vue": "^1.7.23",
22
22
  "@heroicons/vue": "^2.2.0",
23
- "@iconify-json/lucide": "^1.2.135",
23
+ "@iconify-json/lucide": "^1.2.136",
24
24
  "@iconify-json/simple-icons": "^1.2.97",
25
- "@nuxt/content": "3.16.0",
25
+ "@nuxt/content": "3.16.1",
26
26
  "@nuxt/image": "^2.1.0",
27
27
  "@nuxt/scripts": "1.3.9",
28
- "@nuxt/ui": "^4.11.1",
28
+ "@nuxt/ui": "^4.11.2",
29
29
  "@nuxtjs/robots": "^6.2.3",
30
30
  "@nuxtjs/sitemap": "^8.5.1",
31
- "@sentry/nuxt": "^10.75.0",
32
31
  "@shopware/api-client": "^1.6.0",
33
32
  "@shopware/api-gen": "^1.5.2",
34
33
  "@shopware/composables": "^1.13.0",
@@ -37,7 +36,7 @@
37
36
  "@unhead/vue": "^3.4.1",
38
37
  "@vite-pwa/nuxt": "^1.1.1",
39
38
  "@vueuse/core": "^15.0.0",
40
- "dotenv": "^18.0.1",
39
+ "dotenv": "^18.0.3",
41
40
  "fflate": "^0.8.3",
42
41
  "nuxt": "^4.5.2",
43
42
  "nuxt-vitalizer": "3.0.0",
@@ -53,8 +52,8 @@
53
52
  "@playwright/test": "^1.63.0",
54
53
  "@types/js-cookie": "^3.0.6",
55
54
  "@types/node": "^26.6.2",
56
- "@typescript-eslint/eslint-plugin": "^8.70.0",
57
- "@typescript-eslint/parser": "^8.70.0",
55
+ "@typescript-eslint/eslint-plugin": "^8.70.1",
56
+ "@typescript-eslint/parser": "^8.70.1",
58
57
  "@vitejs/plugin-vue": "^6.0.9",
59
58
  "@vitest/ui": "5.0.1",
60
59
  "@vue/compiler-dom": "^3.5.43",
@@ -64,9 +63,9 @@
64
63
  "eslint": "^10.11.0",
65
64
  "eslint-config-prettier": "^10.1.8",
66
65
  "happy-dom": "^20.14.5",
67
- "jsdom": "^30.1.0",
66
+ "jsdom": "^30.1.1",
68
67
  "playwright-core": "^1.63.0",
69
- "prettier": "^3.9.8",
68
+ "prettier": "^3.9.9",
70
69
  "tailwindcss": "^4.3.3",
71
70
  "typescript": "^6.0.3",
72
71
  "vitest": "^5.0.1",
@@ -2,7 +2,6 @@
2
2
  shamefullyHoist: true
3
3
  allowBuilds:
4
4
  '@parcel/watcher': true
5
- '@sentry/cli': true
6
5
  better-sqlite3: true
7
6
  esbuild: true
8
7
  sharp: true
@@ -0,0 +1,94 @@
1
+ import { describe, it, expect, vi, beforeEach } from "vitest";
2
+ import { mockNuxtImport, mountSuspended } from "@nuxt/test-utils/runtime";
3
+ import HomeMenuCategories from "~/components/Home/MenuCategories.vue";
4
+
5
+ const { mockInvoke } = vi.hoisted(() => ({
6
+ mockInvoke: vi.fn(),
7
+ }));
8
+
9
+ mockNuxtImport("useShopwareContext", () => () => ({
10
+ apiClient: { invoke: mockInvoke },
11
+ }));
12
+
13
+ function category(
14
+ id: string,
15
+ name: string,
16
+ extra: Record<string, unknown> = {},
17
+ ) {
18
+ return {
19
+ id,
20
+ name,
21
+ translated: { name },
22
+ seoUrl: `/Speisekarte/${name}/`,
23
+ customFields: { shopbite_category_icon: "i-lucide-pizza" },
24
+ media: null,
25
+ ...extra,
26
+ };
27
+ }
28
+
29
+ describe("HomeMenuCategories", () => {
30
+ beforeEach(() => {
31
+ mockInvoke.mockReset();
32
+ // useAsyncData keeps the last answer under its key across the cases
33
+ clearNuxtData("home-menu-categories");
34
+ });
35
+
36
+ it("renders one tile per menu section with its photo or icon", async () => {
37
+ mockInvoke.mockResolvedValue({
38
+ data: [
39
+ category("1", "Pizza", {
40
+ media: {
41
+ url: "https://cdn.example.com/pizza.jpg",
42
+ thumbnails: [
43
+ { url: "https://cdn.example.com/pizza-400.jpg", width: 400 },
44
+ ],
45
+ metaData: { width: 800, height: 600 },
46
+ },
47
+ }),
48
+ category("2", "Pasta"),
49
+ ],
50
+ });
51
+
52
+ const wrapper = await mountSuspended(HomeMenuCategories, {
53
+ props: { title: "Unsere Speisekarte" },
54
+ });
55
+
56
+ const tiles = wrapper.findAll("[data-testid=menu-categories] li");
57
+ expect(tiles).toHaveLength(2);
58
+ expect(tiles[0]?.find("a").attributes("href")).toBe("/Speisekarte/Pizza/");
59
+ expect(tiles[0]?.find("img").attributes("srcset")).toContain("400w");
60
+ expect(tiles[1]?.find("img").exists()).toBe(false);
61
+ expect(wrapper.text()).toContain("Pasta");
62
+
63
+ const [operation, options] = mockInvoke.mock.calls[0] ?? [];
64
+ expect(operation).toBe(
65
+ "readNavigation post /navigation/{activeId}/{rootId}",
66
+ );
67
+ expect(options.body.includes.category).toContain("media");
68
+ });
69
+
70
+ it("caps the tiles and links to the whole menu", async () => {
71
+ mockInvoke.mockResolvedValue({
72
+ data: Array.from({ length: 4 }, (_, i) =>
73
+ category(String(i), `Bereich ${i}`),
74
+ ),
75
+ });
76
+
77
+ const wrapper = await mountSuspended(HomeMenuCategories, {
78
+ props: { limit: 3 },
79
+ });
80
+
81
+ const tiles = wrapper.findAll("[data-testid=menu-categories] li");
82
+ expect(tiles).toHaveLength(4);
83
+ expect(tiles[3]?.find("a").attributes("href")).toBe("/speisekarte/");
84
+ expect(tiles[3]?.text()).toContain("4 Bereiche");
85
+ });
86
+
87
+ it("renders nothing without menu sections", async () => {
88
+ mockInvoke.mockResolvedValue({ data: [] });
89
+
90
+ const wrapper = await mountSuspended(HomeMenuCategories);
91
+
92
+ expect(wrapper.find("[data-testid=menu-categories]").exists()).toBe(false);
93
+ });
94
+ });
@@ -1,35 +0,0 @@
1
- <script setup lang="ts">
2
- import type { MarqueeItem } from "~/components/Food/MarqueeItem.vue";
3
-
4
- defineProps<{
5
- title: string;
6
- description?: string | undefined;
7
- headline?: string | undefined;
8
- items: MarqueeItem[];
9
- }>();
10
- </script>
11
-
12
- <template>
13
- <AnimatedSection
14
- animation="fade-up"
15
- duration="duration-1000"
16
- delay="delay-100"
17
- >
18
- <UPageSection
19
- id="food"
20
- :title="title"
21
- :description="description"
22
- :headline="headline"
23
- :ui="{ container: 'max-w-full' }"
24
- >
25
- <UMarquee :repeat="6" pause-on-hover :overlay="true">
26
- <FoodMarqueeItem
27
- v-for="item in items"
28
- :key="item.productId"
29
- :product-id="item.productId"
30
- :image="item.image"
31
- />
32
- </UMarquee>
33
- </UPageSection>
34
- </AnimatedSection>
35
- </template>
@@ -1,77 +0,0 @@
1
- <script setup lang="ts">
2
- import { useProductSearch } from "@shopware/composables";
3
- import type { Schemas } from "#shopware";
4
-
5
- export type MarqueeItem = {
6
- productId: string;
7
- image: string;
8
- };
9
-
10
- const props = defineProps<MarqueeItem>();
11
-
12
- const { productId, image } = toRefs(props);
13
- const { search } = useProductSearch();
14
-
15
- const productResponse = await search(productId.value);
16
-
17
- // object that keeps a Product entity
18
- const product: Schemas["Product"] = productResponse.product;
19
-
20
- const CART_SUCCESS_TITLE = "Gute Wahl!";
21
-
22
- const { addLineItems } = useCartMutations();
23
- const toast = useToast();
24
-
25
- // Synchronous guard: a double-click fires before a reactive :disabled
26
- // binding reaches the DOM.
27
- const isAdding = ref(false);
28
-
29
- const alt = computed(() => product.name + " #" + product.productNumber);
30
-
31
- async function showSuccessToast() {
32
- toast.add({
33
- title: CART_SUCCESS_TITLE,
34
- description: `${product.translated.name} wurde in den Warenkorb gelegt.`,
35
- icon: "i-lucide-shopping-cart",
36
- color: "success",
37
- progress: false,
38
- });
39
- }
40
-
41
- async function addToCart(productId: string) {
42
- if (isAdding.value) return;
43
- isAdding.value = true;
44
- try {
45
- const newCart = await addLineItems([
46
- { id: productId, quantity: 1, type: "product" },
47
- ]);
48
- if (!newCart) return;
49
- await showSuccessToast();
50
- } finally {
51
- isAdding.value = false;
52
- }
53
- }
54
- </script>
55
-
56
- <template>
57
- <div v-if="product" :id="product.id" class="relative inline-block">
58
- <img
59
- :src="image"
60
- :alt="alt"
61
- loading="lazy"
62
- decoding="async"
63
- class="rounded-lg shadow-2xl ring ring-default h-50 md:h-80"
64
- />
65
- <div
66
- class="absolute bottom-0 left-0 right-0 bg-black/60 text-white px-4 py-2 rounded-b-md flex justify-between items-center"
67
- >
68
- <p class="text-sm font-medium truncate">{{ product.translated.name }}</p>
69
- <UButton
70
- icon="i-lucide-shopping-cart"
71
- size="lg"
72
- :disabled="isAdding"
73
- @click="addToCart(product.id)"
74
- />
75
- </div>
76
- </div>
77
- </template>
@@ -1,53 +0,0 @@
1
- <script setup lang="ts">
2
- // Top sellers as a horizontal snap scroller below the hero (#327); a tap
3
- // opens the product quick view (#325). Renders nothing without top sellers.
4
- const { loadTopSellers } = useTopSellers();
5
-
6
- const { data: topSellers } = await useAsyncData("top-sellers", () =>
7
- loadTopSellers(),
8
- );
9
-
10
- const products = computed(() => topSellers.value ?? []);
11
- const quickView = useProductQuickView(products);
12
- </script>
13
-
14
- <template>
15
- <section v-if="products.length > 0" aria-labelledby="top-sellers-title">
16
- <UContainer class="flex flex-col gap-3 pt-6 sm:pt-8">
17
- <div class="flex items-baseline justify-between gap-4">
18
- <h2
19
- id="top-sellers-title"
20
- class="text-xl font-extrabold tracking-tight text-highlighted sm:text-2xl"
21
- >
22
- Beliebt bei unseren GΓ€sten
23
- </h2>
24
- <UButton
25
- label="Speisekarte"
26
- to="/speisekarte/"
27
- variant="link"
28
- color="primary"
29
- trailing-icon="i-lucide-arrow-right"
30
- class="shrink-0 px-0"
31
- />
32
- </div>
33
- </UContainer>
34
- <!-- Scrolls edge to edge on phones, padded like the container. -->
35
- <div
36
- class="flex snap-x snap-mandatory gap-3 overflow-x-auto px-4 py-2 pb-4 sm:px-6 lg:px-8 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"
37
- >
38
- <div class="mx-auto flex w-full max-w-(--ui-container) gap-3">
39
- <ProductCardCompact
40
- v-for="product in products"
41
- :key="product.id"
42
- :product="product"
43
- @select="quickView.show"
44
- />
45
- </div>
46
- </div>
47
- <LazyProductQuickView
48
- v-if="quickView.mounted.value"
49
- v-model:open="quickView.open.value"
50
- :product="quickView.product.value"
51
- />
52
- </section>
53
- </template>