@shopbite-de/storefront 1.23.3 → 1.25.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.
Files changed (204) hide show
  1. package/.env.example +22 -0
  2. package/.github/workflows/build.yaml +1 -1
  3. package/.github/workflows/ci.yaml +6 -3
  4. package/CLAUDE.md +48 -3
  5. package/README.md +139 -40
  6. package/api-gen.config.json +9 -0
  7. package/api-types/storeApiSchema.shopbite.overrides.json +35 -0
  8. package/api-types/storeApiTypes.d.ts +95 -81
  9. package/app/app.config.ts +3 -2
  10. package/app/app.vue +40 -53
  11. package/app/assets/css/main.css +36 -4
  12. package/app/components/AddToWishlist.vue +13 -6
  13. package/app/components/Address/Fields.vue +2 -21
  14. package/app/components/AnimatedSection.vue +9 -4
  15. package/app/components/BottomNavi.vue +9 -2
  16. package/app/components/Cart/Bar.vue +102 -0
  17. package/app/components/Cart/Item.vue +21 -10
  18. package/app/components/Cart/QuickView.vue +4 -0
  19. package/app/components/Cart/Upsell.vue +106 -0
  20. package/app/components/Category/Header.vue +9 -3
  21. package/app/components/Category/Listing.vue +62 -45
  22. package/app/components/Checkout/PaymentAndDelivery.vue +19 -3
  23. package/app/components/Checkout/Summary.vue +70 -2
  24. package/app/components/Cta.vue +4 -2
  25. package/app/components/DemoBanner.vue +13 -0
  26. package/app/components/Feature/Card.vue +121 -0
  27. package/app/components/Features.vue +14 -9
  28. package/app/components/Food/MarqueeItem.vue +20 -8
  29. package/app/components/Footer/Contact.vue +82 -0
  30. package/app/components/Footer/StoreStatus.vue +30 -0
  31. package/app/components/Footer.vue +2 -1
  32. package/app/components/Header/Body.vue +1 -1
  33. package/app/components/Header/Right.vue +60 -17
  34. package/app/components/Header/Title.vue +1 -0
  35. package/app/components/Header.vue +5 -15
  36. package/app/components/Hero.vue +169 -36
  37. package/app/components/ImageGallery.vue +11 -5
  38. package/app/components/Product/Card.vue +104 -46
  39. package/app/components/Product/CardCompact.vue +72 -0
  40. package/app/components/Product/CardDietBadges.vue +38 -31
  41. package/app/components/Product/CardIngredients.vue +35 -0
  42. package/app/components/Product/CardSkeleton.vue +10 -18
  43. package/app/components/Product/Category.vue +9 -2
  44. package/app/components/Product/Configurator.vue +11 -7
  45. package/app/components/Product/CrossSelling.vue +45 -34
  46. package/app/components/Product/DeselectIngredient.vue +37 -31
  47. package/app/components/Product/Detail.vue +73 -13
  48. package/app/components/Product/QuickView.vue +77 -0
  49. package/app/components/Topseller.vue +44 -34
  50. package/app/components/User/RegistrationForm.vue +0 -1
  51. package/app/components/Wishlist.vue +2 -15
  52. package/app/composables/useAddToCart.ts +13 -40
  53. package/app/composables/useAddressAutocomplete.ts +12 -19
  54. package/app/composables/useAddressSuggestionArea.ts +16 -0
  55. package/app/composables/useAddressValidation.ts +3 -19
  56. package/app/composables/useCartMutations.ts +168 -0
  57. package/app/composables/useCartQuickView.ts +19 -0
  58. package/app/composables/useCartUpsell.ts +100 -0
  59. package/app/composables/{useCategory.ts → useCategoryById.ts} +1 -1
  60. package/app/composables/useCategorySeo.ts +27 -29
  61. package/app/composables/useCheckoutMethodGuard.ts +201 -0
  62. package/app/composables/useMatomo.ts +25 -0
  63. package/app/composables/useMatomoConfig.ts +12 -0
  64. package/app/composables/useMenuSectionSchema.ts +55 -0
  65. package/app/composables/useNavigation.ts +12 -9
  66. package/app/composables/usePageSeo.ts +50 -0
  67. package/app/composables/useProductCartQuantity.ts +15 -0
  68. package/app/composables/useProductCrossSelling.ts +1 -0
  69. package/app/composables/useProductDetail.ts +15 -1
  70. package/app/composables/useProductEvents.ts +30 -0
  71. package/app/composables/useProductQuickView.ts +65 -0
  72. package/app/composables/useRestaurantSchema.ts +64 -0
  73. package/app/composables/useScrollAnimation.ts +39 -8
  74. package/app/composables/useSearchTracking.ts +33 -0
  75. package/app/composables/useSeoUrlRoute.ts +58 -0
  76. package/app/composables/useSortingSelection.ts +28 -0
  77. package/app/composables/useStoreStatus.ts +48 -0
  78. package/app/composables/useTopSellers.ts +22 -0
  79. package/app/composables/useTrackEvent.ts +36 -23
  80. package/app/pages/[...all].vue +4 -4
  81. package/app/pages/account/recover/password/index.vue +1 -0
  82. package/app/pages/anmelden.vue +4 -0
  83. package/app/pages/bestellung/[id]/erfolg.vue +1 -5
  84. package/app/pages/bestellung/[id]/fehler.vue +2 -2
  85. package/app/pages/bestellung/[id]/index.vue +9 -3
  86. package/app/pages/bestellung/bestaetigen.vue +1 -5
  87. package/app/pages/bestellung/warenkorb.vue +1 -5
  88. package/app/pages/bestellung/zahlung-versand.vue +1 -5
  89. package/app/pages/c/[...all].vue +2 -35
  90. package/app/pages/index.vue +28 -14
  91. package/app/pages/kontakt.vue +4 -0
  92. package/app/pages/konto/adressen.vue +4 -0
  93. package/app/pages/konto/bestellung/[id].vue +4 -0
  94. package/app/pages/konto/bestellungen.vue +4 -0
  95. package/app/pages/konto/index.vue +4 -0
  96. package/app/pages/konto/profil.vue +4 -0
  97. package/app/pages/maintenance.vue +6 -0
  98. package/app/pages/merkliste.vue +1 -7
  99. package/app/pages/passwort-vergessen.vue +1 -0
  100. package/app/pages/registrierung/bestaetigen.vue +4 -0
  101. package/app/pages/registrierung/index.vue +4 -0
  102. package/app/pages/speisekarte/[...all].vue +2 -36
  103. package/app/pages/suche.vue +42 -26
  104. package/app/plugins/matomo.ts +35 -0
  105. package/app/types/Association.d.ts +1 -0
  106. package/app/utils/hydrateWhenVisible.ts +20 -0
  107. package/app/utils/media.ts +33 -0
  108. package/app/utils/openingHours.ts +90 -0
  109. package/app/utils/product.ts +31 -0
  110. package/app/utils/schema.ts +235 -0
  111. package/app/utils/seo.ts +56 -0
  112. package/app/utils/seoPath.ts +57 -0
  113. package/content/index.yml +26 -20
  114. package/content.config.ts +16 -0
  115. package/docs/notes/2026-07-05-issue-259-matomo-broken.md +7 -0
  116. package/docs/notes/2026-09-08-issue-240-shipping-method-blocked.md +83 -0
  117. package/docs/notes/2026-09-08-issue-241-cart-lock-conflicts.md +63 -0
  118. package/docs/notes/2026-09-08-issue-244-category-url-trailing-slash.md +65 -0
  119. package/docs/notes/2026-09-08-issue-276-payment-method-blocked.md +39 -0
  120. package/docs/notes/2026-09-08-issue-277-typecheck.md +99 -0
  121. package/docs/notes/2026-09-10-issue-250-animated-section.md +23 -0
  122. package/docs/notes/2026-09-10-issue-251-shop-data-in-base-layer.md +30 -0
  123. package/docs/notes/2026-09-10-issue-272-restaurant-schema.md +27 -0
  124. package/docs/notes/2026-09-10-issue-273-performance-media.md +64 -0
  125. package/docs/notes/2026-09-10-issue-274-seo-basics.md +49 -0
  126. package/docs/notes/2026-09-10-issue-275-accessibility.md +46 -0
  127. package/docs/notes/2026-09-10-issue-290-footer-nap.md +28 -0
  128. package/docs/notes/2026-09-10-issue-291-seo-url-trailing-slash.md +24 -0
  129. package/docs/notes/2026-09-10-issue-294-matomo-without-config.md +33 -0
  130. package/docs/notes/2026-09-10-issue-295-search-hydration-mismatch.md +25 -0
  131. package/docs/notes/2026-09-10-issue-296-track-direct-search.md +19 -0
  132. package/docs/notes/2026-09-10-issue-312-store-api-criteria-post.md +64 -0
  133. package/docs/notes/2026-09-10-issue-313-wishlist-scoped-tailwind.md +29 -0
  134. package/docs/notes/2026-09-10-issue-314-mobile-js-cost.md +119 -0
  135. package/docs/notes/2026-09-12-issue-319-stylesheet-cost.md +154 -0
  136. package/docs/notes/2026-09-12-issue-325-product-card.md +100 -0
  137. package/docs/notes/2026-09-12-issue-327-home-hero.md +64 -0
  138. package/docs/notes/2026-09-13-demo-banner.md +32 -0
  139. package/docs/notes/2026-09-13-issue-332-home-info-cards.md +46 -0
  140. package/docs/notes/2026-09-13-quick-view-flicker.md +65 -0
  141. package/docs/notes/2026-09-14-cart-upsell.md +105 -0
  142. package/docs/notes/2026-09-14-demo-noindex.md +57 -0
  143. package/node.dockerfile +5 -2
  144. package/nuxt.config.ts +98 -15
  145. package/package.json +5 -3
  146. package/patches/@shopware__nuxt-module@1.5.1.patch +32 -0
  147. package/pnpm-workspace.yaml +2 -0
  148. package/public/hero-poster.webp +0 -0
  149. package/scripts/perf/first-render.mjs +30 -0
  150. package/scripts/perf/h2-proxy.cjs +49 -0
  151. package/scripts/perf/lighthouse.sh +22 -0
  152. package/scripts/perf/quick-view-layout.mjs +126 -0
  153. package/server/api/__sitemap__/urls.get.ts +49 -0
  154. package/server/api/category/[categoryId].get.ts +20 -9
  155. package/server/api/content/home.get.ts +14 -0
  156. package/server/api/content/page.get.ts +22 -0
  157. package/server/api/listing/[categoryId].get.ts +14 -18
  158. package/server/api/product/[productId]/cross-selling.get.ts +3 -9
  159. package/server/api/product/[productId].get.ts +4 -8
  160. package/server/api/search.get.ts +2 -0
  161. package/server/plugins/site-url.ts +13 -0
  162. package/server/plugins/sitemap-trailing-slash.ts +26 -0
  163. package/server/utils/sitemap.ts +60 -0
  164. package/server/utils/storeApi.ts +34 -0
  165. package/shopware.d.ts +35 -11
  166. package/test/e2e/simple-checkout-as-recurring-customer.test.ts +13 -17
  167. package/test/nuxt/AddressFields.test.ts +2 -73
  168. package/test/nuxt/AnimatedSection.test.ts +67 -0
  169. package/test/nuxt/CartBar.test.ts +110 -0
  170. package/test/nuxt/CartItem.test.ts +95 -0
  171. package/test/nuxt/CartUpsell.test.ts +125 -0
  172. package/test/nuxt/DemoBanner.test.ts +12 -0
  173. package/test/nuxt/FooterContact.test.ts +102 -0
  174. package/test/nuxt/FooterStoreStatus.test.ts +48 -0
  175. package/test/nuxt/HeaderRight.test.ts +14 -10
  176. package/test/nuxt/Hero.test.ts +68 -0
  177. package/test/nuxt/PaymentAndDelivery.test.ts +67 -8
  178. package/test/nuxt/RegistrationForm.test.ts +3 -0
  179. package/test/nuxt/useAddToCart.test.ts +37 -17
  180. package/test/nuxt/useAddressAutocomplete.test.ts +2 -38
  181. package/test/nuxt/useAddressSuggestionArea.test.ts +27 -0
  182. package/test/nuxt/useBusinessHours.test.ts +1 -1
  183. package/test/nuxt/useCartMutations.test.ts +225 -0
  184. package/test/nuxt/useCartUpsell.test.ts +126 -0
  185. package/test/nuxt/useCheckoutMethodGuard.test.ts +386 -0
  186. package/test/nuxt/useScrollAnimation.test.ts +55 -49
  187. package/test/nuxt/useSearchTracking.test.ts +71 -0
  188. package/test/nuxt/useSeoUrlRoute.test.ts +93 -0
  189. package/test/nuxt/useStoreStatus.test.ts +77 -0
  190. package/test/nuxt/useTrackEvent.test.ts +127 -0
  191. package/test/unit/media.spec.ts +49 -0
  192. package/test/unit/openingHours.spec.ts +90 -0
  193. package/test/unit/product.spec.ts +72 -0
  194. package/test/unit/schema.spec.ts +243 -0
  195. package/test/unit/seo.spec.ts +107 -0
  196. package/test/unit/seoPath.spec.ts +116 -0
  197. package/test/unit/sitemap.spec.ts +88 -0
  198. package/test/unit/useCategorySeo.spec.ts +42 -31
  199. package/test/unit/useSortingSelection.spec.ts +39 -0
  200. package/test/visual/playwright.config.ts +33 -0
  201. package/test/visual/visual.spec.ts +87 -0
  202. package/app/components/Product/CardDescription.vue +0 -27
  203. package/app/components/Product/CardFooter.vue +0 -51
  204. package/app/composables/useValidCitiesForDelivery.ts +0 -12
