@shopbite-de/storefront 1.24.0 → 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.
- package/.env.example +3 -0
- package/CLAUDE.md +9 -2
- package/app/app.config.ts +3 -2
- package/app/app.vue +4 -1
- package/app/assets/css/main.css +16 -0
- package/app/components/AddToWishlist.vue +13 -6
- package/app/components/Cart/Bar.vue +102 -0
- package/app/components/Cart/QuickView.vue +4 -0
- package/app/components/Cart/Upsell.vue +106 -0
- package/app/components/Category/Listing.vue +11 -3
- package/app/components/Checkout/Summary.vue +5 -1
- package/app/components/DemoBanner.vue +13 -0
- package/app/components/Feature/Card.vue +121 -0
- package/app/components/Features.vue +14 -9
- package/app/components/Footer/Contact.vue +5 -1
- package/app/components/Header/Right.vue +44 -15
- package/app/components/Hero.vue +126 -36
- package/app/components/Product/Card.vue +102 -50
- package/app/components/Product/CardCompact.vue +72 -0
- package/app/components/Product/CardDietBadges.vue +38 -31
- package/app/components/Product/CardIngredients.vue +35 -0
- package/app/components/Product/CardSkeleton.vue +10 -18
- package/app/components/Product/Category.vue +9 -2
- package/app/components/Product/Configurator.vue +11 -7
- package/app/components/Product/CrossSelling.vue +45 -34
- package/app/components/Product/DeselectIngredient.vue +37 -31
- package/app/components/Product/Detail.vue +73 -13
- package/app/components/Product/QuickView.vue +77 -0
- package/app/components/Topseller.vue +44 -34
- package/app/composables/useAddToCart.ts +3 -30
- package/app/composables/useCartQuickView.ts +19 -0
- package/app/composables/useCartUpsell.ts +100 -0
- package/app/composables/useCategorySeo.ts +5 -4
- package/app/composables/useProductCartQuantity.ts +15 -0
- package/app/composables/useProductCrossSelling.ts +1 -0
- package/app/composables/useProductDetail.ts +15 -1
- package/app/composables/useProductEvents.ts +30 -0
- package/app/composables/useProductQuickView.ts +65 -0
- package/app/composables/useTopSellers.ts +22 -0
- package/app/composables/useTrackEvent.ts +7 -0
- package/app/pages/index.vue +3 -1
- package/app/pages/suche.vue +18 -5
- package/app/types/Association.d.ts +1 -0
- package/app/utils/openingHours.ts +31 -8
- package/app/utils/product.ts +31 -0
- package/content/index.yml +16 -11
- package/content.config.ts +13 -0
- package/docs/notes/2026-09-12-issue-319-stylesheet-cost.md +154 -0
- package/docs/notes/2026-09-12-issue-325-product-card.md +100 -0
- package/docs/notes/2026-09-12-issue-327-home-hero.md +64 -0
- package/docs/notes/2026-09-13-demo-banner.md +32 -0
- package/docs/notes/2026-09-13-issue-332-home-info-cards.md +46 -0
- package/docs/notes/2026-09-13-quick-view-flicker.md +65 -0
- package/docs/notes/2026-09-14-cart-upsell.md +105 -0
- package/docs/notes/2026-09-14-demo-noindex.md +57 -0
- package/nuxt.config.ts +24 -0
- package/package.json +1 -1
- package/scripts/perf/first-render.mjs +30 -0
- package/scripts/perf/h2-proxy.cjs +49 -0
- package/scripts/perf/lighthouse.sh +22 -0
- package/scripts/perf/quick-view-layout.mjs +126 -0
- package/server/api/listing/[categoryId].get.ts +2 -0
- package/server/api/search.get.ts +2 -0
- package/test/e2e/simple-checkout-as-recurring-customer.test.ts +13 -17
- package/test/nuxt/CartBar.test.ts +110 -0
- package/test/nuxt/CartUpsell.test.ts +125 -0
- package/test/nuxt/DemoBanner.test.ts +12 -0
- package/test/nuxt/useAddToCart.test.ts +6 -19
- package/test/nuxt/useCartUpsell.test.ts +126 -0
- package/test/nuxt/useTrackEvent.test.ts +15 -0
- package/test/unit/openingHours.spec.ts +32 -1
- package/test/unit/product.spec.ts +72 -0
- package/test/unit/useCategorySeo.spec.ts +2 -1
- package/test/visual/playwright.config.ts +33 -0
- package/test/visual/visual.spec.ts +87 -0
- package/app/components/Product/CardDescription.vue +0 -27
- package/app/components/Product/CardFooter.vue +0 -61
|
@@ -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
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
|
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="
|
|
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
|
|
144
|
-
<h2
|
|
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>
|
package/app/components/Hero.vue
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
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
|
|
107
|
-
|
|
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
|
-
|
|
111
|
-
:
|
|
112
|
-
|
|
113
|
-
|
|
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
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
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
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
</
|
|
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
|
-
</
|
|
131
|
-
</
|
|
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
|
-
|
|
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
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
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
|
|
23
|
-
|
|
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
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
<
|
|
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="
|
|
50
|
-
:srcset="mediaSrcSet(
|
|
51
|
-
sizes="(min-width:
|
|
52
|
-
:width="mediaSize(
|
|
53
|
-
:height="mediaSize(
|
|
54
|
-
:alt="
|
|
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="
|
|
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
|
-
<
|
|
62
|
-
<div
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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
|
-
|
|
72
|
-
<ProductCardDescription
|
|
73
|
-
:description="description"
|
|
134
|
+
<ProductCardIngredients
|
|
74
135
|
:sorted-properties="sortedProperties"
|
|
136
|
+
:with-diet-badges="!coverMedia?.url"
|
|
75
137
|
/>
|
|
76
|
-
</
|
|
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>
|
|
@@ -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 =
|
|
5
|
-
|
|
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
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
<
|
|
29
|
-
v-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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>
|