@bytebrand/fe-ui-core-autobahn 1.0.226 → 1.0.228

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 (58) hide show
  1. package/campaign/CampaignBand.tsx +26 -0
  2. package/campaign/campaignVars.ts +12 -0
  3. package/campaign/campaigns.ts +74 -0
  4. package/campaign/index.ts +6 -0
  5. package/cards/CarCard.tsx +393 -366
  6. package/cards/CarRow.tsx +8 -28
  7. package/cards/cardParts.tsx +23 -48
  8. package/cards/dealSignals.ts +36 -0
  9. package/cards/index.ts +0 -6
  10. package/chrome/Footer.tsx +3 -16
  11. package/chrome/TopBar.tsx +266 -139
  12. package/compat/CookieModal/CookieModal.tsx +6 -20
  13. package/compat/CookieModal/Modal.tsx +3 -6
  14. package/compat/CookieModal/modals/ManageCookieModal/ManageCookieModal.tsx +15 -43
  15. package/compat/CookieModal/modals/PreviewCookieModal/PreviewCookieModal.tsx +3 -4
  16. package/compat/CookieModal/useModal.ts +1 -5
  17. package/compat/Loader/Loader.tsx +7 -1
  18. package/compat/MdField/MdField.tsx +4 -28
  19. package/compat/PriceRating/PriceRating.styl +7 -5
  20. package/compat/PriceRatingDetailed/PriceRatingDetailed.styl +6 -8
  21. package/compat/TimePicker/TimePicker.tsx +2 -12
  22. package/compat/legacy-theme/priceReviewColors.styl +5 -18
  23. package/constants/app.ts +11 -1
  24. package/constants/autobahn.ts +0 -39
  25. package/constants/core.ts +12 -1
  26. package/data/fieldMapping.ts +3 -3
  27. package/data/toAutobahnCar.ts +14 -30
  28. package/iconsvg/IconSVG.tsx +5 -1
  29. package/index.ts +19 -18
  30. package/locales/de/autobahn.json +862 -903
  31. package/locales/en/autobahn.json +862 -903
  32. package/package.json +2 -2
  33. package/theme/md3.css +11808 -15866
  34. package/ui/Dropdown.tsx +10 -29
  35. package/ui/FormCheckbox.tsx +2 -22
  36. package/ui/FormField.tsx +1 -2
  37. package/ui/Icon.tsx +0 -6
  38. package/ui/Modal.tsx +6 -84
  39. package/ui/Skeleton.tsx +20 -79
  40. package/ui/Stars.tsx +18 -36
  41. package/ui/StatChip.tsx +3 -8
  42. package/ui/index.ts +0 -3
  43. package/ui/usePortalMenuPosition.ts +15 -27
  44. package/utils/index.ts +0 -10
  45. package/vdp/FinanceCalculator.tsx +34 -162
  46. package/vdp/VdpModules.tsx +976 -348
  47. package/vdp/index.ts +3 -6
  48. package/vdp/types.ts +15 -25
  49. package/vehiclesProps/decoratedLightProps.tsx +0 -4
  50. package/vehiclesProps/decoratedProps.tsx +0 -4
  51. package/cards/CarCardSkeleton.tsx +0 -103
  52. package/cards/CarRowSkeleton.tsx +0 -152
  53. package/chrome/AccountMenuIcon.tsx +0 -109
  54. package/ui/MfieldCheckIcon.tsx +0 -13
  55. package/ui/ratingLink.ts +0 -36
  56. package/ui/scrollFieldIntoView.ts +0 -41
  57. package/utils/cookieConsent.ts +0 -84
  58. package/vehiclesProps/accidentDisclosure.ts +0 -25
package/chrome/TopBar.tsx CHANGED
@@ -3,7 +3,6 @@ import { TranslationFunction } from '../types';
3
3
 
4
4
  import { Button, Icon, IconButton } from '../ui';
5
5
  import logoUrl from '../assets/autode-logo.svg';
6
- import AccountMenuIcon, { AccountMenuIconName } from './AccountMenuIcon';
7
6
 
8
7
  /** Where the logo navigates on click. '/' is NOT an SPA route — traefik serves the WordPress
9
8
  * homepage there (generate-routes.py: wp-home at higher priority) — so the logo must be a FULL
@@ -40,10 +39,6 @@ const R_MY_ORDERS = '/account/my-orders';
40
39
  const R_DASHBOARD = '/account/dashboard';
41
40
  const R_IMAGE_SETTINGS = '/account/image-settings';
42
41
  const R_KONTAKT = '/account/kontakt';
43
- const R_COMPARE = '/compare';
44
-
45
- /** lib Icon strokes are in lucide's 24-unit viewBox: drawn at 22px this is the Konto menu's 1.8px. */
46
- const ACCT_ICON_STROKE = (1.8 * 24) / 22;
47
42
 
