@shopbite-de/storefront 1.31.3 → 2.0.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 (185) hide show
  1. package/.github/workflows/ci.yaml +54 -0
  2. package/CLAUDE.md +23 -8
  3. package/app/app.vue +10 -6
  4. package/app/assets/css/main.css +100 -61
  5. package/app/components/AddToWishlist.vue +15 -25
  6. package/app/components/Address/Card.vue +6 -11
  7. package/app/components/Address/Detail.vue +23 -23
  8. package/app/components/Address/Fields.vue +175 -73
  9. package/app/components/Address/Form.vue +107 -106
  10. package/app/components/Cart/Bar.vue +6 -9
  11. package/app/components/Cart/Item.vue +48 -63
  12. package/app/components/Cart/QuickView.vue +38 -25
  13. package/app/components/Cart/Upsell.vue +24 -62
  14. package/app/components/Category/Breadcrumb.vue +29 -3
  15. package/app/components/Category/FilterGroup.vue +20 -41
  16. package/app/components/Category/Listing.vue +100 -130
  17. package/app/components/Category/SearchInput.vue +22 -19
  18. package/app/components/Checkout/DeliveryTimeSelect.vue +55 -77
  19. package/app/components/Checkout/LoginOrRegister.vue +28 -29
  20. package/app/components/Checkout/PaymentAndDelivery.vue +114 -86
  21. package/app/components/Checkout/Summary.vue +90 -60
  22. package/app/components/Checkout/VoucherInput.vue +40 -27
  23. package/app/components/Contact/Form.vue +164 -192
  24. package/app/components/DemoBanner.vue +5 -5
  25. package/app/components/Footer/StoreStatus.vue +2 -2
  26. package/app/components/Footer.vue +125 -57
  27. package/app/components/Header.vue +283 -18
  28. package/app/components/Home/Categories.vue +116 -0
  29. package/app/components/Home/Facts.vue +71 -0
  30. package/app/components/Home/Faq.vue +34 -16
  31. package/app/components/Home/Hero.vue +172 -0
  32. package/app/components/Home/Highlights.vue +29 -37
  33. package/app/components/Home/Restaurant.vue +102 -0
  34. package/app/components/Menu/BonCard.vue +180 -0
  35. package/app/components/Menu/CartPanel.vue +24 -0
  36. package/app/components/Menu/CategoryIndex.vue +54 -0
  37. package/app/components/Menu/OrderMode.vue +20 -0
  38. package/app/components/Menu/SectionHeader.vue +38 -0
  39. package/app/components/Navigation/MobileTop.vue +23 -15
  40. package/app/components/Order/Confirmation.vue +119 -0
  41. package/app/components/Order/Detail.vue +80 -88
  42. package/app/components/Product/CardSkeleton.vue +8 -12
  43. package/app/components/Product/Configurator.vue +8 -16
  44. package/app/components/Product/CrossSelling.vue +75 -83
  45. package/app/components/Product/DeselectIngredient.vue +17 -22
  46. package/app/components/Product/Detail.vue +35 -27
  47. package/app/components/Product/QuickView.vue +80 -51
  48. package/app/components/SalesChannelSwitch.vue +14 -28
  49. package/app/components/Sb/Button.vue +70 -0
  50. package/app/components/Sb/Checkbox.vue +73 -0
  51. package/app/components/Sb/Chip.vue +51 -0
  52. package/app/components/Sb/ChoiceGroup.vue +82 -0
  53. package/app/components/Sb/ConfirmDialog.vue +60 -0
  54. package/app/components/Sb/Field.vue +77 -0
  55. package/app/components/Sb/Icon.vue +66 -0
  56. package/app/components/Sb/IconButton.vue +55 -0
  57. package/app/components/Sb/Input.vue +23 -0
  58. package/app/components/Sb/SegmentedControl.vue +34 -0
  59. package/app/components/Sb/Select.vue +49 -0
  60. package/app/components/Sb/Sheet.vue +83 -0
  61. package/app/components/Sb/Stars.vue +60 -0
  62. package/app/components/Sb/StatusPill.vue +38 -0
  63. package/app/components/Sb/Stepper.vue +72 -0
  64. package/app/components/User/AccountHeader.vue +16 -0
  65. package/app/components/User/AuthPanel.vue +41 -0
  66. package/app/components/User/Detail.vue +32 -29
  67. package/app/components/User/LoginForm.vue +92 -98
  68. package/app/components/User/RegistrationForm.vue +285 -249
  69. package/app/components/Wishlist.vue +55 -155
  70. package/app/composables/useCartMutations.ts +9 -27
  71. package/app/composables/useCheckoutMethodGuard.ts +2 -24
  72. package/app/composables/useContactForm.ts +66 -0
  73. package/app/composables/useHomeMenuCategories.ts +41 -0
  74. package/app/composables/useNavigation.ts +10 -2
  75. package/app/composables/useOrderMode.ts +65 -0
  76. package/app/composables/useRegistrationForm.ts +161 -0
  77. package/app/composables/useRestaurantSchema.ts +1 -1
  78. package/app/composables/useShareLink.ts +3 -13
  79. package/app/composables/useSortingSelection.ts +13 -0
  80. package/app/composables/useThemePreset.ts +15 -0
  81. package/app/composables/useVoucherCode.ts +7 -16
  82. package/app/composables/useWishlistActions.ts +0 -51
  83. package/app/error.vue +31 -9
  84. package/app/layouts/account.vue +45 -50
  85. package/app/layouts/default.vue +2 -3
  86. package/app/layouts/listing.vue +3 -5
  87. package/app/pages/[...all].vue +8 -4
  88. package/app/pages/account/recover/password/index.vue +113 -80
  89. package/app/pages/anmelden.vue +11 -10
  90. package/app/pages/bestellung/[id]/erfolg.vue +1 -15
  91. package/app/pages/bestellung/[id]/fehler.vue +63 -51
  92. package/app/pages/bestellung/[id]/index.vue +3 -85
  93. package/app/pages/bestellung/kasse.vue +29 -0
  94. package/app/pages/bestellung.vue +8 -60
  95. package/app/pages/index.vue +12 -52
  96. package/app/pages/kontakt.vue +27 -7
  97. package/app/pages/konto/adressen.vue +106 -102
  98. package/app/pages/konto/bestellung/[id].vue +9 -43
  99. package/app/pages/konto/bestellungen.vue +55 -33
  100. package/app/pages/konto/index.vue +47 -62
  101. package/app/pages/konto/profil.vue +162 -100
  102. package/app/pages/maintenance.vue +8 -6
  103. package/app/pages/merkliste.vue +7 -8
  104. package/app/pages/passwort-vergessen.vue +92 -75
  105. package/app/pages/registrierung/bestaetigen.vue +20 -48
  106. package/app/pages/registrierung/index.vue +16 -7
  107. package/app/pages/suche.vue +94 -95
  108. package/app/plugins/theme-preset.ts +9 -0
  109. package/app/utils/highlight.ts +25 -0
  110. package/app/utils/product.ts +9 -0
  111. package/app/validation/registrationSchema.ts +1 -1
  112. package/modules/theme.ts +115 -0
  113. package/nuxt.config.ts +27 -15
  114. package/package.json +6 -8
  115. package/playwright.config.ts +11 -0
  116. package/server/api/listing/[categoryId].get.ts +3 -0
  117. package/shared/theme/presets.ts +303 -0
  118. package/test/a11y/presets.test.ts +225 -0
  119. package/test/nuxt/AccountPagesPreset.test.ts +191 -0
  120. package/test/nuxt/AuthPagesPreset.test.ts +87 -0
  121. package/test/nuxt/CartCheckoutPreset.test.ts +154 -0
  122. package/test/nuxt/CartItem.test.ts +18 -3
  123. package/test/nuxt/CartUpsell.test.ts +1 -2
  124. package/test/nuxt/CheckoutFormsPreset.test.ts +120 -0
  125. package/test/nuxt/CheckoutOnePage.test.ts +115 -0
  126. package/test/nuxt/CheckoutSummary.test.ts +6 -6
  127. package/test/nuxt/CheckoutVoucherInput.test.ts +20 -32
  128. package/test/nuxt/ContactFormPreset.test.ts +115 -0
  129. package/test/nuxt/FooterStoreStatus.test.ts +2 -2
  130. package/test/nuxt/HeaderFooterPreset.test.ts +134 -0
  131. package/test/nuxt/HomeFaq.test.ts +3 -2
  132. package/test/nuxt/MenuBonCard.test.ts +122 -0
  133. package/test/nuxt/OrderPagesPreset.test.ts +132 -0
  134. package/test/nuxt/PaymentAndDelivery.test.ts +0 -4
  135. package/test/nuxt/ProductCrossSelling.test.ts +2 -1
  136. package/test/nuxt/ProductDeselectIngredient.test.ts +5 -3
  137. package/test/nuxt/ProductSheetPreset.test.ts +105 -0
  138. package/test/nuxt/RegisterConfirmPage.test.ts +0 -8
  139. package/test/nuxt/RegistrationForm.test.ts +89 -270
  140. package/test/nuxt/SbBaseComponents.test.ts +170 -0
  141. package/test/nuxt/SbStars.test.ts +25 -0
  142. package/test/nuxt/useCartMutations.test.ts +3 -17
  143. package/test/nuxt/useCartUpsell.test.ts +1 -1
  144. package/test/nuxt/useCheckoutMethodGuard.test.ts +0 -27
  145. package/test/nuxt/useShareLink.test.ts +1 -9
  146. package/test/nuxt/useWishlistActions.test.ts +3 -26
  147. package/test/unit/highlight.spec.ts +31 -0
  148. package/test/unit/product.spec.ts +12 -0
  149. package/test/unit/themePresets.spec.ts +61 -0
  150. package/app/app.config.ts +0 -19
  151. package/app/components/AnimatedSection.vue +0 -74
  152. package/app/components/BottomNavi.vue +0 -70
  153. package/app/components/Category/Header.vue +0 -48
  154. package/app/components/Checkout/PaymentMethod.vue +0 -30
  155. package/app/components/Checkout/ShippingMethod.vue +0 -30
  156. package/app/components/Cta.vue +0 -30
  157. package/app/components/Feature/Card.vue +0 -121
  158. package/app/components/Features.vue +0 -42
  159. package/app/components/Footer/Contact.vue +0 -82
  160. package/app/components/Header/Body.vue +0 -82
  161. package/app/components/Header/Right.vue +0 -187
  162. package/app/components/Header/Title.vue +0 -10
  163. package/app/components/Hero.vue +0 -233
  164. package/app/components/Home/MenuCategories.vue +0 -148
  165. package/app/components/ImageGallery.vue +0 -63
  166. package/app/components/Loading.vue +0 -29
  167. package/app/components/Navigation/DesktopLeft.vue +0 -39
  168. package/app/components/Product/Card.vue +0 -177
  169. package/app/components/Product/CardCompact.vue +0 -72
  170. package/app/components/Product/CardDietBadges.vue +0 -43
  171. package/app/components/Product/CardIngredients.vue +0 -35
  172. package/app/components/Product/CardKitchen.vue +0 -34
  173. package/app/components/Product/SearchBar.vue +0 -95
  174. package/app/components/PublicAnnouncement.vue +0 -17
  175. package/app/pages/bestellung/bestaetigen.vue +0 -16
  176. package/app/pages/bestellung/warenkorb.vue +0 -49
  177. package/app/pages/bestellung/zahlung-versand.vue +0 -25
  178. package/test/nuxt/AddressFields.test.ts +0 -222
  179. package/test/nuxt/AnimatedSection.test.ts +0 -67
  180. package/test/nuxt/ContactForm.test.ts +0 -207
  181. package/test/nuxt/FooterContact.test.ts +0 -102
  182. package/test/nuxt/HeaderRight.test.ts +0 -142
  183. package/test/nuxt/Hero.test.ts +0 -126
  184. package/test/nuxt/HomeMenuCategories.test.ts +0 -94
  185. package/test/nuxt/LoginForm.test.ts +0 -159
