@shopbite-de/storefront 1.24.0 → 1.26.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 (96) hide show
  1. package/.env.example +3 -0
  2. package/CLAUDE.md +10 -3
  3. package/README.md +0 -1
  4. package/app/app.config.ts +3 -2
  5. package/app/app.vue +4 -1
  6. package/app/assets/css/main.css +16 -0
  7. package/app/components/AddToWishlist.vue +13 -6
  8. package/app/components/Cart/Bar.vue +102 -0
  9. package/app/components/Cart/QuickView.vue +4 -0
  10. package/app/components/Cart/Upsell.vue +106 -0
  11. package/app/components/Category/Listing.vue +11 -3
  12. package/app/components/Checkout/DeliveryTimeSelect.vue +28 -2
  13. package/app/components/Checkout/Summary.vue +25 -3
  14. package/app/components/DemoBanner.vue +13 -0
  15. package/app/components/Feature/Card.vue +121 -0
  16. package/app/components/Features.vue +14 -9
  17. package/app/components/Footer/Contact.vue +5 -1
  18. package/app/components/Header/Right.vue +44 -15
  19. package/app/components/Hero.vue +126 -36
  20. package/app/components/Product/Card.vue +102 -50
  21. package/app/components/Product/CardCompact.vue +72 -0
  22. package/app/components/Product/CardDietBadges.vue +38 -31
  23. package/app/components/Product/CardIngredients.vue +35 -0
  24. package/app/components/Product/CardSkeleton.vue +10 -18
  25. package/app/components/Product/Category.vue +9 -2
  26. package/app/components/Product/Configurator.vue +11 -7
  27. package/app/components/Product/CrossSelling.vue +45 -34
  28. package/app/components/Product/DeselectIngredient.vue +37 -31
  29. package/app/components/Product/Detail.vue +73 -13
  30. package/app/components/Product/QuickView.vue +77 -0
  31. package/app/components/Topseller.vue +44 -34
  32. package/app/composables/useAddToCart.ts +3 -30
  33. package/app/composables/useBusinessHours.ts +10 -3
  34. package/app/composables/useCartQuickView.ts +19 -0
  35. package/app/composables/useCartUpsell.ts +100 -0
  36. package/app/composables/useCategorySeo.ts +5 -4
  37. package/app/composables/useHolidays.ts +7 -3
  38. package/app/composables/useOpeningHoursData.ts +53 -0
  39. package/app/composables/useProductCartQuantity.ts +15 -0
  40. package/app/composables/useProductCrossSelling.ts +1 -0
  41. package/app/composables/useProductDetail.ts +15 -1
  42. package/app/composables/useProductEvents.ts +30 -0
  43. package/app/composables/useProductQuickView.ts +65 -0
  44. package/app/composables/useTopSellers.ts +22 -0
  45. package/app/composables/useTrackEvent.ts +7 -0
  46. package/app/pages/bestellung/bestaetigen.vue +0 -3
  47. package/app/pages/bestellung/warenkorb.vue +0 -3
  48. package/app/pages/bestellung/zahlung-versand.vue +0 -3
  49. package/app/pages/bestellung.vue +22 -14
  50. package/app/pages/index.vue +3 -1
  51. package/app/pages/suche.vue +18 -5
  52. package/app/types/Association.d.ts +1 -0
  53. package/app/utils/openingHours.ts +31 -8
  54. package/app/utils/product.ts +31 -0
  55. package/app/utils/retry.ts +17 -0
  56. package/content/index.yml +16 -11
  57. package/content.config.ts +13 -0
  58. package/docs/notes/2026-09-12-issue-319-stylesheet-cost.md +154 -0
  59. package/docs/notes/2026-09-12-issue-325-product-card.md +100 -0
  60. package/docs/notes/2026-09-12-issue-327-home-hero.md +64 -0
  61. package/docs/notes/2026-09-13-demo-banner.md +32 -0
  62. package/docs/notes/2026-09-13-issue-332-home-info-cards.md +46 -0
  63. package/docs/notes/2026-09-13-quick-view-flicker.md +65 -0
  64. package/docs/notes/2026-09-14-cart-upsell.md +105 -0
  65. package/docs/notes/2026-09-14-demo-noindex.md +57 -0
  66. package/docs/notes/2026-09-16-issue-339-checkout-hydration.md +49 -0
  67. package/docs/notes/2026-09-16-issue-349-order-button-loading.md +39 -0
  68. package/docs/notes/2026-09-16-issue-350-remove-pinia.md +41 -0
  69. package/docs/notes/2026-09-16-issue-355-opening-hours-error.md +57 -0
  70. package/nuxt.config.ts +25 -2
  71. package/package.json +2 -3
  72. package/scripts/perf/first-render.mjs +30 -0
  73. package/scripts/perf/h2-proxy.cjs +49 -0
  74. package/scripts/perf/lighthouse.sh +22 -0
  75. package/scripts/perf/quick-view-layout.mjs +126 -0
  76. package/server/api/listing/[categoryId].get.ts +2 -0
  77. package/server/api/search.get.ts +2 -0
  78. package/test/e2e/simple-checkout-as-recurring-customer.test.ts +13 -17
  79. package/test/nuxt/CartBar.test.ts +110 -0
  80. package/test/nuxt/CartUpsell.test.ts +125 -0
  81. package/test/nuxt/CheckoutSummary.test.ts +127 -0
  82. package/test/nuxt/DemoBanner.test.ts +12 -0
  83. package/test/nuxt/useAddToCart.test.ts +6 -19
  84. package/test/nuxt/useCartUpsell.test.ts +126 -0
  85. package/test/nuxt/useOpeningHoursData.test.ts +120 -0
  86. package/test/nuxt/useTrackEvent.test.ts +15 -0
  87. package/test/unit/openingHours.spec.ts +32 -1
  88. package/test/unit/product.spec.ts +72 -0
  89. package/test/unit/retry.spec.ts +58 -0
  90. package/test/unit/useCategorySeo.spec.ts +2 -1
  91. package/test/visual/playwright.config.ts +33 -0
  92. package/test/visual/visual.spec.ts +87 -0
  93. package/app/components/Product/CardDescription.vue +0 -27
  94. package/app/components/Product/CardFooter.vue +0 -61
  95. package/app/composables/useCheckoutStore.ts +0 -1
  96. package/app/stores/checkout.ts +0 -22