@@ -4,7 +4,13 @@ import type { Schemas } from "#shopware";
4
4
  const props = defineProps<{
5
5
  product: Schemas["Product"];
6
6
  withFavoriteButton: boolean;
7
- withAddToCartButton: boolean;
7
+ // The whole card opens the product quick view (`select`), see
8
+ // useProductQuickView (#325).
9
+ selectable: boolean;
10
+ }>();
11
+
12
+ const emit = defineEmits<{
13
+ select: [product: Schemas["Product"]];
8
14
  }>();
9
15
 
10
16
  const { product } = toRefs(props);
@@ -14,16 +20,16 @@ const sortedProperties = computed(
14
20
  product.value.sortedProperties as Schemas["PropertyGroup"][] | undefined,
15
21
  );
16
22
 
17
- const price = ref(product.value.calculatedPrice.totalPrice);
18
- const label = ref(product.value.translated.name ?? product.value.name);
19
- const description = ref(product.value.description);
20
- const number = ref(product.value.productNumber);
23
+ const { getFormattedPrice } = useCommercePrice();
24
+ const { quantity: inCartQuantity } = useProductCartQuantity(
25
+ () => product.value.id,
26
+ );
27
+
28
+ const coverMedia = computed(() => product.value.cover?.media);
29
+ const isAvailable = computed(() => productIsAvailable(product.value));
21
30
 
