@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,26 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
|
-
class="
|
|
3
|
+
class="flex flex-col gap-3 rounded-xl bg-default p-4 shadow-md ring ring-default"
|
|
4
4
|
>
|
|
5
|
-
<div class="flex
|
|
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-
|
|
13
|
-
<USkeleton class="h-
|
|
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
|
-
:
|
|
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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
<
|
|
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 {
|
|
3
|
-
|
|
2
|
+
import type {
|
|
3
|
+
AssociationItem,
|
|
4
|
+
AssociationItemProduct,
|
|
5
|
+
} from "~/types/Association";
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
|
18
|
-
() =>
|
|
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
|
|
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
|
-
|
|
30
|
-
|
|
31
|
-
|
|
44
|
+
class="flex flex-wrap gap-2"
|
|
45
|
+
role="group"
|
|
46
|
+
:aria-label="association.label"
|
|
32
47
|
>
|
|
33
|
-
<
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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="
|
|
36
|
-
<
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { Schemas } from "#shopware";
|
|
3
|
+
import type { AssociationItemProduct } from "~/types/Association";
|
|
3
4
|
|
|
4
5
|
const props = defineProps<{
|
|
5
6
|
productId: string;
|
|
@@ -9,6 +10,7 @@ const emit = defineEmits(["product-added", "variant-selected"]);
|
|
|
9
10
|
|
|
10
11
|
const {
|
|
11
12
|
productDetails,
|
|
13
|
+
associationItems,
|
|
12
14
|
pending,
|
|
13
15
|
selectedProduct,
|
|
14
16
|
selectedQuantity,
|
|
@@ -19,6 +21,29 @@ const {
|
|
|
19
21
|
onIngredientsDeselected,
|
|
20
22
|
} = useProductDetail(() => props.productId);
|
|
21
23
|
|
|
24
|
+
const { getFormattedPrice } = useCommercePrice();
|
|
25
|
+
|
|
26
|
+
const selectedExtras = ref<AssociationItemProduct[]>([]);
|
|
27
|
+
|
|
28
|
+
function onExtras(extras: AssociationItemProduct[]) {
|
|
29
|
+
selectedExtras.value = extras;
|
|
30
|
+
onExtrasSelected(extras);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Unit price plus extras, times the quantity: what the button will add.
|
|
34
|
+
const total = computed(() => {
|
|
35
|
+
const unitPrice = selectedProduct.value?.calculatedPrice.unitPrice ?? 0;
|
|
36
|
+
const extrasPrice = selectedExtras.value.reduce(
|
|
37
|
+
(sum, extra) => sum + (extra.unitPrice ?? 0),
|
|
38
|
+
0,
|
|
39
|
+
);
|
|
40
|
+
return (unitPrice + extrasPrice) * selectedQuantity.value;
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const isAvailable = computed(() =>
|
|
44
|
+
selectedProduct.value ? productIsAvailable(selectedProduct.value) : true,
|
|
45
|
+
);
|
|
46
|
+
|
|
22
47
|
const onVariantSwitched = (variant: Schemas["Product"]) => {
|
|
23
48
|
setSelectedProduct(variant);
|
|
24
49
|
emit("variant-selected", variant);
|
|
@@ -28,41 +53,76 @@ const onAddToCart = () => emit("product-added");
|
|
|
28
53
|
</script>
|
|
29
54
|
|
|
30
55
|
<template>
|
|
31
|
-
<div
|
|
32
|
-
|
|
56
|
+
<div class="flex flex-col gap-5">
|
|
57
|
+
<!-- One placeholder in the shape of the loaded body (options, extras,
|
|
58
|
+
ingredients), shown until product and extras are both loaded. -->
|
|
59
|
+
<div v-if="pending" class="flex flex-col gap-5" aria-busy="true">
|
|
60
|
+
<div class="flex flex-col gap-2">
|
|
61
|
+
<USkeleton class="h-5 w-24" />
|
|
62
|
+
<USkeleton class="h-11 w-full" />
|
|
63
|
+
</div>
|
|
64
|
+
<div class="flex flex-col gap-2">
|
|
65
|
+
<USkeleton class="h-5 w-20" />
|
|
66
|
+
<div class="flex flex-wrap gap-2">
|
|
67
|
+
<USkeleton class="h-10 w-32 rounded-full" />
|
|
68
|
+
<USkeleton class="h-10 w-28 rounded-full" />
|
|
69
|
+
<USkeleton class="h-10 w-36 rounded-full" />
|
|
70
|
+
<USkeleton class="h-10 w-24 rounded-full" />
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
<div class="flex flex-col gap-2">
|
|
74
|
+
<USkeleton class="h-5 w-16" />
|
|
75
|
+
<div class="flex flex-wrap gap-2">
|
|
76
|
+
<USkeleton class="h-10 w-28 rounded-full" />
|
|
77
|
+
<USkeleton class="h-10 w-24 rounded-full" />
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
<template v-else-if="productDetails?.configurator">
|
|
33
82
|
<ProductConfigurator
|
|
34
|
-
v-if="productDetails?.configurator"
|
|
35
83
|
:p="productDetails.product"
|
|
36
84
|
:c="productDetails.configurator"
|
|
37
85
|
@variant-switched="onVariantSwitched"
|
|
38
86
|
/>
|
|
39
87
|
<ProductCrossSelling
|
|
40
|
-
v-if="
|
|
41
|
-
:
|
|
42
|
-
@extras-selected="
|
|
88
|
+
v-if="associationItems.length > 0"
|
|
89
|
+
:associations="associationItems"
|
|
90
|
+
@extras-selected="onExtras"
|
|
43
91
|
/>
|
|
44
92
|
<ProductDeselectIngredient
|
|
45
93
|
v-if="selectedProduct"
|
|
46
94
|
:product="selectedProduct"
|
|
47
95
|
@ingredients-deselected="onIngredientsDeselected"
|
|
48
96
|
/>
|
|
49
|
-
</
|
|
50
|
-
|
|
97
|
+
</template>
|
|
98
|
+
|
|
99
|
+
<div
|
|
100
|
+
class="sticky bottom-0 mt-auto flex items-center gap-3 border-t border-default bg-default pt-4"
|
|
101
|
+
>
|
|
51
102
|
<UInputNumber
|
|
52
103
|
v-model="selectedQuantity"
|
|
53
104
|
size="xl"
|
|
54
|
-
|
|
105
|
+
aria-label="Anzahl"
|
|
55
106
|
:min="1"
|
|
56
107
|
:max="100"
|
|
108
|
+
:disabled="pending"
|
|
109
|
+
class="w-28 shrink-0"
|
|
57
110
|
/>
|
|
111
|
+
<!-- Short label: "In den Warenkorb" wrapped next to the total on phones. -->
|
|
58
112
|
<UButton
|
|
59
|
-
|
|
113
|
+
class="flex-1 justify-between whitespace-nowrap"
|
|
60
114
|
size="xl"
|
|
61
|
-
label="In den Warenkorb"
|
|
62
115
|
icon="i-lucide-shopping-cart"
|
|
63
|
-
|
|
116
|
+
:disabled="isLoading || pending || !isAvailable"
|
|
117
|
+
:loading="isLoading"
|
|
118
|
+
aria-label="In den Warenkorb"
|
|
64
119
|
@click="addToCart(onAddToCart)"
|
|
65
|
-
|
|
120
|
+
>
|
|
121
|
+
<span>{{ isAvailable ? "Hinzufügen" : "Ausverkauft" }}</span>
|
|
122
|
+
<span v-if="isAvailable && !pending" class="font-bold">
|
|
123
|
+
{{ getFormattedPrice(total) }}
|
|
124
|
+
</span>
|
|
125
|
+
</UButton>
|
|
66
126
|
</div>
|
|
67
127
|
</div>
|
|
68
128
|
</template>
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { Schemas } from "#shopware";
|
|
3
|
+
import { useMediaQuery } from "@vueuse/core";
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{
|
|
6
|
+
product: Schemas["Product"] | undefined;
|
|
7
|
+
}>();
|
|
8
|
+
|
|
9
|
+
const open = defineModel<boolean>("open", { required: true });
|
|
10
|
+
|
|
11
|
+
// Bottom sheet on phones, side panel from the lg breakpoint (64rem).
|
|
12
|
+
const isDesktop = useMediaQuery("(min-width: 64rem)");
|
|
13
|
+
const direction = computed(() => (isDesktop.value ? "right" : "bottom"));
|
|
14
|
+
|
|
15
|
+
const sortedProperties = computed(
|
|
16
|
+
() =>
|
|
17
|
+
props.product?.sortedProperties as Schemas["PropertyGroup"][] | undefined,
|
|
18
|
+
);
|
|
19
|
+
const label = ref(props.product?.translated.name ?? props.product?.name ?? "");
|
|
20
|
+
const description = ref(props.product?.description);
|
|
21
|
+
|
|
22
|
+
watch(
|
|
23
|
+
() => props.product,
|
|
24
|
+
(product) => {
|
|
25
|
+
if (!product) return;
|
|
26
|
+
label.value = product.translated.name ?? product.name;
|
|
27
|
+
description.value = product.description;
|
|
28
|
+
},
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
function onVariantSelected(variant: Schemas["Product"]) {
|
|
32
|
+
label.value = variant.translated.name ?? variant.name;
|
|
33
|
+
description.value = variant.translated.description ?? variant.description;
|
|
34
|
+
}
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<template>
|
|
38
|
+
<!-- Only the body scrolls: header and footer stay in place without sticky
|
|
39
|
+
positioning, and shrink-0 keeps the flex column from squeezing the
|
|
40
|
+
header to its min-height (#325). -->
|
|
41
|
+
<UDrawer
|
|
42
|
+
v-model:open="open"
|
|
43
|
+
:direction="direction"
|
|
44
|
+
:close="true"
|
|
45
|
+
:ui="{
|
|
46
|
+
content: direction === 'right' ? 'w-full max-w-md' : 'max-h-[92vh]',
|
|
47
|
+
container: 'overflow-hidden',
|
|
48
|
+
header: 'shrink-0 items-start border-b border-default pb-3',
|
|
49
|
+
body: 'flex min-h-0 flex-col gap-5 overflow-y-auto',
|
|
50
|
+
}"
|
|
51
|
+
>
|
|
52
|
+
<template #title>
|
|
53
|
+
<span class="flex flex-col gap-0.5">
|
|
54
|
+
<span class="text-xs font-semibold text-primary">
|
|
55
|
+
#{{ product?.productNumber }}
|
|
56
|
+
</span>
|
|
57
|
+
<span class="text-xl font-bold text-highlighted">{{ label }}</span>
|
|
58
|
+
</span>
|
|
59
|
+
</template>
|
|
60
|
+
<template v-if="description" #description>
|
|
61
|
+
{{ description }}
|
|
62
|
+
</template>
|
|
63
|
+
<template #body>
|
|
64
|
+
<ProductCardIngredients
|
|
65
|
+
:sorted-properties="sortedProperties"
|
|
66
|
+
:with-diet-badges="true"
|
|
67
|
+
/>
|
|
68
|
+
<ProductDetail
|
|
69
|
+
v-if="product"
|
|
70
|
+
:key="product.id"
|
|
71
|
+
:product-id="product.id"
|
|
72
|
+
@product-added="open = false"
|
|
73
|
+
@variant-selected="onVariantSelected"
|
|
74
|
+
/>
|
|
75
|
+
</template>
|
|
76
|
+
</UDrawer>
|
|
77
|
+
</template>
|
|
@@ -1,43 +1,53 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
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
4
|
const { loadTopSellers } = useTopSellers();
|
|
5
5
|
|
|
6
|
-
const topSellers = await
|
|
6
|
+
const { data: topSellers } = await useAsyncData("top-sellers", () =>
|
|
7
|
+
loadTopSellers(),
|
|
8
|
+
);
|
|
7
9
|
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
label: "Zur Speisekarte",
|
|
11
|
-
to: "/speisekarte",
|
|
12
|
-
color: "primary",
|
|
13
|
-
variant: "subtle",
|
|
14
|
-
trailingIcon: "i-lucide-arrow-right",
|
|
15
|
-
},
|
|
16
|
-
]);
|
|
10
|
+
const products = computed(() => topSellers.value ?? []);
|
|
11
|
+
const quickView = useProductQuickView(products);
|
|
17
12
|
</script>
|
|
18
13
|
|
|
19
14
|
<template>
|
|
20
|
-
<
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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"
|
|
25
37
|
>
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
</AnimatedSection>
|
|
42
|
-
</div>
|
|
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>
|
|
43
53
|
</template>
|
|
@@ -4,14 +4,13 @@ import { v5 as uuidv5, v4 as uuidv4 } from "uuid";
|
|
|
4
4
|
import { computed, ref } from "vue";
|
|
5
5
|
|
|
6
6
|
const UUID_NAMESPACE = "b098ef7e-0fa2-4073-b002-7ceec4360fbf";
|
|
7
|
-
const CART_SUCCESS_TITLE = "Gute Wahl!";
|
|
8
7
|
const LINE_ITEM_PRODUCT = "product";
|
|
9
8
|
const LINE_ITEM_CONTAINER = "container";
|
|
10
9
|
|
|
11
10
|
export function useAddToCart() {
|
|
12
11
|
const { addLineItems } = useCartMutations();
|
|
13
|
-
|
|
14
|
-
const {
|
|
12
|
+
// Feedback is the cart bar / header badge animation, not a toast (#325).
|
|
13
|
+
const { triggerCartItemAdded } = useProductEvents();
|
|
15
14
|
const { trackAddToCart: trackAddToCartEvent } = useTrackEvent();
|
|
16
15
|
|
|
17
16
|
const selectedExtras = ref<AssociationItemProduct[]>([]);
|
|
@@ -45,12 +44,6 @@ export function useAddToCart() {
|
|
|
45
44
|
"-",
|
|
46
45
|
);
|
|
47
46
|
|
|
48
|
-
console.log(
|
|
49
|
-
selectedProduct.value.translated.name,
|
|
50
|
-
extrasFormatted,
|
|
51
|
-
removedFormatted,
|
|
52
|
-
);
|
|
53
|
-
|
|
54
47
|
return `${selectedProduct.value.translated.name}${extrasFormatted}${removedFormatted}`;
|
|
55
48
|
});
|
|
56
49
|
|
|
@@ -118,25 +111,6 @@ export function useAddToCart() {
|
|
|
118
111
|
];
|
|
119
112
|
}
|
|
120
113
|
|
|
121
|
-
async function showSuccessToast() {
|
|
122
|
-
if (!selectedProduct.value) return;
|
|
123
|
-
|
|
124
|
-
toast.add({
|
|
125
|
-
title: CART_SUCCESS_TITLE,
|
|
126
|
-
description: `${selectedProduct.value.translated.name} wurde in den Warenkorb gelegt.`,
|
|
127
|
-
icon: "i-lucide-shopping-cart",
|
|
128
|
-
color: "primary",
|
|
129
|
-
progress: true,
|
|
130
|
-
duration: 2000,
|
|
131
|
-
actions: [
|
|
132
|
-
{
|
|
133
|
-
label: "Zum Warenkorb",
|
|
134
|
-
to: "/bestellung/warenkorb",
|
|
135
|
-
},
|
|
136
|
-
],
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
|
|
140
114
|
async function addToCart(onSuccess?: () => void) {
|
|
141
115
|
if (!selectedProduct.value || isLoading.value) return;
|
|
142
116
|
isLoading.value = true;
|
|
@@ -146,8 +120,7 @@ export function useAddToCart() {
|
|
|
146
120
|
const newCart = await addLineItems(createCartItems());
|
|
147
121
|
if (!newCart) return;
|
|
148
122
|
|
|
149
|
-
|
|
150
|
-
triggerProductAdded();
|
|
123
|
+
triggerCartItemAdded(selectedProduct.value, selectedQuantity.value);
|
|
151
124
|
trackAddToCartEvent(selectedProduct.value, selectedQuantity.value);
|
|
152
125
|
onSuccess?.();
|
|
153
126
|
} finally {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared state of the cart drawer (Header/Right.vue), so the header button
|
|
3
|
+
* and the sticky cart bar open the same drawer. The drawer (vaul) is created
|
|
4
|
+
* on first use instead of on every page (#314).
|
|
5
|
+
*/
|
|
6
|
+
export function useCartQuickView() {
|
|
7
|
+
const open = useState("cart-quick-view-open", () => false);
|
|
8
|
+
const mounted = useState("cart-quick-view-mounted", () => false);
|
|
9
|
+
|
|
10
|
+
async function show() {
|
|
11
|
+
if (!mounted.value) {
|
|
12
|
+
mounted.value = true;
|
|
13
|
+
await nextTick();
|
|
14
|
+
}
|
|
15
|
+
open.value = true;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return { open, mounted, show };
|
|
19
|
+
}
|