@@ -0,0 +1,121 @@
1
+ <script setup lang="ts">
2
+ // Information card on the home page (#332): tinted icon, category label, a
3
+ // bold lead line, detail text and an optional action. `kind` fills the lead
4
+ // with live data; both live parts render on the client only, like the
5
+ // footer's store status (#275), with their height reserved.
6
+ export type FeatureCardProps = {
7
+ title: string;
8
+ description: string;
9
+ icon?: string;
10
+ kind?: "hours" | "delivery" | "reservation";
11
+ lead?: string;
12
+ link?: { label: string; to: string };
13
+ };
14
+
15
+ const props = defineProps<FeatureCardProps>();
16
+
17
+ const { businessHours } = useBusinessHours();
18
+ const { status } = useStoreStatus();
19
+ const { deliveryTime } = useShopBiteConfig();
20
+
21
+ const isLive = computed(
22
+ () => props.kind === "hours" || props.kind === "delivery",
23
+ );
24
+
25
+ const lead = computed(() => {
26
+ if (props.kind === "hours") {
27
+ return businessHours.value
28
+ ? formatTodayHours(businessHours.value, new Date())
29
+ : "";
30
+ }
31
+ if (props.kind === "delivery") {
32
+ return `In ca. ${deliveryTime.value} Minuten bei dir`;
33
+ }
34
+ return props.lead ?? "";
35
+ });
36
+
37
+ const statusLabel = computed(() => {
38
+ if (props.kind !== "hours" || !status.value) return "";
39
+ if (status.value.open) return `Geöffnet bis ${status.value.closesAt}`;
40
+ return status.value.nextOpening
41
+ ? `Öffnet ${status.value.nextOpening}`
42
+ : "Geschlossen";
43
+ });
44
+
45
+ const isCallLink = computed(() => props.link?.to.startsWith("tel:") ?? false);
46
+ </script>
47
+
48
+ <template>
49
+ <div
50
+ class="flex h-full flex-col gap-3 rounded-2xl bg-default p-5 shadow-md ring ring-default"
51
+ >
52
+ <div class="flex items-center justify-between gap-3">
53
+ <span
54
+ class="flex size-11 shrink-0 items-center justify-center rounded-xl bg-primary/10 text-primary"
55
+ aria-hidden="true"
56
+ >
57
+ <UIcon v-if="icon" :name="icon" class="size-6" />
58
+ </span>
59
+ <ClientOnly v-if="kind === 'hours'">
60
+ <span
61
+ v-if="statusLabel"
62
+ class="inline-flex items-center gap-1.5 text-sm font-semibold"
63
+ :class="status?.open ? 'text-success' : 'text-muted'"
64
+ role="status"
65
+ >
66
+ <span
67
+ class="size-2 rounded-full"
68
+ :class="status?.open ? 'bg-success' : 'bg-dimmed'"
69
+ aria-hidden="true"
70
+ />
71
+ {{ statusLabel }}
72
+ </span>
73
+ <template #fallback>
74
+ <span class="h-5" aria-hidden="true" />
75
+ </template>
76
+ </ClientOnly>
77
+ </div>
78
+
79
+ <div class="flex flex-col gap-1">
80
+ <span class="text-xs font-semibold tracking-wider text-muted uppercase">
81
+ {{ title }}
82
+ </span>
83
+ <ClientOnly v-if="isLive">
84
+ <span class="text-lg leading-6 font-bold text-highlighted">
85
+ {{ lead }}
86
+ </span>
87
+ <template #fallback>
88
+ <span class="block h-6" aria-hidden="true" />
89
+ </template>
90
+ </ClientOnly>
91
+ <span
92
+ v-else-if="lead"
93
+ class="text-lg leading-6 font-bold text-highlighted"
94
+ >
95
+ {{ lead }}
96
+ </span>
97
+ <p class="text-sm text-default">{{ description }}</p>
98
+ </div>
99
+
100
+ <div v-if="link" class="mt-auto pt-1">
101
+ <UButton
102
+ v-if="isCallLink"
103
+ :label="link.label"
104
+ :to="link.to"
105
+ icon="i-lucide-phone"
106
+ variant="subtle"
107
+ size="lg"
108
+ class="justify-center"
109
+ block
110
+ />
111
+ <UButton
112
+ v-else
113
+ :label="link.label"
114
+ :to="link.to"
115
+ variant="link"
116
+ trailing-icon="i-lucide-arrow-right"
117
+ class="px-0"
118
+ />
119
+ </div>
120
+ </div>
121
+ </template>
@@ -1,11 +1,11 @@
1
1
  <script setup lang="ts">
