@bytebrand/fe-ui-core-autobahn 1.0.188 → 1.0.190
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/cards/CarCard.tsx +388 -354
- package/cards/cardParts.tsx +10 -2
- package/cards/index.ts +0 -6
- package/chrome/Footer.tsx +3 -16
- package/chrome/TopBar.tsx +266 -139
- package/compat/CookieModal/CookieModal.tsx +6 -20
- package/compat/CookieModal/Modal.tsx +3 -6
- package/compat/CookieModal/modals/ManageCookieModal/ManageCookieModal.tsx +15 -43
- package/compat/CookieModal/modals/PreviewCookieModal/PreviewCookieModal.tsx +3 -4
- package/compat/CookieModal/useModal.ts +1 -5
- package/compat/Loader/Loader.tsx +7 -1
- package/compat/MdField/MdField.tsx +4 -28
- package/compat/TimePicker/TimePicker.tsx +2 -12
- package/constants/app.ts +11 -1
- package/constants/core.ts +12 -1
- package/data/toAutobahnCar.ts +2 -16
- package/iconsvg/IconSVG.tsx +5 -1
- package/locales/de/autobahn.json +848 -879
- package/locales/en/autobahn.json +848 -879
- package/package.json +2 -2
- package/theme/md3.css +11573 -15523
- package/ui/CreditCostNotice.tsx +43 -0
- package/ui/Dropdown.tsx +10 -29
- package/ui/FormCheckbox.tsx +2 -22
- package/ui/FormField.tsx +1 -2
- package/ui/Icon.tsx +0 -6
- package/ui/Modal.tsx +6 -84
- package/ui/Skeleton.tsx +20 -79
- package/ui/index.ts +3 -2
- package/ui/usePortalMenuPosition.ts +15 -27
- package/utils/index.ts +0 -10
- package/vdp/FinanceCalculator.tsx +11 -20
- package/vdp/VdpModules.tsx +15 -37
- package/vdp/types.ts +5 -5
- package/vehiclesProps/decoratedLightProps.tsx +0 -4
- package/vehiclesProps/decoratedProps.tsx +0 -4
- package/cards/CarCardSkeleton.tsx +0 -103
- package/cards/CarRowSkeleton.tsx +0 -152
- package/chrome/AccountMenuIcon.tsx +0 -109
- package/ui/MfieldCheckIcon.tsx +0 -13
- package/ui/scrollFieldIntoView.ts +0 -41
- package/utils/cookieConsent.ts +0 -84
- package/vehiclesProps/accidentDisclosure.ts +0 -25
package/cards/cardParts.tsx
CHANGED
|
@@ -18,7 +18,7 @@ import React, { useState } from 'react';
|
|
|
18
18
|
import { TranslationFunction } from '../types';
|
|
19
19
|
import { defaultConfig } from '@bytebrand/fe-financing';
|
|
20
20
|
|
|
21
|
-
import { Icon, Button } from '../ui';
|
|
21
|
+
import { Icon, Button, CreditCostNotice } from '../ui';
|
|
22
22
|
import { EvalBar } from '../vdp/FinanceCalculator';
|
|
23
23
|
import { CO2_CLASSES, CO2_COLORS, TIER_KEYS, TIER_COLORS } from '../constants';
|
|
24
24
|
import { AutobahnCar } from './types';
|
|
@@ -710,7 +710,12 @@ export const PriceTerms: React.FunctionComponent<{
|
|
|
710
710
|
onShowDetails?: () => void;
|
|
711
711
|
t: TranslationFunction;
|
|
712
712
|
}> = ({ car, mode, onOpenRateAdjust, onShowDetails, t }) => {
|
|
713
|
-
|
|
713
|
+
// Kaufen (buy): a cash purchase has no financing terms/details link — used to `return null`
|
|
714
|
+
// here, which collapsed .cc-terms to 0 height on that tab while Financing/Leasing rendered a
|
|
715
|
+
// real line, jumping the price row (and everything below it: rating pill, CTA row) up/down on
|
|
716
|
+
// every tab switch. Render an empty, still-present .cc-terms div instead — same fix as the VDP
|
|
717
|
+
// FinanceCalculator's .fin-cond (md3.css), which reserves its line's height the same way.
|
|
718
|
+
if (mode === 'buy') return <div className="cc-terms" />;
|
|
714
719
|
const finFirstInstallment =
|
|
715
720
|
car.finFirstInstallment != null ? car.finFirstInstallment.toLocaleString('de-DE') : _finFirstInstallment;
|
|
716
721
|
const finMonths = car.finMonths ?? _finMonths;
|
|
@@ -1146,6 +1151,9 @@ export const PricePaths: React.FunctionComponent<PricePathsProps> = ({ car, t, c
|
|
|
1146
1151
|
})}{' '}
|
|
1147
1152
|
· {detailsLink('financing')}
|
|
1148
1153
|
</div>
|
|
1154
|
+
{/* ADV-405/408/411 Kreditkosten-Hinweis: one per card, under the financing conditions and
|
|
1155
|
+
above the Leasing row. Financing is always shown in this column, so it is unconditional. */}
|
|
1156
|
+
<CreditCostNotice t={t} size="small" cls="pp-ccn" />
|
|
1149
1157
|
{hasLease && (
|
|
1150
1158
|
<div className="pp-lease-row">
|
|
1151
1159
|
<PpRow label={t('autobahn:card.price.leasing')} value={car.lease as number} unit="mtl." t={t} />
|
package/cards/index.ts
CHANGED
|
@@ -11,12 +11,6 @@ export type { CarCardProps } from './CarCard';
|
|
|
11
11
|
export { default as CarRow } from './CarRow';
|
|
12
12
|
export type { CarRowProps } from './CarRow';
|
|
13
13
|
|
|
14
|
-
export { default as CarCardSkeleton } from './CarCardSkeleton';
|
|
15
|
-
export type { CarCardSkeletonProps } from './CarCardSkeleton';
|
|
16
|
-
|
|
17
|
-
export { default as CarRowSkeleton } from './CarRowSkeleton';
|
|
18
|
-
export type { CarRowSkeletonProps } from './CarRowSkeleton';
|
|
19
|
-
|
|
20
14
|
export {
|
|
21
15
|
fmtKm,
|
|
22
16
|
cardSpec,
|
package/chrome/Footer.tsx
CHANGED
|
@@ -86,14 +86,6 @@ export interface FooterProps {
|
|
|
86
86
|
* (VehicleDetailedNextPage), never site-wide, since every other page shows only footnotes 1-4.
|
|
87
87
|
*/
|
|
88
88
|
showCostFootnotes?: boolean;
|
|
89
|
-
/**
|
|
90
|
-
* Hides the brand blurb + "stay in contact"/social + 3 link columns block (the
|
|
91
|
-
* `.footer-grid`), leaving just the legal disclaimer and copyright/"Nach Oben" bar. Opt-in,
|
|
92
|
-
* off by default — every other caller keeps the full footer. Only CheckoutThankYouPage.tsx
|
|
93
|
-
* (checkout step 6 "Danke") uses this today: that page's own Figma reference (64637:37033)
|
|
94
|
-
* has just the compact legal/copyright strip, not the full site footer.
|
|
95
|
-
*/
|
|
96
|
-
hideBrandColumns?: boolean;
|
|
97
89
|
}
|
|
98
90
|
|
|
99
91
|
/**
|
|
@@ -101,7 +93,7 @@ export interface FooterProps {
|
|
|
101
93
|
* disclaimer block, and a copyright + "Nach Oben" bar. Pure/presentational MD3 chrome — renders
|
|
102
94
|
* correctly only inside a `<div className="md3">` subtree (scoped theme at source/theme/autobahn).
|
|
103
95
|
*/
|
|
104
|
-
const Footer: React.FunctionComponent<FooterProps> = ({ t, showCostFootnotes
|
|
96
|
+
const Footer: React.FunctionComponent<FooterProps> = ({ t, showCostFootnotes }) => {
|
|
105
97
|
const scrollTop = (): void => window.scroll({ top: 0, left: 0, behavior: 'smooth' });
|
|
106
98
|
const now = new Date();
|
|
107
99
|
const year = now.getFullYear();
|
|
@@ -112,7 +104,6 @@ const Footer: React.FunctionComponent<FooterProps> = ({ t, showCostFootnotes, hi
|
|
|
112
104
|
|
|
113
105
|
return (
|
|
114
106
|
<footer style={{ background: 'var(--md-sc-low)', borderTop: '1px solid var(--md-outline-variant)' }}>
|
|
115
|
-
{!hideBrandColumns ? (
|
|
116
107
|
<div className="container footer-grid" style={{ padding: '40px 24px 24px' }}>
|
|
117
108
|
<div>
|
|
118
109
|
<img src={logoUrl} height="30" alt="auto.de" />
|
|
@@ -178,14 +169,10 @@ const Footer: React.FunctionComponent<FooterProps> = ({ t, showCostFootnotes, hi
|
|
|
178
169
|
</div>
|
|
179
170
|
))}
|
|
180
171
|
</div>
|
|
181
|
-
) : null}
|
|
182
172
|
|
|
183
173
|
{/* Legally required disclaimers (PAngV §17a financing example w/ live APR/nominal rate +
|
|
184
|
-
term, DAT CO₂-Leitfaden, MwSt, Streichpreis, image notice). Same text as the legacy footer.
|
|
185
|
-
|
|
186
|
-
block is gone, so the border would just double up against whatever's already directly
|
|
187
|
-
above the footer on the page (CheckoutThankYouPage.tsx's own header border). */}
|
|
188
|
-
<div style={hideBrandColumns ? undefined : { borderTop: '1px solid var(--md-outline-variant)' }}>
|
|
174
|
+
term, DAT CO₂-Leitfaden, MwSt, Streichpreis, image notice). Same text as the legacy footer. */}
|
|
175
|
+
<div style={{ borderTop: '1px solid var(--md-outline-variant)' }}>
|
|
189
176
|
<div className="container" style={{ padding: '18px 24px' }}>
|
|
190
177
|
<p
|
|
191
178
|
className="md-label-sm"
|
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
|
-
/**
|
|
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
|
|
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
|
-
/**
|
|
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
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
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
|
-
|
|
257
|
-
|
|
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
|
-
/**
|
|
279
|
-
*
|
|
280
|
-
*
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
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
|
-
<
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
{
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
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
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
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
|
-
<
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
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="
|
|
352
|
-
{
|
|
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 +
|
|
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
|
|
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
|
|
15
|
-
const { isVisible, toggleModal
|
|
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;
|