48
43
  /** Languages offered in the account menu (legacy supports de/en/ru). Labels are proper nouns
49
44
  * (endonyms) and stay untranslated. */
@@ -88,28 +83,18 @@ export interface TopBarProps {
88
83
  variant?: TopBarVariant;
89
84
  /** real auth state (authStore.isAuthorized) — guest vs profile menu. */
90
85
  isAuthorized?: boolean;
91
- /** name in the authed menu's head (the profile's first + last name, else authStore.userEmail). */
86
+ /** label for the authed menu header (authStore.userEmail / profile name). */
92
87
  userLabel?: string;
93
88
  /** Merkliste count (favoriteStore.favoritesIDs.length) — badge on the heart + menu row. */
94
89
  favoritesCount?: number;
95
90
  /** unread Suchaufträge count — badge on the bell. Defaults to 0 (no badge). */
96
91
  notificationCount?: number;
97
- /** placed-orders count (profileStore.totalOrdered) — the "Meine Bestellung" row shows only above 0. */
92
+ /** placed-orders count (profileStore.totalOrdered) — badge on the my-orders menu row. */
98
93
  ordersCount?: number;
99
- /** saved searches (filterStore.savedSearchStrings.length) — badge on the "Gespeicherte Suchen" row. */
100
- savedSearchesCount?: number;
101
- /** cars picked for comparison (compareStore.vehiclesIDsToCompare.length) — badge on "Fahrzeuge vergleichen". */
102
- compareCount?: number;
103
94
  /** active language tag (appStore.language) — ticks the current language row. */
104
95
  language?: string;
105
- /** any dealer account (authStore.isDealer: main, admin, employee, accountant) — Meine Fahrzeuge. */
106
- isDealer?: boolean;
107
- /** dealer-main account (authStore.isDealerMain) — Bildeinstellungen and the dealer switch. */
96
+ /** dealer-main account (authStore.isDealerMain) — shows the dealer menu section. */
108
97
  isDealerMain?: boolean;
109
- /** dealer admin (authStore.isDealerAdmin) — Bildeinstellungen, like isDealerMain. */
110
- isDealerAdmin?: boolean;
111
- /** dealer employee (authStore.isEmployee) — the "Meine Händler" switch, like isDealerMain. */
112
- isEmployee?: boolean;
113
98
  /** attached dealerships (profileStore.dealers: { dealer: {id, email}, isActive }[]). */
114
99
  dealers?: ReadonlyArray<{ dealer: { id: string; email: string }; isActive: boolean }>;
115
100
  /** switch the active dealership (App.setMainDealer → profileStore.switchDealer). */
@@ -153,13 +138,8 @@ const TopBar: React.FunctionComponent<TopBarProps> = ({
153
138
  favoritesCount = 0,
154
139
  notificationCount = 0,
155
140
  ordersCount = 0,
156
- savedSearchesCount = 0,
157
- compareCount = 0,
158
141
  language = 'de',
159
- isDealer = false,
160
142
  isDealerMain = false,
161
- isDealerAdmin = false,
162
- isEmployee = false,
163
143
  dealers = [],
164
144
  onDealerSelect,
165
145
  onSignOut,
@@ -170,14 +150,8 @@ const TopBar: React.FunctionComponent<TopBarProps> = ({
170
150
  }) => {
171
151
  const [menu, setMenu] = useState(false); // mobile hamburger dropdown
172
152
  const [account, setAccount] = useState(false); // account popover
173
- const [dealersOpen, setDealersOpen] = useState(false); // Konto menu: "Meine Händler" expanded
174
153
  const [hidden, setHidden] = useState(false); // autoHideOnScroll: header slid out of view
175
154
 
176
- // the dealer list opens collapsed every time the Konto menu opens
177
- useEffect(() => {
178
- if (!account) setDealersOpen(false);
179
- }, [account]);
180
-
181
155
  // scroll-direction tracking for autoHideOnScroll — down hides, up shows, and it never hides
182
156
  // near the very top (HIDE_AT) so the header doesn't disappear on the first tiny scroll nudge.
183
157
  const lastScrollY = useRef(0);
@@ -232,129 +206,280 @@ const TopBar: React.FunctionComponent<TopBarProps> = ({
232
206
  </nav>
233
207
  );
234
208
 
235
- /** one Konto-menu row (Figma "acct-row"): 22px icon, label, count badge when above 0. `icon` is a
236
- * menu glyph; `lucide` is a lib Icon for the guest rows Figma doesn't draw. `checked` (dealer rows)
237
- * marks the active choice with the same check as the language rows; `nested` rows sit under an
238
- * expanded row, their label in line with its label. */
239
- const acctRow = (
240
- key: string,
241
- label: string,
242
- onClick: () => void,
243
- opts: { icon?: AccountMenuIconName; lucide?: string; badge?: number; checked?: boolean; nested?: boolean } = {},
244
- ): JSX.Element => (
245
- <button key={key} type="button" className={opts.nested ? 'acct-row acct-row--nested' : 'acct-row'} onClick={onClick} aria-pressed={opts.checked}>
246
- {opts.icon && <AccountMenuIcon name={opts.icon} />}
247
- {opts.lucide && <Icon name={opts.lucide} size={22} stroke={ACCT_ICON_STROKE} cls="acct-icon" />}
248
- <span className="acct-label">{label}</span>
249
- {!!opts.badge && opts.badge > 0 && <span className="acct-badge">{opts.badge}</span>}
250
- {opts.checked && (
251
- <span className="acct-check"><Icon name="check" size={13} color="#fff" stroke={3} /></span>
209
+ /** one account-menu row. `key` is a stable identifier; `label` is the (translated) display text. */
210
+ const row = (key: string, label: string, onClick: () => void, opts?: { icon?: string; primary?: boolean; badge?: number }): JSX.Element => (
211
+ <button
212
+ key={key}
213
+ type="button"
214
+ className="amenu-row"
215
+ onClick={onClick}
216
+ style={{
217
+ display: 'flex',
218
+ alignItems: 'center',
219
+ gap: 10,
220
+ width: '100%',
221
+ padding: '10px 14px',
222
+ border: 0,
223
+ background: opts && opts.primary ? 'var(--md-primary)' : 'transparent',
224
+ color: opts && opts.primary ? '#fff' : 'var(--md-on-surface)',
225
+ borderRadius: opts && opts.primary ? 'var(--md-r-full)' : 0,
226
+ margin: opts && opts.primary ? '0 0 6px' : 0,
227
+ cursor: 'pointer',
228
+ font: 'inherit',
229
+ fontWeight: opts && opts.primary ? 700 : 500,
230
+ justifyContent: opts && opts.primary ? 'center' : 'flex-start',
231
+ textAlign: 'left',
232
+ }}
233
+ >
234
+ {opts && opts.icon && <Icon name={opts.icon} size={17} style={{ flex: 'none' }} />}
235
+ <span style={{ flex: 1 }}>{label}</span>
236
+ {opts && typeof opts.badge === 'number' && (
237
+ <span className="md-label-sm" style={{ fontWeight: 700 }}>{opts.badge}</span>
252
238
  )}
253
239
  </button>
254
240
  );
255
241
 
256
- /** language rows — not in the Figma menu, kept for phones: the header's DE/EN switch is hidden
257
- * ≤600px, so this group (show-mobile) is the only language switch there. */
258
- const renderLanguageRows = (): JSX.Element => (
259
- <div className="acct-list show-mobile">
260
- {LANGS.map(([code, label]) => (
261
- <button
262
- key={`lang-${code}`}
263
- type="button"
264
- className="acct-row"
265
- aria-pressed={language === code}
266
- onClick={() => { setAccount(false); if (onLangSelect) onLangSelect(code); }}
267
- >
268
- <span className="acct-flag"><Flag code={code} /></span>
269
- <span className="acct-label">{label}</span>
270
- {language === code && (
271
- <span className="acct-check"><Icon name="check" size={13} color="#fff" stroke={3} /></span>
272
- )}
273
- </button>
274
- ))}
275
- </div>
242
+ const divider = (key: string): JSX.Element => (
243
+ <div key={key} style={{ height: 1, background: 'var(--md-outline-variant)', margin: '6px 0' }} />
276
244
  );
277
245
 
278
- /** Konto menu (Figma "Kontomenü (geöffnet)", 64243:14205 desktop / 64243:14299 mobile — the same
279
- * 312px dropdown at every width): the name, then groups split by lines — Figma's rows for every
280
- * user, Profil, then the role rows (Meine Fahrzeuge for every dealer account, the dealer switch
281
- * for employees, Bildeinstellungen for dealers/admins). Rows Figma doesn't draw use the same style. */
282
- const isDealerOrAdmin = isDealerMain || isDealerAdmin;
283
- const showDealers = (isDealerMain || isEmployee) && dealers.length > 1;
284
- const renderAccountMenu = (): JSX.Element => (
285
- <div className="acct-menu">
286
- <div className="acct-scroll">
246
+ /** First letter of the email's local-part, e.g. "adminvika@…" → "A" — a placeholder single-letter
247
+ * avatar. ProfileStore already carries a real firstName/lastName (privateAddress) that isn't
248
+ * threaded down to TopBar yet; wire that through for a proper two-letter "AV"-style initial. */
249
+ const avatarInitial = (userLabel || '?').trim().charAt(0).toUpperCase() || '?';
250
+
251
+ /** one Account Layer row (mobile design): icon + label + optional badge + trailing chevron —
252
+ * distinct from the desktop popover's `row()` (no chevron, no avatar section there). */
253
+ const mrow = (key: string, label: string, onClick: () => void, opts?: { icon?: string; badge?: number }): JSX.Element => (
254
+ <button
255
+ key={key}
256
+ type="button"
257
+ className="amenu-mobile-row"
258
+ onClick={onClick}
259
+ style={{
260
+ display: 'flex',
261
+ alignItems: 'center',
262
+ gap: 12,
263
+ width: '100%',
264
+ padding: '13px 4px',
265
+ border: 0,
266
+ background: 'transparent',
267
+ color: 'var(--md-on-surface)',
268
+ cursor: 'pointer',
269
+ font: 'inherit',
270
+ fontWeight: 500,
271
+ textAlign: 'left',
272
+ }}
273
+ >
274
+ {opts && opts.icon && <Icon name={opts.icon} size={19} style={{ flex: 'none', color: 'var(--md-on-surface-variant)' }} />}
275
+ <span style={{ flex: 1, fontSize: 15 }}>{label}</span>
276
+ {opts && typeof opts.badge === 'number' && opts.badge > 0 && (
277
+ <span className="md-label-sm" style={{ fontWeight: 700 }}>{opts.badge}</span>
278
+ )}
279
+ <Icon name="chevron-right" size={18} style={{ flex: 'none', color: 'var(--md-on-surface-variant)' }} />
280
+ </button>
281
+ );
282
+
283
+ /** language row (mobile design): real flag + label, checkmark bubble on the active one — matches
284
+ * the Figma "Sprache" section exactly (the desktop popover's globe/check-icon version is left
285
+ * as-is, out of scope for this mobile-only pass). */
286
+ const mLangRow = (code: string, label: string): JSX.Element => {
287
+ const active = language === code;
288
+ return (
289
+ <button
290
+ key={`mlang-${code}`}
291
+ type="button"
292
+ onClick={() => { setAccount(false); if (onLangSelect) onLangSelect(code); }}
293
+ style={{
294
+ display: 'flex',
295
+ alignItems: 'center',
296
+ gap: 12,
297
+ width: '100%',
298
+ padding: '10px 4px',
299
+ border: 0,
300
+ background: 'transparent',
301
+ cursor: 'pointer',
302
+ font: 'inherit',
303
+ textAlign: 'left',
304
+ }}
305
+ >
306
+ <Flag code={code} />
307
+ <span style={{ flex: 1, fontSize: 15, color: 'var(--md-on-surface)' }}>{label}</span>
308
+ {active && (
309
+ <span
310
+ style={{
311
+ width: 20, height: 20, borderRadius: '50%', background: 'var(--md-primary)',
312
+ display: 'flex', alignItems: 'center', justifyContent: 'center', flex: 'none',
313
+ }}
314
+ >
315
+ <Icon name="check" size={13} color="#fff" stroke={3} />
316
+ </span>
317
+ )}
318
+ </button>
319
+ );
320
+ };
321
+
322
+ /** Mobile-only "Account Layer" — a full-width sheet under the header (Figma: "03 | Account
323
+ * Layer"), replacing the desktop popover's small 264px card on mobile widths. Shown/hidden
324
+ * purely via the `show-mobile`/`hide-mobile` CSS classes (this project's existing convention —
325
+ * see the hamburger button/topbar-menu above), not JS width checks. */
326
+ const renderMobileAccountLayer = (): JSX.Element => (
327
+ <div className="amenu-mobile show-mobile mcard" style={{ flexDirection: 'column' }}>
328
+ <div style={{ padding: '20px 20px 8px', textAlign: isAuthorized ? 'left' : 'center' }}>
287
329
  {isAuthorized ? (
288
- <>
289
- <div className="acct-head">
290
- <span className="acct-name">{userLabel || t('autobahn:chrome.myAccount')}</span>
291
- </div>
292
- <div className="acct-list">
293
- {acctRow('overview', t('autobahn:chrome.acct.overview'), () => goRoute(R_DASHBOARD), { icon: 'layout-grid' })}
294
- {ordersCount > 0 &&
295
- acctRow('myOrder', t('autobahn:chrome.acct.myOrder'), () => goRoute(R_MY_ORDERS), { icon: 'car-front' })}
296
- {acctRow('savedSearches', t('autobahn:chrome.acct.savedSearches'), () => goRoute(R_SAVED_SEARCHES), { icon: 'bookmark', badge: savedSearchesCount })}
297
- {acctRow('favorites', t('autobahn:chrome.acct.favorites'), () => goRoute(R_FAVOURITES), { icon: 'star', badge: favoritesCount })}
298
- {acctRow('compare', t('autobahn:chrome.acct.compare'), () => goRoute(R_COMPARE), { icon: 'scale', badge: compareCount })}
299
- </div>
300
- <div className="acct-list">
301
- {acctRow('profile', t('autobahn:chrome.acct.profile'), () => goRoute(R_SETTINGS), { icon: 'user' })}
302
- </div>
303
- {(isDealer || showDealers || isDealerOrAdmin) && (
304
- <div className="acct-list">
305
- {isDealer &&
306
- acctRow('myVehicles', t('autobahn:chrome.myVehicles'), () => goRoute(R_MY_VEHICLES), { lucide: 'car' })}
307
- {/* ADV-271 (comment of 01.11.2026): one "Meine Händler" row; a click expands the
308
- dealers to pick from (the active one checked) and collapses them again */}
309
- {showDealers && (
310
- <>
311
- <button
312
- type="button"
313
- className="acct-row"
314
- aria-expanded={dealersOpen}
315
- onClick={() => setDealersOpen((open) => !open)}
316
- >
317
- <AccountMenuIcon name="store" />
318
- <span className="acct-label">{t('autobahn:chrome.myDealers')} ({dealers.length})</span>
319
- <Icon name="chevron-down" size={20} cls={dealersOpen ? 'acct-chevron acct-chevron--open' : 'acct-chevron'} />
320
- </button>
321
- {dealersOpen &&
322
- dealers.map((d) =>
323
- acctRow(`dealer-${d.dealer.id}`, d.dealer.email, () => {
324
- setAccount(false);
325
- if (!d.isActive && onDealerSelect) onDealerSelect(d.dealer.id);
326
- }, { checked: d.isActive, nested: true }),
327
- )}
328
- </>
329
- )}
330
- {isDealerOrAdmin &&
331
- acctRow('imageSettings', t('autobahn:chrome.imageSettings'), () => goRoute(R_IMAGE_SETTINGS), { icon: 'settings' })}
330
+ <div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
331
+ <span
332
+ style={{
333
+ width: 44, height: 44, borderRadius: '50%', flex: 'none',
334
+ background: 'color-mix(in srgb, var(--md-primary) 15%, transparent)',
335
+ color: 'var(--md-primary)', display: 'flex', alignItems: 'center', justifyContent: 'center',
336
+ fontWeight: 700, fontSize: 16,
337
+ }}
338
+ >
339
+ {avatarInitial}
340
+ </span>
341
+ <div style={{ flex: 1, minWidth: 0 }}>
342
+ <div className="md-title-sm" style={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>
343
+ {userLabel}
332
344
  </div>
333
- )}
334
- <div className="acct-list">
335
- {acctRow('support', t('autobahn:chrome.acct.support'), () => goRoute(R_KONTAKT), { icon: 'help-circle' })}
336
- </div>
337
- {renderLanguageRows()}
338
- <div className="acct-list">
339
- {acctRow('signOut', t('autobahn:chrome.signOut'), () => { setAccount(false); if (onSignOut) onSignOut(); }, { icon: 'log-out' })}
345
+ <a
346
+ onClick={() => goRoute(R_SETTINGS)}
347
+ className="md-label"
348
+ style={{ color: 'var(--md-primary)', cursor: 'pointer', fontWeight: 600 }}
349
+ >
350
+ {t('autobahn:chrome.myProfile')} ›
351
+ </a>
340
352
  </div>
341
- </>
353
+ </div>
342
354
  ) : (
343
355
  <>
344
- <div className="acct-list">
345
- <div className="acct-cta">
346
- <Button variant="filled" block onClick={() => goRoute(R_SIGN_IN)}>{t('autobahn:chrome.signIn')}</Button>
347
- </div>
348
- {acctRow('register', t('autobahn:chrome.register'), () => goRoute(R_SIGN_UP), { lucide: 'user-plus' })}
349
- {acctRow('dealerSignUp', t('autobahn:chrome.dealerSignUp'), () => goRoute(R_DEALER), { lucide: 'store' })}
356
+ <span
357
+ style={{
358
+ width: 44, height: 44, borderRadius: '50%', margin: '0 auto 14px',
359
+ background: 'var(--md-outline-variant)', color: 'var(--md-on-surface-variant)',
360
+ display: 'flex', alignItems: 'center', justifyContent: 'center',
361
+ }}
362
+ >
363
+ <Icon name="user" size={22} />
364
+ </span>
365
+ <div className="md-headline-sm" style={{ fontWeight: 700, marginBottom: 6 }}>
366
+ {t('autobahn:chrome.welcome')}
350
367
  </div>
351
- <div className="acct-list">
352
- {acctRow('favorites', t('autobahn:chrome.acct.favorites'), () => goRoute(R_FAVOURITES), { icon: 'star', badge: favoritesCount })}
368
+ <div className="md-body" style={{ marginBottom: 16 }}>
369
+ {t('autobahn:chrome.welcomeSubtext')}
353
370
  </div>
354
- {renderLanguageRows()}
355
371
  </>
356
372
  )}
357
373
  </div>
374
+
375
+ <div style={{ padding: '4px 20px 8px' }}>
376
+ {isAuthorized ? (
377
+ <>
378
+ {!isDealerMain &&
379
+ mrow('m-dashboard', t('autobahn:chrome.dashboard'), () => goRoute(R_DASHBOARD), { icon: 'layout-grid' })}
380
+ {mrow('m-vehicles', t('autobahn:chrome.myVehicles'), () => goRoute(R_MY_VEHICLES), { icon: 'car' })}
381
+ {mrow('m-searches', t('autobahn:chrome.savedSearches'), () => goRoute(R_SAVED_SEARCHES), { icon: 'bell' })}
382
+ {mrow('m-favorites', t('autobahn:chrome.favorites'), () => goRoute(R_FAVOURITES), { icon: 'heart', badge: favoritesCount })}
383
+ {mrow('m-settings', t('autobahn:chrome.settings'), () => goRoute(R_SETTINGS), { icon: 'settings' })}
384
+ {mrow('m-help', t('autobahn:chrome.helpContact'), () => goRoute(R_KONTAKT), { icon: 'help-circle' })}
385
+ {isDealerMain && mrow('m-dealer', t('autobahn:chrome.dealerDashboard'), () => goRoute(R_DASHBOARD), { icon: 'store' })}
386
+ {mrow('m-signout', t('autobahn:chrome.signOut'), () => { setAccount(false); if (onSignOut) onSignOut(); }, { icon: 'log-out' })}
387
+ </>
388
+ ) : (
389
+ <>
390
+ <button
391
+ type="button"
392
+ className="mbtn mbtn--filled mbtn--block"
393
+ style={{ width: '100%', marginBottom: 4 }}
394
+ onClick={() => goRoute(R_SIGN_IN)}
395
+ >
396
+ {t('autobahn:chrome.signIn')}
397
+ </button>
398
+ {mrow('m-register', t('autobahn:chrome.register'), () => goRoute(R_SIGN_UP), { icon: 'user-plus' })}
399
+ {mrow('m-dealer-signup', t('autobahn:chrome.dealerSignUp'), () => goRoute(R_DEALER), { icon: 'store' })}
400
+ {mrow('m-favorites', t('autobahn:chrome.favorites'), () => goRoute(R_FAVOURITES), { icon: 'heart', badge: favoritesCount })}
401
+ </>
402
+ )}
403
+ </div>
404
+
405
+ {divider('m-d1')}
406
+
407
+ <div style={{ padding: '8px 20px 20px' }}>
408
+ <div className="md-label-sm" style={{ color: 'var(--md-on-surface-variant)', padding: '4px 4px 6px' }}>
409
+ {t('autobahn:chrome.language')}
410
+ </div>
411
+ {LANGS.map(([code, label]) => mLangRow(code, label))}
412
+ </div>
413
+ </div>
414
+ );
415
+
416
+ const renderAccountMenu = (): JSX.Element => (
417
+ <div
418
+ className="amenu mcard hide-mobile"
419
+ style={{
420
+ position: 'absolute',
421
+ top: 'calc(100% + 8px)',
422
+ right: 0,
423
+ width: 264,
424
+ padding: 8,
425
+ zIndex: 60,
426
+ boxShadow: 'var(--md-elev-2)',
427
+ }}
428
+ >
429
+ {isAuthorized ? (
430
+ <>
431
+ <div className="md-label-sm" style={{ padding: '6px 14px 8px', color: 'var(--md-on-surface-variant)' }}>
432
+ {userLabel || t('autobahn:chrome.myAccount')}
433
+ </div>
434
+ {/* dealer-main users get the same route via the dedicated "Händler-Dashboard" row below */}
435
+ {!isDealerMain &&
436
+ row('autobahn:chrome.dashboard', t('autobahn:chrome.dashboard'), () => goRoute(R_DASHBOARD), { icon: 'layout-grid' })}
437
+ {row('autobahn:chrome.myVehicles', t('autobahn:chrome.myVehicles'), () => goRoute(R_MY_VEHICLES), { icon: 'car' })}
438
+ {ordersCount > 0 &&
439
+ row('autobahn:chrome.myOrders', t('autobahn:chrome.myOrders'), () => goRoute(R_MY_ORDERS), { icon: 'package', badge: ordersCount })}
440
+ {row('autobahn:chrome.savedSearches', t('autobahn:chrome.savedSearches'), () => goRoute(R_SAVED_SEARCHES), { icon: 'bell' })}
441
+ {row('autobahn:chrome.favorites', t('autobahn:chrome.favorites'), () => goRoute(R_FAVOURITES), { icon: 'heart', badge: favoritesCount })}
442
+ {row('autobahn:chrome.settings', t('autobahn:chrome.settings'), () => goRoute(R_SETTINGS), { icon: 'settings' })}
443
+ {row('autobahn:chrome.helpContact', t('autobahn:chrome.helpContact'), () => goRoute(R_KONTAKT), { icon: 'help-circle' })}
444
+ {isDealerMain && (
445
+ <>
446
+ {divider('d-dealer')}
447
+ {row('autobahn:chrome.dealerDashboard', t('autobahn:chrome.dealerDashboard'), () => goRoute(R_DASHBOARD), { icon: 'store' })}
448
+ {row('autobahn:chrome.imageSettings', t('autobahn:chrome.imageSettings'), () => goRoute(R_IMAGE_SETTINGS), { icon: 'image' })}
449
+ </>
450
+ )}
451
+ {dealers.length > 1 && (
452
+ <>
453
+ <div className="md-label-sm" style={{ padding: '8px 14px 4px', color: 'var(--md-on-surface-variant)' }}>
454
+ {t('autobahn:chrome.myDealers')} ({dealers.length})
455
+ </div>
456
+ {dealers.map((d) =>
457
+ row(`dealer-${d.dealer.id}`, d.dealer.email, () => {
458
+ setAccount(false);
459
+ if (!d.isActive && onDealerSelect) onDealerSelect(d.dealer.id);
460
+ }, { icon: d.isActive ? 'check' : 'store' }),
461
+ )}
462
+ </>
463
+ )}
464
+ {divider('d1')}
465
+ {row('autobahn:chrome.signOut', t('autobahn:chrome.signOut'), () => { setAccount(false); if (onSignOut) onSignOut(); }, { icon: 'log-out' })}
466
+ </>
467
+ ) : (
468
+ <>
469
+ {row('autobahn:chrome.signIn', t('autobahn:chrome.signIn'), () => goRoute(R_SIGN_IN), { primary: true })}
470
+ {row('autobahn:chrome.register', t('autobahn:chrome.register'), () => goRoute(R_SIGN_UP), { icon: 'user-plus' })}
471
+ {row('autobahn:chrome.dealerSignUp', t('autobahn:chrome.dealerSignUp'), () => goRoute(R_DEALER), { icon: 'store' })}
472
+ {divider('d1')}
473
+ {row('autobahn:chrome.favorites', t('autobahn:chrome.favorites'), () => goRoute(R_FAVOURITES), { icon: 'heart', badge: favoritesCount })}
474
+ </>
475
+ )}
476
+ {divider('d2')}
477
+ <div className="md-label-sm" style={{ padding: '4px 14px', color: 'var(--md-on-surface-variant)' }}>{t('autobahn:chrome.language')}</div>
478
+ {LANGS.map(([code, label]) =>
479
+ row(`lang-${code}`, label, () => { setAccount(false); if (onLangSelect) onLangSelect(code); }, {
480
+ icon: language === code ? 'check' : 'globe',
481
+ }),
482
+ )}
358
483
  </div>
359
484
  );
360
485
 
@@ -444,11 +569,11 @@ const TopBar: React.FunctionComponent<TopBarProps> = ({
444
569
  </div>
445
570
  )}
446
571
 
447
- {/* Konto trigger + menu — visible at EVERY width: this menu is the only place sign-out /
448
- settings / dealer switching exist, so it must never be display:none'd (the
572
+ {/* Konto trigger + account layer — visible at EVERY width: this menu is the only place
573
+ sign-out / settings / dealer switching exist, so it must never be display:none'd (the
449
574
  pre-cutover hide-tablet left 601–980px with no logout at all). Desktop keeps the
450
575
  tonal "Konto" pill; ≤600px it collapses to a plain icon (topbar-account-btn CSS) and
451
- opens the same 312px menu (Figma draws the phone one the same). */}
576
+ opens the full-width mobile Account Layer instead of the small popover. */}
452
577
  <span style={{ position: 'relative', display: 'inline-flex' }}>
453
578
  <button
454
579
  className="mbtn mbtn--tonal mbtn--sm topbar-account-btn"
@@ -464,6 +589,8 @@ const TopBar: React.FunctionComponent<TopBarProps> = ({
464
589
  </div>
465
590
  </div>
466
591
 
592
+ {account && renderMobileAccountLayer()}
593
+
467
594
  {/* click-away backdrop for the account popover */}
468
595
  {account && (
469
596
  <div
@@ -1,18 +1,14 @@
1
1
  import React, { useEffect, useState } from 'react';
2
2
  import useModal from './useModal';
3
3
  import { updateCookieList } from '../../utils/CommonUtils';
4
- import { OPEN_COOKIE_SETTINGS_EVENT } from '../../utils/cookieConsent';
5
4
  import Modal from './Modal';
6
- import { TranslationFunction } from '../../types';
7
5
 
8
6
  export interface ICookieModal {
9
7
  handleSentryInit?: () => void;
10
- /** the host's `t` with the `autobahn` namespace (`cookieModal.*`); without it the dialog is German */
11
- t?: TranslationFunction;
12
8
  }
13
9
 
14
- const CookieModal = ({ handleSentryInit = () => {}, t }: ICookieModal) => {
15
- const { isVisible, toggleModal, openModal } = useModal();
10
+ const CookieModal = ({ handleSentryInit }: ICookieModal) => {
11
+ const { isVisible, toggleModal } = useModal();
16
12
  const [modal, setModal] = useState('');
17
13
 
18
14
  useEffect(
@@ -26,19 +22,6 @@ const CookieModal = ({ handleSentryInit = () => {}, t }: ICookieModal) => {
26
22
  []
27
23
  );
28
24
 
29
- // ADV-268: "Cookie-Einstellungen ändern" (account page) reopens the settings dialog
30
- useEffect(
31
- () => {
32
- const onOpenSettings = () => {
33
- setModal('MANAGE_COOKIE_MODAL');
34
- openModal();
35
- };
36
- window.addEventListener(OPEN_COOKIE_SETTINGS_EVENT, onOpenSettings);
37
- return () => window.removeEventListener(OPEN_COOKIE_SETTINGS_EVENT, onOpenSettings);
38
- },
39
- []
40
- );
41
-
42
25
  useEffect(
43
26
  () => {
44
27
  if (!isVisible) return undefined;
@@ -62,7 +45,6 @@ const CookieModal = ({ handleSentryInit = () => {}, t }: ICookieModal) => {
62
45
  ? <Modal
63
46
  isVisible={isVisible}
64
47
  handleSentryInit={handleSentryInit}
65
- t={t}
66
48
  toggleModal={toggleModal}
67
49
  name={modal}
68
50
  modalProps={modalProps}
@@ -70,4 +52,8 @@ const CookieModal = ({ handleSentryInit = () => {}, t }: ICookieModal) => {
70
52
  : <></>;
71
53
  };
72
54
 
55
+ CookieModal.defaultProps = {
56
+ handleSentryInit: () => {}
57
+ };
58
+
73
59
  export default CookieModal;
@@ -16,7 +16,6 @@ import * as React from 'react';
16
16
  import * as ReactDOM from 'react-dom';
17
17
 
18
18
  import ModalsConfig from './ModalsConfig';
19
- import { TranslationFunction } from '../../types';
20
19
  import styles from './Modal.styl';
21
20
 
22
21
  interface IBasicModal {
@@ -25,7 +24,6 @@ interface IBasicModal {
25
24
  handleSentryInit?: () => void;
26
25
  name: string;
27
26
  modalProps?: any;
28
- t?: TranslationFunction;
29
27
  }
30
28
 
31
29
  const OVERLAY: React.CSSProperties = {
@@ -42,17 +40,16 @@ const SURFACE: React.CSSProperties = {
42
40
  maxWidth: 640, width: '100%', maxHeight: '92vh', overflowY: 'auto'
43
41
  };
44
42
 
45
- const BasicModal = ({ isVisible, toggleModal, name, modalProps, handleSentryInit, t }: IBasicModal) => {
43
+ const BasicModal = ({ isVisible, toggleModal, name, modalProps, handleSentryInit }: IBasicModal) => {
46
44
  if (!isVisible || typeof document === 'undefined') return null;
47
- const label = t ? t('autobahn:cookieModal.dialogLabel') : '';
48
45
  return ReactDOM.createPortal(
49
46
  // wrapped in .md3: autobahn.css scopes every token/utility class (incl.
50
47
  // .mbtn used by the modal buttons) under `.md3` and intentionally does
51
48
  // nothing outside it — a bare document.body portal loses the theme.
52
49
  <div className='md3'>
53
- <div className={styles.overlay} style={OVERLAY} role='dialog' aria-modal='true' aria-label={label && !label.endsWith('cookieModal.dialogLabel') ? label : 'Cookie-Einstellungen'}>
50
+ <div className={styles.overlay} style={OVERLAY} role='dialog' aria-modal='true' aria-label='Cookie-Einstellungen'>
54
51
  <div className={styles.surface} style={SURFACE}>
55
- {ModalsConfig[name] && ModalsConfig[name]({ ...modalProps, toggleModal, handleSentryInit, t })}
52
+ {ModalsConfig[name] && ModalsConfig[name]({ ...modalProps, toggleModal, handleSentryInit })}
56
53
  </div>
57
54
  </div>
58
55
  </div>,