2
- import type { PageFeatureProps } from "#ui/components/PageFeature.vue";
2
+ import type { FeatureCardProps } from "~/components/Feature/Card.vue";
3
3
 
4
4
  defineProps<{
5
5
  title: string;
6
6
  description: string;
7
7
  headline?: string | undefined;
8
- features: PageFeatureProps[];
8
+ features: FeatureCardProps[];
9
9
  }>();
10
10
  </script>
11
11
 
@@ -18,20 +18,25 @@ defineProps<{
18
18
  <UPageSection
19
19
  id="features"
20
20
  :description="description"
21
- :title="title"
22
- :features="features"
23
21
  :headline="headline"
24
22
  class="relative overflow-hidden"
25
23
  >
24
+ <template #title>
25
+ <MDC :value="title" class="*:leading-9" />
26
+ </template>
26
27
  <div
27
- class="absolute rounded-full -left-10 top-10 size-[300px] z-10 bg-primary opacity-30 blur-[200px]"
28
+ class="absolute rounded-full -left-10 top-10 size-[300px] -z-10 bg-primary opacity-30 blur-[200px]"
28
29
  />
29
30
  <div
30
- class="absolute rounded-full -right-10 -bottom-10 size-[300px] z-10 bg-primary opacity-30 blur-[200px]"
31
+ class="absolute rounded-full -right-10 -bottom-10 size-[300px] -z-10 bg-primary opacity-30 blur-[200px]"
31
32
  />
32
- <template #title>
33
- <MDC :value="title" class="*:leading-9" />
34
- </template>
33
+ <div class="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3">
34
+ <FeatureCard
35
+ v-for="(feature, index) in features"
36
+ :key="index"
37
+ v-bind="feature"
38
+ />
39
+ </div>
35
40
  </UPageSection>
36
41
  </AnimatedSection>
37
42
  </template>
@@ -55,7 +55,11 @@ const hasContact = Boolean(
55
55
  </ul>
56
56
  </address>
57
57
 
58
- <div v-if="openingHours.length" class="text-sm">
58
+ <div
59
+ v-if="openingHours.length"
60
+ id="oeffnungszeiten"
61
+ class="scroll-mt-24 text-sm"
62
+ >
59
63
  <p class="font-semibold">Öffnungszeiten</p>
60
64
  <FooterStoreStatus class="mt-6" />
61
65
  <dl class="mt-4 grid grid-cols-[auto_1fr] gap-x-6 gap-y-2 text-muted">
@@ -1,20 +1,28 @@
1
1
  <script setup lang="ts">
2
2
  import { useUser } from "@shopware/composables";
3
3
  import type { DropdownMenuItem } from "@nuxt/ui";
4
+ import { useMediaQuery } from "@vueuse/core";
4
5
 
5
- const cartQuickViewOpen = ref(false);
6
- // The drawer (vaul) is created on first use instead of on every page (#314).
7
- const cartQuickViewMounted = ref(false);
8
-
9
- async function openCartQuickView() {
10
- if (!cartQuickViewMounted.value) {
11
- cartQuickViewMounted.value = true;
12
- await nextTick();
13
- }
14
- cartQuickViewOpen.value = true;
15
- }
6
+ const {
7
+ open: cartQuickViewOpen,
8
+ mounted: cartQuickViewMounted,
9
+ show: openCartQuickView,
10
+ } = useCartQuickView();
11
+ // Bottom sheet on phones (also opened from the cart bar), side panel from
12
+ // the lg breakpoint (64rem); the drawer only renders on the client (#325).
13
+ const isDesktop = useMediaQuery("(min-width: 64rem)");
14
+ const cartDrawerDirection = computed(() =>
15
+ isDesktop.value ? "right" : "bottom",
16
+ );
16
17
 
17
18
  const { count: cartCount } = useCart();
19
+
20
+ // The cart badge pops when a product goes into the cart (#325).
21
+ const { onCartItemAdded } = useProductEvents();
22
+ const cartPop = ref(0);
23
+ onCartItemAdded(() => {
24
+ cartPop.value++;
25
+ });
18
26
  const { count: wishListCount } = useWishlist();
19
27
  const { isCheckoutEnabled } = useShopBiteConfig();
20
28
  const { isLoggedIn, isGuestSession, logout } = useUser();
@@ -123,7 +131,13 @@ const dropDownMenu = computed<DropdownMenuItem[][]>(() => {
123
131
  />
124
132
  </UChip>
125
133
  </div>
126
- <UChip v-if="isCheckoutEnabled" :text="cartCount" size="3xl">
134
+ <UChip
135
+ v-if="isCheckoutEnabled"
136
+ :key="cartPop"
137
+ :text="cartCount"
138
+ size="3xl"
139
+ :class="{ 'motion-safe:animate-cart-pop': cartPop > 0 }"
140
+ >
127
141
  <UButton
128
142
  aria-label="Zum Warenkorb"
129
143
  aria-haspopup="dialog"
@@ -137,14 +151,29 @@ const dropDownMenu = computed<DropdownMenuItem[][]>(() => {
137
151
  v-if="cartQuickViewMounted"
138
152
  v-model:open="cartQuickViewOpen"
139
153
  title="Warenkorb"
140
- direction="right"
154
+ :direction="cartDrawerDirection"
155
+ :ui="{
156
+ content:
157
+ cartDrawerDirection === 'right' ? 'w-full max-w-md' : 'max-h-[92vh]',
158
+ }"
141
159
  >
142
160
  <template #header>
143
- <div class="h-full flex flex-col justify-center">
144
- <h2 class="flex items-center gap-2 text-3xl md:text-4xl mt-8 mb-3 pb-2">
161
+ <div class="flex h-full w-full items-center justify-between gap-2">
162
+ <h2
163
+ class="flex items-center gap-2 text-3xl md:text-4xl mb-3 pb-2 lg:mt-8"
164
+ >
145
165
  <UIcon name="i-lucide-shopping-bag" class="size-8" color="primary" />
146
166
  Warenkorb
147
167
  </h2>
168
+ <!-- The sheet also closes by swiping the handle down, tapping the
169
+ overlay or pressing Escape; the button makes it obvious. -->
170
+ <UButton
171
+ icon="i-lucide-x"
172
+ color="neutral"
173
+ variant="ghost"
174
+ aria-label="Warenkorb schließen"
175
+ @click="cartQuickViewOpen = false"
176
+ />
148
177
  </div>
149
178
  </template>
150
179
  <template #body>
@@ -9,6 +9,7 @@ const props = withDefaults(
9
9
  backgroundVideo?: string;
10
10
  /** First frame of the video as an image; the LCP element (#273). */
11
11
  poster?: string;
12
+ /** The first link is the one primary action, the others are quiet (#327). */
12
13
  links: ButtonProps[];
13
14
  usps?: {
14
15
  title?: string;
@@ -65,18 +66,39 @@ onMounted(() => {
65
66
  }
66
67
  });
67
68
  });
69
+
70
+ // Live status line: opening state from the business hours (client only, the
71
+ // browser's clock decides, #275) and the delivery time from the plugin.
72
+ const { status } = useStoreStatus();
73
+ const { deliveryTime, isCheckoutEnabled } = useShopBiteConfig();
74
+
75
+ const statusLabel = computed(() => {
76
+ if (!status.value) return undefined;
77
+ if (status.value.open) return `Geöffnet bis ${status.value.closesAt}`;
78
+ return status.value.nextOpening
79
+ ? `Geschlossen · öffnet ${status.value.nextOpening}`
80
+ : "Geschlossen";
81
+ });
82
+
83
+ const primaryLink = computed(() => props.links[0]);
84
+ const secondaryLinks = computed(() => props.links.slice(1));
68
85
  </script>
69
86
 
70
87
  <template>
71
- <div class="relative isolate overflow-hidden">
88
+ <!-- Direction A of the canvas "Startseite Hero": full-bleed photo with a
89
+ bottom-to-top gradient instead of a flat overlay, the content bottom
90
+ left inside the container width, one primary action (#327). -->
91
+ <div
92
+ class="relative isolate flex min-h-[520px] flex-col justify-end overflow-hidden bg-neutral-950 sm:min-h-[560px]"
93
+ >
72
94
  <!-- No CSS blur on the poster: blur the image file itself (see docs);
73
- a filter on a full-screen image delays the first paint on phones. -->
95
+ a filter on a full-screen image delays the first paint on phones. -->
74
96
  <img
75
97
  v-if="poster"
76
98
  :src="poster"
77
99
  alt=""
78
100
  fetchpriority="high"
79
- class="absolute inset-0 w-full h-full object-cover -z-20"
101
+ class="absolute inset-0 -z-20 h-full w-full object-cover"
80
102
  />
81
103
  <video
82
104
  v-if="showVideo"
@@ -87,47 +109,115 @@ onMounted(() => {
87
109
  playsinline
88
110
  preload="metadata"
89
111
  :poster="poster"
90
- class="absolute inset-0 w-full h-full object-cover -z-10 blur-sm scale-105"
112
+ class="absolute inset-0 -z-10 h-full w-full scale-105 object-cover blur-sm"
91
113
  >
92
114
  <source :src="backgroundVideo" type="video/mp4" />
93
115
  </video>
94
- <div class="bg-black/50">
95
- <UPageHero
96
- :title="title"
97
- :description="description"
98
- :headline="headline"
99
- :links="links"
100
- orientation="vertical"
101
- :ui="{
102
- title: 'text-white',
103
- description: 'text-white',
104
- }"
116
+ <div
117
+ class="absolute inset-0 -z-10 bg-gradient-to-b from-neutral-950/15 via-neutral-950/35 to-neutral-950/85"
118
+ aria-hidden="true"
119
+ />
120
+
121
+ <UContainer>
122
+ <div
123
+ class="flex max-w-2xl flex-col gap-4 py-6 text-white sm:gap-5 sm:py-10 lg:py-14"
105
124
  >
106
- <div v-if="usps" class="flex flex-row gap-2 md:gap-8 justify-center">
107
- <ULink
125
+ <div
126
+ v-if="usps.length > 0"
127
+ class="flex flex-wrap items-center gap-x-4 gap-y-2 text-sm"
128
+ >
129
+ <component
130
+ :is="usp.link ? 'a' : 'span'"
108
131
  v-for="(usp, index) in usps"
109
132
  :key="index"
110
- as="button"
111
- :to="usp.link ?? ''"
112
- class="flex flex-col md:flex-row items-center text-center md:text-left gap-2"
113
- target="_blank"
133
+ :href="usp.link"
134
+ :target="usp.link ? '_blank' : undefined"
135
+ :rel="usp.link ? 'noopener' : undefined"
136
+ class="inline-flex items-center gap-1.5 text-white/90"
137
+ >
138
+ <UIcon v-if="usp.icon" :name="usp.icon" class="size-4 shrink-0" />
139
+ <span v-if="usp.title" class="font-semibold text-white">
140
+ {{ usp.title }}
141
+ </span>
142
+ <span v-if="usp.subtitle" class="text-white/80">
143
+ {{ usp.subtitle }}
144
+ </span>
145
+ </component>
146
+ </div>
147
+
148
+ <div class="flex flex-col gap-2">
149
+ <span
150
+ v-if="headline"
151
+ class="text-xs font-semibold tracking-widest text-white/80 uppercase"
114
152
  >
115
- <UIcon
116
- v-if="usp.icon"
117
- :name="usp.icon"
118
- class="text-white text-xl"
153
+ {{ headline }}
154
+ </span>
155
+ <h1
156
+ class="text-4xl font-extrabold tracking-tight text-balance sm:text-5xl lg:text-6xl"
157
+ >
158
+ {{ title }}
159
+ </h1>
160
+ <p
161
+ v-if="description"
162
+ class="text-base text-pretty text-white/90 sm:text-lg"
163
+ >
164
+ {{ description }}
165
+ </p>
166
+ </div>
167
+
168
+ <!-- Fixed height: the status arrives after hydration (#327). -->
169
+ <div
170
+ class="flex min-h-6 flex-wrap items-center gap-x-4 gap-y-1 text-sm text-white/90"
171
+ aria-live="polite"
172
+ >
173
+ <span
174
+ v-if="statusLabel"
175
+ class="inline-flex items-center gap-2"
176
+ data-testid="hero-status"
177
+ >
178
+ <span
179
+ class="size-2 rounded-full"
180
+ :class="
181
+ status?.open
182
+ ? 'bg-green-400 shadow-[0_0_0_3px_rgba(74,222,128,0.3)]'
183
+ : 'bg-neutral-400'
184
+ "
185
+ aria-hidden="true"
119
186
  />
120
- <div class="flex flex-col">
121
- <span v-if="usp.title" class="text-white font-semibold">{{
122
- usp.title
123
- }}</span>
124
- <span v-if="usp.subtitle" class="text-white/80 text-xs">{{
125
- usp.subtitle
126
- }}</span>
127
- </div>
128
- </ULink>
187
+ {{ statusLabel }}
188
+ </span>
189
+ <span
190
+ v-if="statusLabel && isCheckoutEnabled"
191
+ class="inline-flex items-center gap-1.5"
192
+ >
193
+ <UIcon name="i-lucide-bike" class="size-4" />
194
+ Lieferung ca. {{ deliveryTime }} Min
195
+ </span>
196
+ </div>
197
+
198
+ <div
199
+ v-if="links.length > 0"
200
+ class="flex flex-col items-stretch gap-3 sm:flex-row sm:items-center"
201
+ >
202
+ <UButton
203
+ v-if="primaryLink"
204
+ v-bind="primaryLink"
205
+ color="primary"
206
+ variant="solid"
207
+ size="xl"
208
+ class="justify-center px-6 shadow-lg shadow-primary/30"
209
+ />
210
+ <UButton
211
+ v-for="(link, index) in secondaryLinks"
212
+ :key="index"
213
+ v-bind="link"
214
+ color="neutral"
215
+ variant="ghost"
216
+ size="xl"
217
+ class="justify-center bg-transparent text-white hover:bg-white/10 active:bg-white/10"
218
+ />
129
219
  </div>
130
- </UPageHero>
131
- </div>
220
+ </div>
221
+ </UContainer>
132
222
  </div>
133
223
  </template>
@@ -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,56 +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>
46
-
47
- <div v-if="product.cover?.media?.url">
61
+ <div v-if="coverMedia?.url" class="relative">
48
62
  <img
49
- :src="product.cover.media.url"
50
- :srcset="mediaSrcSet(product.cover.media)"
51
- sizes="(min-width: 1024px) 50vw, 100vw"
52
- :width="mediaSize(product.cover.media)?.width"
53
- :height="mediaSize(product.cover.media)?.height"
54
- :alt="label"
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"
55
69
  loading="lazy"
56
70
  decoding="async"
57
- class="rounded-md h-auto max-w-full object-contain transition-opacity duration-700"
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>
80
+
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"
58
92
  />
59
93
  </div>
60
94
 
61
- <template #title>
62
- <div class="flex flex-row items-center gap-1">
63
- <span class="text-sm text-primary">#{{ number }}</span>
64
- <ProductCardKitchen :sorted-properties="sortedProperties" />
65
- <p class="text-base text-pretty font-semibold text-highlighted">
66
- {{ label }}
67
- </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>
68
132
  </div>
69
- </template>
70
133
 
71
- <template #description>
72
- <ProductCardDescription
73
- :description="description"
134
+ <ProductCardIngredients
74
135
  :sorted-properties="sortedProperties"
136
+ :with-diet-badges="!coverMedia?.url"
75
137
  />
76
- </template>
77
-
78
- <template #footer>
79
- <ProductCardFooter
80
- :price="price"
81
- :product="product"
82
- :with-favorite-button="withFavoriteButton"
83
- :with-add-to-cart-button="withAddToCartButton"
84
- @variant-selected="onVariantSelected"
85
- />
86
- </template>
87
- </UPageCard>
138
+ </div>
139
+ </article>
88
140
  </AnimatedSection>
89
141
  </template>