22
- function onVariantSelected(variant: Schemas["Product"]) {
23
- price.value = variant.calculatedPrice.totalPrice;
24
- label.value = variant.translated.name ?? variant.name;
25
- description.value = variant.translated.description ?? variant.description;
26
- number.value = variant.productNumber;
31
+ function select() {
32
+ if (props.selectable) emit("select", product.value);
27
33
  }
28
34
  </script>
29
35
 
@@ -34,50 +40,102 @@ function onVariantSelected(variant: Schemas["Product"]) {
34
40
  duration="duration-1000"
35
41
  delay="delay-100"
36
42
  >
37
- <UPageCard
38
- :orientation="product.cover?.media?.url ? 'horizontal' : 'vertical'"
39
- variant="outline"
40
- reverse
41
- :ui="{ footer: 'w-full', root: 'shadow-lg' }"
43
+ <article
44
+ class="relative flex h-full flex-col overflow-hidden rounded-xl bg-default shadow-md ring ring-default transition-shadow"
45
+ :class="{
46
+ 'cursor-pointer hover:shadow-lg hover:ring-primary/40 focus-visible:outline-2 focus-visible:outline-primary':
47
+ selectable,
48
+ }"
49
+ :role="selectable ? 'button' : undefined"
50
+ :tabindex="selectable ? 0 : undefined"
51
+ :aria-haspopup="selectable ? 'dialog' : undefined"
52
+ :aria-label="
53
+ selectable
54
+ ? `${product.translated.name ?? product.name} auswählen`
55
+ : undefined
56
+ "
57
+ @click="select"
58
+ @keydown.enter.prevent="select"
59
+ @keydown.space.prevent="select"
42
60
  >
43
- <template #header>
44
- <ProductCardDietBadges :sorted-properties="sortedProperties" />
45
- </template>
61
+ <div v-if="coverMedia?.url" class="relative">
62
+ <img
63
+ :src="coverMedia.url"
64
+ :srcset="mediaSrcSet(coverMedia)"
65
+ sizes="(min-width: 1280px) 400px, 100vw"
66
+ :width="mediaSize(coverMedia)?.width"
67
+ :height="mediaSize(coverMedia)?.height"
68
+ :alt="product.translated.name ?? product.name"
69
+ loading="lazy"
70
+ decoding="async"
71
+ class="h-44 w-full object-cover"
72
+ />
73
+ <div class="absolute top-2.5 left-2.5 flex gap-1.5">
74
+ <ProductCardDietBadges
75
+ :sorted-properties="sortedProperties"
76
+ variant="overlay"
77
+ />
78
+ </div>
79
+ </div>
46
80
 
47
- <div v-if="product.cover?.media?.url">
48
- <LazyNuxtImg
49
- :src="product.cover.media.url"
50
- class="rounded-md h-auto max-w-full object-contain transition-opacity duration-700"
51
- sizes="(min-width: 1024px) 50vw, 100vw"
81
+ <!-- Stops the click so the wishlist toggle does not open the quick view. -->
82
+ <div
83
+ v-if="withFavoriteButton"
84
+ class="absolute top-2.5 right-2.5"
85
+ @click.stop
86
+ @keydown.stop
87
+ >
88
+ <AddToWishlist
89
+ :product="product"
90
+ variant="soft"
91
+ class="rounded-full bg-default/90"
52
92
  />
53
93
  </div>
54
94
 
55
- <template #title>
56
- <div class="flex flex-row items-center gap-1">
57
- <span class="text-sm text-brand-500">#{{ number }}</span>
58
- <ProductCardKitchen :sorted-properties="sortedProperties" />
59
- <p class="text-base text-pretty font-semibold text-highlighted">
60
- {{ label }}
61
- </p>
95
+ <div class="flex flex-1 flex-col gap-3 p-4">
96
+ <div
97
+ class="flex items-start justify-between gap-3"
98
+ :class="{ 'pr-10': withFavoriteButton && !coverMedia?.url }"
99
+ >
100
+ <div class="flex min-w-0 flex-col gap-0.5">
101
+ <span
102
+ class="flex items-center gap-1 text-xs font-semibold text-primary"
103
+ >
104
+ #{{ product.productNumber }}
105
+ <ProductCardKitchen :sorted-properties="sortedProperties" />
106
+ </span>
107
+ <h3 class="text-lg font-bold text-pretty text-highlighted">
108
+ {{ product.translated.name ?? product.name }}
109
+ </h3>
110
+ <p v-if="product.description" class="text-sm text-default">
111
+ {{ product.description }}
112
+ </p>
113
+ </div>
114
+ <div class="flex shrink-0 flex-col items-end">
115
+ <span class="text-lg font-bold whitespace-nowrap text-highlighted">
116
+ {{ getFormattedPrice(product.calculatedPrice.totalPrice) }}
117
+ </span>
118
+ <span
119
+ v-if="!isAvailable"
120
+ class="text-xs whitespace-nowrap text-error"
121
+ >
122
+ Ausverkauft
123
+ </span>
124
+ <span
125
+ v-else-if="inCartQuantity > 0"
126
+ class="text-xs whitespace-nowrap text-muted"
127
+ data-testid="in-cart-quantity"
128
+ >
129
+ {{ inCartQuantity }}× im Warenkorb
130
+ </span>
131
+ </div>
62
132
  </div>
63
- </template>
64
133
 
65
- <template #description>
66
- <ProductCardDescription
67
- :description="description"
134
+ <ProductCardIngredients
68
135
  :sorted-properties="sortedProperties"
136
+ :with-diet-badges="!coverMedia?.url"
69
137
  />
70
- </template>
71
-
72
- <template #footer>
73
- <ProductCardFooter
74
- :price="price"
75
- :product="product"
76
- :with-favorite-button="withFavoriteButton"
77
- :with-add-to-cart-button="withAddToCartButton"
78
- @variant-selected="onVariantSelected"
79
- />
80
- </template>
81
- </UPageCard>
138
+ </div>
139
+ </article>
82
140
  </AnimatedSection>
83
141
  </template>
@@ -0,0 +1,72 @@
1
+ <script setup lang="ts">
2
+ import type { Schemas } from "#shopware";
3
+
4
+ // Compact card for horizontal rows (top sellers, #327): cover or placeholder,
5
+ // number, name, price and a plus. The whole card opens the quick view.
6
+ const props = defineProps<{
7
+ product: Schemas["Product"];
8
+ }>();
9
+
10
+ const emit = defineEmits<{
11
+ select: [product: Schemas["Product"]];
12
+ }>();
13
+
14
+ const { getFormattedPrice } = useCommercePrice();
15
+
16
+ const coverMedia = computed(() => props.product.cover?.media);
17
+ const name = computed(
18
+ () => props.product.translated?.name ?? props.product.name,
19
+ );
20
+ </script>
21
+
22
+ <template>
23
+ <article
24
+ class="flex w-44 shrink-0 cursor-pointer snap-start flex-col overflow-hidden rounded-xl bg-default shadow-md ring ring-default transition-shadow hover:shadow-lg hover:ring-primary/40 focus-visible:outline-2 focus-visible:outline-primary"
25
+ role="button"
26
+ tabindex="0"
27
+ aria-haspopup="dialog"
28
+ :aria-label="`${name} auswählen`"
29
+ @click="emit('select', product)"
30
+ @keydown.enter.prevent="emit('select', product)"
31
+ @keydown.space.prevent="emit('select', product)"
32
+ >
33
+ <img
34
+ v-if="coverMedia?.url"
35
+ :src="coverMedia.url"
36
+ :srcset="mediaSrcSet(coverMedia)"
37
+ sizes="176px"
38
+ :width="mediaSize(coverMedia)?.width"
39
+ :height="mediaSize(coverMedia)?.height"
40
+ :alt="name"
41
+ loading="lazy"
42
+ decoding="async"
43
+ class="h-28 w-full object-cover"
44
+ />
45
+ <div
46
+ v-else
47
+ class="flex h-28 w-full items-center justify-center bg-gradient-to-b from-brand-100 to-brand-200 text-brand-600"
48
+ aria-hidden="true"
49
+ >
50
+ <UIcon name="i-lucide-utensils-crossed" class="size-8" />
51
+ </div>
52
+ <div class="flex flex-1 flex-col gap-1.5 p-3">
53
+ <span class="text-xs font-semibold text-primary">
54
+ #{{ product.productNumber }}
55
+ </span>
56
+ <span class="line-clamp-2 text-base leading-5 font-bold text-highlighted">
57
+ {{ name }}
58
+ </span>
59
+ <div class="mt-auto flex items-center justify-between pt-1">
60
+ <span class="font-bold text-highlighted">
61
+ {{ getFormattedPrice(product.calculatedPrice.totalPrice) }}
62
+ </span>
63
+ <span
64
+ class="flex size-8 items-center justify-center rounded-full bg-primary/10 text-primary ring ring-inset ring-primary/25"
65
+ aria-hidden="true"
66
+ >
67
+ <UIcon name="i-lucide-plus" class="size-4" />
68
+ </span>
69
+ </div>
70
+ </div>
71
+ </article>
72
+ </template>
@@ -1,42 +1,49 @@
1
1
  <script setup lang="ts">
2
2
  import type { Schemas } from "#shopware";
3
3
 
4
- const props = defineProps<{
5
- sortedProperties: Schemas["PropertyGroup"][] | undefined;
6
- }>();
4
+ const props = withDefaults(
5
+ defineProps<{
6
+ sortedProperties: Schemas["PropertyGroup"][] | undefined;
7
+ // `chip` sits in the ingredient row, `overlay` on the cover image (#325).
8
+ variant?: "chip" | "overlay";
9
+ }>(),
10
+ { variant: "chip" },
11
+ );
12
+
13
+ const hasYesOption = (groupName: string) =>
14
+ props.sortedProperties?.some(
15
+ (group) =>
16
+ group.translated.name === groupName &&
17
+ group.options?.some((option) => option.translated.name === "Ja"),
18
+ ) ?? false;
7
19
 
8
- const isVegi = computed<boolean>(
9
- () =>
10
- props.sortedProperties?.some(
11
- (group) =>
12
- group.translated.name === "Vegetarisch" &&
13
- group.options?.some((option) => option.translated.name === "Ja"),
14
- ) ?? false,
20
+ const badges = computed(() =>
21
+ [
22
+ {
23
+ label: "Vegetarisch",
24
+ icon: "i-lucide-leaf",
25
+ show: hasYesOption("Vegetarisch"),
26
+ },
27
+ { label: "Vegan", icon: "i-lucide-vegan", show: hasYesOption("Vegan") },
28
+ ].filter((badge) => badge.show),
15
29
  );
16
30
 
17
- const isVegan = computed<boolean>(
18
- () =>
19
- props.sortedProperties?.some(
20
- (group) =>
21
- group.translated.name === "Vegan" &&
22
- group.options?.some((option) => option.translated.name === "Ja"),
23
- ) ?? false,
31
+ // Static spans with the UBadge classes, see CardIngredients.vue.
32
+ const badgeClass = computed(() =>
33
+ props.variant === "overlay"
34
+ ? "rounded-md bg-default ring ring-inset ring-success/50"
35
+ : "rounded-full bg-success/10",
24
36
  );
25
37
  </script>
26
38
 
27
39
  <template>
28
- <LazyUBadge
29
- v-if="isVegi"
30
- icon="i-lucide-leaf"
31
- color="success"
32
- variant="outline"
33
- label="Vegetarisch"
34
- />
35
- <LazyUBadge
36
- v-if="isVegan"
37
- icon="i-lucide-vegan"
38
- color="success"
39
- variant="outline"
40
- label="Vegan"
41
- />
40
+ <span
41
+ v-for="badge in badges"
42
+ :key="badge.label"
43
+ class="inline-flex items-center gap-1 px-2 py-1 text-xs font-medium text-success"
44
+ :class="badgeClass"
45
+ >
46
+ <UIcon :name="badge.icon" class="size-4 shrink-0" />
47
+ {{ badge.label }}
48
+ </span>
42
49
  </template>
@@ -0,0 +1,35 @@
1
+ <script setup lang="ts">
2
+ import type { Schemas } from "#shopware";
3
+
4
+ const props = defineProps<{
5
+ sortedProperties: Schemas["PropertyGroup"][] | undefined;
6
+ withDietBadges: boolean;
7
+ }>();
8
+
9
+ const mainIngredients = computed(() =>
10
+ getMainIngredients(props.sortedProperties),
11
+ );
12
+ </script>
13
+
14
+ <template>
15
+ <!-- Plain spans with the UBadge "soft" classes: a listing hydrates up to
16
+ ten cards with several chips each, and every UBadge instance costs a
17
+ tailwind-variants merge (#325). -->
18
+ <div
19
+ v-if="withDietBadges || mainIngredients.length > 0"
20
+ class="flex flex-wrap gap-1.5"
21
+ >
22
+ <ProductCardDietBadges
23
+ v-if="withDietBadges"
24
+ :sorted-properties="sortedProperties"
25
+ variant="chip"
26
+ />
27
+ <span
28
+ v-for="ingredient in mainIngredients"
29
+ :key="ingredient.id"
30
+ class="inline-flex items-center rounded-full bg-elevated px-2 py-1 text-xs font-medium text-default"
31
+ >
32
+ {{ ingredient.translated.name }}
33
+ </span>
34
+ </div>
35
+ </template>
@@ -1,26 +1,18 @@
1
1
  <template>
2
2
  <div
3
- class="ring-1 ring-accented rounded-xl shadow-lg p-4 flex flex-row gap-4"
3
+ class="flex flex-col gap-3 rounded-xl bg-default p-4 shadow-md ring ring-default"
4
4
  >
5
- <div class="flex flex-col gap-3 flex-1 min-w-0">
6
- <USkeleton class="h-5 w-20 rounded-full" />
7
- <div class="flex items-baseline gap-2">
8
- <USkeleton class="h-3.5 w-7" />
9
- <USkeleton class="h-3.5 w-36" />
10
- </div>
5
+ <div class="flex items-start justify-between gap-3">
11
6
  <div class="flex flex-col gap-2">
12
- <USkeleton class="h-3 w-full" />
13
- <USkeleton class="h-3 w-5/6" />
14
- <USkeleton class="h-3 w-1/2" />
15
- </div>
16
- <div class="flex justify-between items-center mt-auto pt-2">
17
- <USkeleton class="h-4 w-14" />
18
- <div class="flex gap-2">
19
- <USkeleton class="h-8 w-8 rounded-md" />
20
- <USkeleton class="h-8 w-8 rounded-md" />
21
- </div>
7
+ <USkeleton class="h-3 w-8" />
8
+ <USkeleton class="h-5 w-40" />
22
9
  </div>
10
+ <USkeleton class="h-5 w-14" />
11
+ </div>
12
+ <div class="flex gap-1.5">
13
+ <USkeleton class="h-6 w-24 rounded-full" />
14
+ <USkeleton class="h-6 w-20 rounded-full" />
15
+ <USkeleton class="h-6 w-16 rounded-full" />
23
16
  </div>
24
- <USkeleton class="size-28 rounded-md shrink-0" />
25
17
  </div>
26
18
  </template>
@@ -12,6 +12,7 @@ const props = defineProps({
12
12
  const category = toRef(props.category);
13
13
  const { apiClient } = useShopwareContext();
14
14
  const categoryProducts = ref<Schemas["Product"][]>([]);
15
+ const quickView = useProductQuickView(categoryProducts);
15
16
  const isLoading = ref(true);
16
17
 
17
18
  const fetchCategoryProducts = async () => {
@@ -139,15 +140,21 @@ onMounted(() => {
139
140
  :category="child"
140
141
  />
141
142
  </div>
142
- <div v-else class="grid grid-cols-1 gap-4">
143
+ <div v-else class="grid grid-cols-1 gap-4 xl:grid-cols-2">
143
144
  <ProductCard
144
145
  v-for="product in categoryProducts"
145
146
  :key="product.id"
146
147
  :product="product"
147
148
  :with-favorite-button="true"
148
- :with-add-to-cart-button="true"
149
+ :selectable="true"
150
+ @select="quickView.show"
149
151
  />
150
152
  </div>
153
+ <LazyProductQuickView
154
+ v-if="quickView.mounted.value"
155
+ v-model:open="quickView.open.value"
156
+ :product="quickView.product.value"
157
+ />
151
158
  </div>
152
159
  <div v-else-if="isLoading" class="flex flex-col" />
153
160
  </template>
@@ -41,19 +41,23 @@ const emit = defineEmits<{
41
41
  }>();
42
42
  </script>
43
43
  <template>
44
- <div
45
- v-for="(variantGroup, propertyGroupId) in selectableOptions"
46
- :key="propertyGroupId"
47
- class="my-6"
48
- >
49
- <div class="flex flex-row gap-2 items-center">
50
- <div class="basis-1/3">{{ variantGroup.name }}:</div>
44
+ <div class="flex flex-col gap-5">
45
+ <div
46
+ v-for="(variantGroup, propertyGroupId) in selectableOptions"
47
+ :key="propertyGroupId"
48
+ class="flex flex-col gap-2"
49
+ >
50
+ <span class="font-semibold text-highlighted">{{
51
+ variantGroup.name
52
+ }}</span>
51
53
  <USelect
52
54
  v-model="selectedOptions[propertyGroupId]"
53
55
  value-key="productId"
54
56
  :items="variantGroup.options"
57
+ size="lg"
55
58
  class="w-full"
56
59
  icon="i-lucide-square-stack"
60
+ :aria-label="variantGroup.name"
57
61
  />
58
62
  </div>
59
63
  </div>
@@ -1,11 +1,13 @@
1
1
  <script setup lang="ts">
2
- import type { Schemas } from "#shopware";
3
- import type { AssociationItemProduct } from "~/types/Association";
2
+ import type {
3
+ AssociationItem,
4
+ AssociationItemProduct,
5
+ } from "~/types/Association";
4
6
 
5
- const LOADING_ICON = "i-lucide-loader";
6
-
7
- const props = defineProps<{
8
- product: Schemas["Product"];
7
+ // The extras are loaded by useProductDetail together with the product, so
8
+ // the list renders once and stays put when a variant is switched.
9
+ defineProps<{
10
+ associations: AssociationItem[];
9
11
  }>();
10
12
 
11
13
  const emit = defineEmits<{
@@ -14,40 +16,49 @@ const emit = defineEmits<{
14
16
 
15
17
  const selectedExtras = ref<AssociationItemProduct[]>([]);
16
18
 
17
- const { associationItems, isAssociationsLoading } = useProductCrossSelling(
18
- () => props.product.id,
19
- );
19
+ const isSelected = (extra: AssociationItemProduct) =>
20
+ selectedExtras.value.some((selected) => selected.value === extra.value);
21
+
22
+ function toggle(extra: AssociationItemProduct) {
23
+ selectedExtras.value = isSelected(extra)
24
+ ? selectedExtras.value.filter((selected) => selected.value !== extra.value)
25
+ : [...selectedExtras.value, extra];
26
+ }
20
27
 
21
- watch(selectedExtras, () => emit("extras-selected", selectedExtras.value), {
22
- deep: true,
23
- });
28
+ watch(selectedExtras, () => emit("extras-selected", selectedExtras.value));
24
29
  </script>
25
30
 
26
31
  <template>
27
- <div v-if="!isAssociationsLoading" class="my-4">
32
+ <div
33
+ v-for="association in associations"
34
+ :key="association.label"
35
+ class="flex flex-col gap-2"
36
+ >
37
+ <div class="flex items-baseline justify-between">
38
+ <span class="font-semibold text-highlighted">{{
39
+ association.label
40
+ }}</span>
41
+ <span class="text-xs text-muted">optional</span>
42
+ </div>
28
43
  <div
29
- v-for="association in associationItems"
30
- :key="association.label"
31
- class=""
44
+ class="flex flex-wrap gap-2"
45
+ role="group"
46
+ :aria-label="association.label"
32
47
  >
33
- <div class="flex flex-row gap-2 items-center">
34
- <div class="basis-1/3">{{ association.label }}:</div>
35
- <UInputMenu
36
- v-model="selectedExtras"
37
- class="w-full"
38
- :loading="isAssociationsLoading"
39
- :loading-icon="LOADING_ICON"
40
- multiple
41
- :items="association.products"
42
- icon="i-lucide-plus"
43
- >
44
- <template #item-trailing="{ item }">
45
- <span class="">
46
- {{ item.price }}
47
- </span>
48
- </template>
49
- </UInputMenu>
50
- </div>
48
+ <UButton
49
+ v-for="extra in association.products"
50
+ :key="extra.value"
51
+ size="lg"
52
+ class="rounded-full"
53
+ :color="isSelected(extra) ? 'primary' : 'neutral'"
54
+ :variant="isSelected(extra) ? 'subtle' : 'outline'"
55
+ :icon="isSelected(extra) ? 'i-lucide-check' : 'i-lucide-plus'"
56
+ :aria-pressed="isSelected(extra)"
57
+ @click="toggle(extra)"
58
+ >
59
+ {{ extra.label }}
60
+ <span class="font-normal opacity-80">+{{ extra.price }}</span>
61
+ </UButton>
51
62
  </div>
52
63
  </div>
53
64
  </template>
@@ -1,46 +1,52 @@
1
1
  <script setup lang="ts">
2
2
  import type { Schemas } from "#shopware";
3
- import { toRefs, watch } from "vue";
4
3
 
5
4
  const props = defineProps<{
6
5
  product: Schemas["Product"];
7
6
  }>();
8
- const { product } = toRefs(props);
9
-
10
- const deselected = ref([]);
11
-
12
- const list = computed(() => {
13
- const propsList = product.value?.properties ?? [];
14
- return propsList
15
- .filter(
16
- (propertyGroupOption: Schemas["PropertyGroupOption"]) =>
17
- propertyGroupOption.group.name === "Hauptzutaten",
18
- )
19
- .map(
20
- (propertyGroupOption: Schemas["PropertyGroupOption"]) =>
21
- propertyGroupOption.translated.name,
22
- );
23
- });
24
-
25
- watch(deselected, () => emit("ingredients-deselected", deselected.value), {
26
- deep: true,
27
- });
28
7
 
29
8
  const emit = defineEmits<{
30
9
  "ingredients-deselected": [deselected: string[]];
31
10
  }>();
11
+
12
+ const deselected = ref<string[]>([]);
13
+
14
+ const ingredients = computed<string[]>(() =>
15
+ ((props.product.properties ?? []) as Schemas["PropertyGroupOption"][])
16
+ .filter((option) => option.group?.name === "Hauptzutaten")
17
+ .map((option) => option.translated.name),
18
+ );
19
+
20
+ function toggle(ingredient: string) {
21
+ deselected.value = deselected.value.includes(ingredient)
22
+ ? deselected.value.filter((name) => name !== ingredient)
23
+ : [...deselected.value, ingredient];
24
+ }
25
+
26
+ watch(deselected, () => emit("ingredients-deselected", deselected.value));
32
27
  </script>
33
28
 
34
29
  <template>
35
- <div v-if="list.length > 0" class="flex flex-row gap-2 my-6 items-center">
36
- <div class="basis-1/3">Aber ohne:</div>
37
- <USelect
38
- v-model="deselected"
39
- value-key="productId"
40
- :items="list"
41
- class="w-full"
42
- icon="i-lucide-minus"
43
- multiple
44
- />
30
+ <div v-if="ingredients.length > 0" class="flex flex-col gap-2">
31
+ <span class="font-semibold text-highlighted">Ohne</span>
32
+ <div
33
+ class="flex flex-wrap gap-2"
34
+ role="group"
35
+ aria-label="Zutaten abwählen"
36
+ >
37
+ <UButton
38
+ v-for="ingredient in ingredients"
39
+ :key="ingredient"
40
+ size="lg"
41
+ class="rounded-full"
42
+ :class="{ 'line-through': deselected.includes(ingredient) }"
43
+ :color="deselected.includes(ingredient) ? 'error' : 'neutral'"
44
+ :variant="deselected.includes(ingredient) ? 'subtle' : 'outline'"
45
+ :icon="deselected.includes(ingredient) ? 'i-lucide-x' : undefined"
46
+ :aria-pressed="deselected.includes(ingredient)"
47
+ :label="ingredient"
48
+ @click="toggle(ingredient)"
49
+ />
50
+ </div>
45
51
  </div>
46
52
  </template>