@@ -1,11 +1,14 @@
1
1
  <script setup lang="ts">
2
2
  import type { Schemas } from "#shopware";
3
3
  import Breadcrumb from "~/components/Category/Breadcrumb.vue";
4
- import ProductCard from "~/components/Product/Card.vue";
4
+ import MenuBonCard from "~/components/Menu/BonCard.vue";
5
5
 
6
6
  // A menu category lists up to 100 products; hydrating every card up front
7
7
  // costs ~1 s of main-thread time on phones (#314).
8
- const ProductCardWhenVisible = hydrateWhenVisible(ProductCard);
8
+ const MenuBonCardWhenVisible = hydrateWhenVisible(MenuBonCard);
9
+
10
+ // Menu of #441: word-list index, section title, bon cards with quick add.
11
+ const { menuView } = useThemePreset();
9
12
 
10
13
  const props = defineProps<{
11
14
  id: string;
@@ -46,6 +49,9 @@ const quickView = useProductQuickView(elements);
46
49
  // Derived from the listing data instead of snapshotted at setup time, which
47
50
  // would be a hydration mismatch (#239); see useSortingSelection.
48
51
  const { currentSorting } = useSortingSelection(currentSortingOrder);
52
+ const presetSortingOptions = computed(() =>
53
+ toSortingOptions(sortingOrders.value),
54
+ );
49
55
 
50
56
  const propertyFilters = computed<Schemas["PropertyGroup"][]>(
51
57
  () =>
@@ -113,8 +119,8 @@ const moreThanOneFilterAndOption = computed<boolean>(
113
119
  () => propertyFilters.value.length > 0,
114
120
  );
115
121
 
116
- // The mobile filter drawer (vaul) is created on first use; mounting it with
117
- // the page forced a layout of the whole listing (#314).
122
+ // The filter sheet is created on first use; mounting it with the page
123
+ // forced a layout of the whole listing (#314).
118
124
  const filterDrawerMounted = ref(false);
119
125
  const filterDrawerOpen = ref(false);
120
126
 
@@ -128,142 +134,106 @@ async function openFilterDrawer() {
128
134
  </script>
129
135
 
130
136
  <template>
131
- <UContainer>
132
- <UPage>
133
- <template #left>
134
- <UPageAside>
135
- <NavigationDesktopLeft />
136
- </UPageAside>
137
- </template>
138
-
139
- <UPageBody>
140
- <div>
141
- <Breadcrumb :category-id="category?.id" />
142
- <CategoryHeader v-if="category" :category="category" />
143
- <CategorySearchInput class="mb-4 grow flex" />
144
- <div class="flex flex-row justify-between gap-4 mb-4">
145
- <UBadge variant="subtle" :label="`${elements.length} Produkte`" />
146
- <USelect
147
- v-model="currentSorting"
148
- icon="i-lucide-arrow-down-wide-narrow"
149
- value-key="key"
150
- :items="sortingOrders"
151
- placeholder="Sortierung"
152
- />
153
- <template v-if="moreThanOneFilterAndOption">
154
- <UButton
155
- class="lg:hidden"
156
- icon="i-lucide-sliders-horizontal"
157
- :color="selectedPropertyFilters.length ? 'primary' : 'neutral'"
158
- :variant="selectedPropertyFilters.length ? 'solid' : 'subtle'"
159
- aria-haspopup="dialog"
160
- @click="openFilterDrawer"
161
- >
162
- Filter
163
- <UBadge
164
- v-if="selectedPropertyFilters.length"
165
- :label="String(selectedPropertyFilters.length)"
166
- size="sm"
167
- color="neutral"
168
- variant="solid"
169
- class="ml-1"
170
- />
171
- </UButton>
172
- <LazyUDrawer
173
- v-if="filterDrawerMounted"
174
- v-model:open="filterDrawerOpen"
175
- title="Filter"
176
- direction="right"
177
- >
178
- <template #body>
179
- <div class="flex flex-col gap-4">
180
- <CategoryFilterGroup
181
- v-for="filter in propertyFilters"
182
- :key="filter.id"
183
- v-model="selectedPropertyFilters"
184
- :filter="filter"
185
- />
186
- <UButton
187
- label="Zurücksetzen"
188
- variant="outline"
189
- block
190
- @click="resetFilters"
191
- />
192
- </div>
193
- </template>
194
- </LazyUDrawer>
195
- </template>
196
- </div>
197
-
198
- <div
199
- v-if="showSkeleton"
200
- class="grid grid-cols-1 gap-4"
201
- aria-busy="true"
202
- aria-label="Produkte werden geladen"
137
+ <div
138
+ class="mx-auto grid w-full max-w-(--sb-container) gap-x-12 px-4 pt-4 pb-16 font-body text-sb-ink sm:px-6 lg:grid-cols-[200px_minmax(0,1fr)_340px] lg:px-8 lg:pt-8"
139
+ >
140
+ <aside
141
+ class="hidden lg:sticky lg:top-24 lg:block lg:max-h-[calc(100vh-7rem)] lg:self-start lg:overflow-y-auto"
142
+ >
143
+ <MenuCategoryIndex />
144
+ </aside>
145
+
146
+ <div class="min-w-0">
147
+ <Breadcrumb :category-id="category?.id" />
148
+ <MenuSectionHeader
149
+ v-if="category"
150
+ :category="category"
151
+ :count="elements.length"
152
+ />
153
+ <MenuOrderMode class="mb-4 lg:hidden" />
154
+ <CategorySearchInput class="mb-4" />
155
+ <div class="mb-4 flex flex-wrap items-center justify-between gap-3">
156
+ <SbSelect
157
+ v-model="currentSorting"
158
+ label="Sortierung"
159
+ placeholder="Bitte wählen"
160
+ :options="presetSortingOptions"
161
+ class="max-w-72"
162
+ />
163
+ <template v-if="moreThanOneFilterAndOption">
164
+ <!-- The right column holds the cart, so the filters live in a
165
+ sheet on every screen size. -->
166
+ <SbButton
167
+ :variant="selectedPropertyFilters.length ? 'primary' : 'secondary'"
168
+ aria-haspopup="dialog"
169
+ @click="openFilterDrawer"
203
170
  >
204
- <LazyProductCardSkeleton v-for="i in 6" :key="i" />
205
- </div>
206
-
207
- <div
208
- v-else
209
- class="grid grid-cols-1 gap-4 transition-opacity duration-200"
210
- :class="{ 'opacity-40 pointer-events-none': loading }"
171
+ Filter
172
+ <span v-if="selectedPropertyFilters.length" class="tabular-nums"
173
+ >({{ selectedPropertyFilters.length }}
174
+ <span class="sr-only">aktiv</span>)</span
175
+ >
176
+ </SbButton>
177
+ <SbSheet
178
+ v-if="filterDrawerMounted"
179
+ v-model:open="filterDrawerOpen"
180
+ title="Filter"
211
181
  >
212
- <ProductCardWhenVisible
213
- v-for="product in elements"
214
- :key="product.id"
215
- :product="product"
216
- :with-favorite-button="true"
217
- :selectable="true"
218
- :href="productDeepLink(product, category?.seoUrl)"
219
- @select="quickView.show"
220
- />
221
- </div>
222
- <LazyProductQuickView
223
- v-if="quickView.mounted.value"
224
- v-model:open="quickView.open.value"
225
- :product="quickView.product.value"
226
- />
227
- </div>
228
- </UPageBody>
229
-
230
- <template #right>
231
- <UPageAside>
232
- <ClientOnly v-if="moreThanOneFilterAndOption">
233
182
  <div class="flex flex-col gap-4">
234
- <h2 class="text-3xl md:text-4xl mb-3 pb-2">Filter</h2>
235
183
  <CategoryFilterGroup
236
184
  v-for="filter in propertyFilters"
237
185
  :key="filter.id"
238
186
  v-model="selectedPropertyFilters"
239
187
  :filter="filter"
240
188
  />
241
- <UButton
242
- label="Zurücksetzen"
243
- variant="outline"
244
- block
245
- @click="resetFilters"
246
- />
247
189
  </div>
248
- <template #fallback>
249
- <div class="flex flex-col gap-4">
250
- <USkeleton class="h-9 w-20" />
251
- <div class="flex flex-col gap-2">
252
- <USkeleton class="h-8 w-48" />
253
- <USkeleton class="h-4 w-36" />
254
- <USkeleton class="h-4 w-32" />
255
- <USkeleton class="h-4 w-40" />
256
- </div>
257
- <div class="flex flex-col gap-2">
258
- <USkeleton class="h-8 w-48" />
259
- <USkeleton class="h-4 w-36" />
260
- <USkeleton class="h-4 w-32" />
261
- </div>
190
+ <template #footer>
191
+ <div class="flex gap-3">
192
+ <SbButton variant="secondary" block @click="resetFilters"
193
+ >Zurücksetzen</SbButton
194
+ >
195
+ <SbButton block @click="filterDrawerOpen = false"
196
+ >{{ elements.length }} Gerichte zeigen</SbButton
197
+ >
262
198
  </div>
263
199
  </template>
264
- </ClientOnly>
265
- </UPageAside>
266
- </template>
267
- </UPage>
268
- </UContainer>
200
+ </SbSheet>
201
+ </template>
202
+ </div>
203
+
204
+ <div
205
+ v-if="showSkeleton"
206
+ class="grid grid-cols-1 gap-3"
207
+ aria-busy="true"
208
+ aria-label="Gerichte werden geladen"
209
+ >
210
+ <LazyProductCardSkeleton v-for="i in 6" :key="i" />
211
+ </div>
212
+ <div
213
+ v-else
214
+ class="grid grid-cols-1 gap-3 transition-opacity duration-200"
215
+ :class="{ 'pointer-events-none opacity-40': loading }"
216
+ >
217
+ <MenuBonCardWhenVisible
218
+ v-for="product in elements"
219
+ :key="product.id"
220
+ :product="product"
221
+ :photo="menuView === 'bonPhoto'"
222
+ :href="productDeepLink(product, category?.seoUrl)"
223
+ @select="quickView.show"
224
+ />
225
+ </div>
226
+ <LazyProductQuickView
227
+ v-if="quickView.mounted.value"
228
+ v-model:open="quickView.open.value"
229
+ :product="quickView.product.value"
230
+ />
231
+ </div>
232
+
233
+ <aside
234
+ class="hidden lg:sticky lg:top-24 lg:block lg:max-h-[calc(100vh-7rem)] lg:self-start lg:overflow-y-auto"
235
+ >
236
+ <MenuCartPanel />
237
+ </aside>
238
+ </div>
269
239
  </template>
@@ -1,7 +1,9 @@
1
1
  <script setup lang="ts">
2
+ /** Search from the menu page; results open on /suche. */
2
3
  const router = useRouter();
3
4
 
4
5
  const query = ref("");
6
+ const id = useId();
5
7
 
6
8
  function submit() {
7
9
  const term = query.value.trim();
@@ -11,23 +13,24 @@ function submit() {
11
13
  </script>
12
14
 
13
15
  <template>
14
- <UInput
15
- v-model="query"
16
- name="search"
17
- size="md"
18
- icon="i-lucide-search"
19
- placeholder="Produkte suchen..."
20
- @keyup.enter="submit"
21
- >
22
- <template v-if="query" #trailing>
23
- <UButton
24
- color="neutral"
25
- variant="link"
26
- size="sm"
27
- icon="i-lucide-circle-x"
28
- aria-label="Suche leeren"
29
- @click="query = ''"
30
- />
31
- </template>
32
- </UInput>
16
+ <form role="search" class="flex gap-2 font-body" @submit.prevent="submit">
17
+ <label :for="id" class="sr-only">Speisekarte durchsuchen</label>
18
+ <SbInput
19
+ :id="id"
20
+ v-model="query"
21
+ name="search"
22
+ type="search"
23
+ enterkeyhint="search"
24
+ placeholder="Gericht oder Zutat suchen"
25
+ class="flex-1"
26
+ />
27
+ <SbIconButton
28
+ label="Suchen"
29
+ type="submit"
30
+ variant="tint"
31
+ class="size-[50px]"
32
+ >
33
+ <SbIcon name="search" />
34
+ </SbIconButton>
35
+ </form>
33
36
  </template>
@@ -61,10 +61,6 @@ const isValid = computed<boolean>(() => {
61
61
  return validate(selected.value) === null;
62
62
  });
63
63
 
64
- const deliveryTimeInfo = computed(() => {
65
- return "Geschätzte Lieferzeit beträgt " + deliveryTime.value + " min.";
66
- });
67
-
68
64
  watch(
69
65
  isValid,
70
66
  (v) => {
@@ -136,83 +132,65 @@ function handleTimeInput(event: Event): void {
136
132
  selected.value = value;
137
133
  emit("update:modelValue", value || null);
138
134
  }
135
+
136
+ // Presets: the base components and plain text instead of badges (#443).
139
137
  </script>
140
138
 
141
139
  <template>
142
- <div v-if="hasOpeningHoursFailed" class="mt-4">
143
- <UAlert
144
- color="error"
145
- variant="subtle"
146
- icon="i-lucide-circle-alert"
147
- title="Öffnungszeiten konnten nicht geladen werden"
148
- description="Ohne Öffnungszeiten können wir keine Lieferzeit anbieten."
149
- :actions="[
150
- {
151
- label: 'Erneut versuchen',
152
- icon: 'i-lucide-refresh-cw',
153
- color: 'error',
154
- variant: 'outline',
155
- onClick: retryOpeningHours,
156
- },
157
- ]"
158
- />
159
- </div>
160
- <div
161
- v-else-if="isOpeningHoursLoaded && isClosedHoliday(now) === false"
162
- class="flex flex-col gap-2 mt-4"
163
- >
164
- <div class="flex flex-row items-center justify-between gap-4">
165
- <label for="delivery-time" class="flex-1">
166
- Wunschlieferung- oder Abholzeit ab:
167
- </label>
168
- <client-only>
169
- <UInput
170
- id="delivery-time"
171
- type="time"
172
- :min="minTime ?? undefined"
173
- :max="maxTime ?? undefined"
174
- :disabled="isClosedToday || isClosedHoliday(now) === true"
175
- :model-value="selected"
176
- step="300"
177
- @input="handleTimeInput"
178
- />
179
- </client-only>
140
+ <div class="flex flex-col gap-3 font-body text-sb-ink">
141
+ <div
142
+ v-if="hasOpeningHoursFailed"
143
+ role="alert"
144
+ class="flex flex-col items-start gap-3 rounded-sb-control border-[1.5px] border-sb-danger p-4 text-sm"
145
+ >
146
+ <span>
147
+ <strong class="block"
148
+ >Öffnungszeiten konnten nicht geladen werden</strong
149
+ >
150
+ Ohne Öffnungszeiten können wir keine Lieferzeit anbieten.
151
+ </span>
152
+ <SbButton variant="secondary" @click="retryOpeningHours"
153
+ >Erneut versuchen</SbButton
154
+ >
180
155
  </div>
181
- <p v-if="validationError" class="text-sm text-error">
182
- {{ validationError }}
156
+ <p
157
+ v-else-if="isOpeningHoursLoaded && isClosedHoliday(now) === true"
158
+ role="status"
159
+ class="rounded-sb-control bg-sb-muted p-4 font-semibold"
160
+ >
161
+ Wir haben Betriebsferien und nehmen gerade keine Bestellungen an.
162
+ </p>
163
+ <template v-else-if="isOpeningHoursLoaded">
164
+ <SbField
165
+ id="delivery-time"
166
+ v-slot="{ id, describedBy, invalid }"
167
+ label="Wunschzeit für Lieferung oder Abholung, frühestens"
168
+ :hint="validationError ? undefined : helperText"
169
+ :error="validationError ?? undefined"
170
+ >
171
+ <ClientOnly>
172
+ <input
173
+ :id="id"
174
+ type="time"
175
+ :min="minTime ?? undefined"
176
+ :max="maxTime ?? undefined"
177
+ step="300"
178
+ :value="selected"
179
+ :disabled="isClosedToday"
180
+ :aria-describedby="describedBy"
181
+ :aria-invalid="invalid || undefined"
182
+ class="min-h-[50px] w-full max-w-48 rounded-sb-control border-[1.5px] border-sb-control bg-sb-surface px-3.5 font-body text-lg font-semibold text-sb-ink tabular-nums focus-visible:outline-3 focus-visible:outline-offset-1 focus-visible:outline-sb-focus disabled:opacity-60 aria-invalid:border-sb-danger"
183
+ @input="handleTimeInput"
184
+ />
185
+ </ClientOnly>
186
+ </SbField>
187
+ <p class="text-sm text-sb-ink-muted">
188
+ Lieferzeit ca. {{ deliveryTime }} Minuten, zu Stoßzeiten kann es etwas
189
+ länger dauern.
190
+ </p>
191
+ </template>
192
+ <p v-else class="text-sm text-sb-ink-muted" aria-busy="true">
193
+ Öffnungszeiten werden geladen …
183
194
  </p>
184
- <p v-else class="text-sm text-muted">{{ helperText }}</p>
185
- <UBadge
186
- :label="deliveryTimeInfo"
187
- icon="i-lucide-clock"
188
- size="xl"
189
- color="neutral"
190
- variant="subtle"
191
- />
192
- <UBadge
193
- label="Lieferzeiten können zu Stoßzeiten variieren."
194
- icon="i-lucide-info"
195
- size="xl"
196
- color="warning"
197
- variant="subtle"
198
- />
199
- </div>
200
- <div v-else-if="isOpeningHoursLoaded && isClosedHoliday(now) === true">
201
- <UBadge
202
- variant="subtle"
203
- class="w-full"
204
- icon="i-lucide-info"
205
- color="error"
206
- label="Geschlossen wegen Betriebsferien"
207
- />
208
- </div>
209
- <div v-else>
210
- <UBadge
211
- variant="subtle"
212
- class="w-full"
213
- icon="i-lucide-loader"
214
- color="neutral"
215
- label="Lade Öffnungszeiten..."
216
- />
217
195
  </div>
218
196
  </template>
@@ -1,41 +1,40 @@
1
1
  <script setup lang="ts">
2
- import type { TabsItem } from "@nuxt/ui";
2
+ import { TabsContent, TabsList, TabsRoot, TabsTrigger } from "reka-ui";
3
3
 
4
- const items = [
5
- {
6
- label: "Daten erfassen",
7
- slot: "register" as const,
8
- },
9
- {
10
- label: "Einloggen",
11
- slot: "login" as const,
12
- },
13
- ] satisfies TabsItem[];
14
-
15
- const toast = useToast();
4
+ // Reka tabs with the base forms (#443).
5
+ const presetTab = ref<"neu" | "kunde">("neu");
16
6
 
17
7
  const { mergeWishlistProducts } = useWishlist();
18
8
 
19
9
  async function handleLoginSuccess() {
20
10
  mergeWishlistProducts();
21
- toast.add({
22
- title: "Wilkommen!",
23
- color: "success",
24
- progress: false,
25
- });
26
11
  }
27
12
  </script>
28
13
 
29
14
  <template>
30
- <div>
31
- <UTabs :items="items" :ui="{ trigger: 'grow' }" class="gap-4 w-full">
32
- <template #register>
33
- <UserRegistrationForm @registration-success="handleLoginSuccess" />
34
- </template>
35
-
36
- <template #login>
37
- <UserLoginForm />
38
- </template>
39
- </UTabs>
40
- </div>
15
+ <TabsRoot v-model="presetTab" class="flex flex-col gap-5">
16
+ <TabsList
17
+ aria-label="Kundendaten"
18
+ class="grid grid-cols-2 gap-1 rounded-sb-control bg-sb-muted p-1 font-body"
19
+ >
20
+ <TabsTrigger
21
+ value="neu"
22
+ class="min-h-11 rounded-[calc(var(--sb-radius-control)-3px)] px-3 text-sm font-semibold text-sb-ink-muted focus-visible:outline-3 focus-visible:outline-offset-1 focus-visible:outline-sb-focus data-[state=active]:bg-sb-ink data-[state=active]:font-bold data-[state=active]:text-sb-surface"
23
+ >
24
+ Neu hier oder als Gast
25
+ </TabsTrigger>
26
+ <TabsTrigger
27
+ value="kunde"
28
+ class="min-h-11 rounded-[calc(var(--sb-radius-control)-3px)] px-3 text-sm font-semibold text-sb-ink-muted focus-visible:outline-3 focus-visible:outline-offset-1 focus-visible:outline-sb-focus data-[state=active]:bg-sb-ink data-[state=active]:font-bold data-[state=active]:text-sb-surface"
29
+ >
30
+ Schon Kunde
31
+ </TabsTrigger>
32
+ </TabsList>
33
+ <TabsContent value="neu" class="focus-visible:outline-none">
34
+ <UserRegistrationForm @registration-success="handleLoginSuccess" />
35
+ </TabsContent>
36
+ <TabsContent value="kunde" class="focus-visible:outline-none">
37
+ <UserLoginForm @login-success="handleLoginSuccess" />
38
+ </TabsContent>
39
+ </TabsRoot>
41
40
  </template>