@bytebrand/fe-ui-core-autobahn 1.0.167 → 1.0.169
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 +10 -47
- package/cards/CarRow.tsx +1 -5
- package/cards/cardParts.tsx +1 -11
- package/chrome/AccountMenuIcon.tsx +91 -0
- package/chrome/TopBar.tsx +104 -266
- package/constants/app.ts +1 -11
- package/constants/core.ts +1 -12
- package/locales/de/autobahn.json +12 -5
- package/locales/en/autobahn.json +12 -5
- package/locales/legacy/data.ts +1 -2
- package/package.json +30 -30
- package/theme/md3.css +124 -27
- package/ui/Dropdown.tsx +8 -16
- package/ui/index.ts +0 -2
- package/ui/usePortalMenuPosition.ts +12 -14
- package/utils/index.ts +0 -2
- package/vdp/VdpModules.tsx +3 -3
- package/vdp/types.ts +5 -5
- package/vehiclesProps/decoratedLightProps.tsx +6 -20
- package/vehiclesProps/decoratedProps.tsx +4 -12
- package/ui/scrollFieldIntoView.ts +0 -41
- package/vehiclesProps/accidentDisclosure.ts +0 -25
package/chrome/TopBar.tsx
CHANGED
|
@@ -3,6 +3,7 @@ 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';
|
|
6
7
|
|
|
7
8
|
/** Where the logo navigates on click. '/' is NOT an SPA route — traefik serves the WordPress
|
|
8
9
|
* homepage there (generate-routes.py: wp-home at higher priority) — so the logo must be a FULL
|
|
@@ -39,6 +40,10 @@ const R_MY_ORDERS = '/account/my-orders';
|
|
|
39
40
|
const R_DASHBOARD = '/account/dashboard';
|
|
40
41
|
const R_IMAGE_SETTINGS = '/account/image-settings';
|
|
41
42
|
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;
|
|
42
47
|
|
|
43
48
|
/** Languages offered in the account menu (legacy supports de/en/ru). Labels are proper nouns
|
|
44
49
|
* (endonyms) and stay untranslated. */
|
|
@@ -83,14 +88,18 @@ export interface TopBarProps {
|
|
|
83
88
|
variant?: TopBarVariant;
|
|
84
89
|
/** real auth state (authStore.isAuthorized) — guest vs profile menu. */
|
|
85
90
|
isAuthorized?: boolean;
|
|
86
|
-
/**
|
|
91
|
+
/** name in the authed menu's head (the profile's first + last name, else authStore.userEmail). */
|
|
87
92
|
userLabel?: string;
|
|
88
93
|
/** Merkliste count (favoriteStore.favoritesIDs.length) — badge on the heart + menu row. */
|
|
89
94
|
favoritesCount?: number;
|
|
90
95
|
/** unread Suchaufträge count — badge on the bell. Defaults to 0 (no badge). */
|
|
91
96
|
notificationCount?: number;
|
|
92
|
-
/** placed-orders count (profileStore.totalOrdered) —
|
|
97
|
+
/** placed-orders count (profileStore.totalOrdered) — the "Meine Bestellung" row shows only above 0. */
|
|
93
98
|
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;
|
|
94
103
|
/** active language tag (appStore.language) — ticks the current language row. */
|
|
95
104
|
language?: string;
|
|
96
105
|
/** dealer-main account (authStore.isDealerMain) — shows the dealer menu section. */
|
|
@@ -138,6 +147,8 @@ const TopBar: React.FunctionComponent<TopBarProps> = ({
|
|
|
138
147
|
favoritesCount = 0,
|
|
139
148
|
notificationCount = 0,
|
|
140
149
|
ordersCount = 0,
|
|
150
|
+
savedSearchesCount = 0,
|
|
151
|
+
compareCount = 0,
|
|
141
152
|
language = 'de',
|
|
142
153
|
isDealerMain = false,
|
|
143
154
|
dealers = [],
|
|
@@ -206,280 +217,109 @@ const TopBar: React.FunctionComponent<TopBarProps> = ({
|
|
|
206
217
|
</nav>
|
|
207
218
|
);
|
|
208
219
|
|
|
209
|
-
/** one
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
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>
|
|
238
|
-
)}
|
|
220
|
+
/** one Konto-menu row (Figma "acct-row"): 22px icon, label, count badge when above 0. `icon` is a
|
|
221
|
+
* Figma glyph; `lucide` is a lib Icon for the rows Figma doesn't draw (guest, dealer). */
|
|
222
|
+
const acctRow = (
|
|
223
|
+
key: string,
|
|
224
|
+
label: string,
|
|
225
|
+
onClick: () => void,
|
|
226
|
+
opts: { icon?: AccountMenuIconName; lucide?: string; badge?: number } = {},
|
|
227
|
+
): JSX.Element => (
|
|
228
|
+
<button key={key} type="button" className="acct-row" onClick={onClick}>
|
|
229
|
+
{opts.icon && <AccountMenuIcon name={opts.icon} />}
|
|
230
|
+
{opts.lucide && <Icon name={opts.lucide} size={22} stroke={ACCT_ICON_STROKE} cls="acct-icon" />}
|
|
231
|
+
<span className="acct-label">{label}</span>
|
|
232
|
+
{!!opts.badge && opts.badge > 0 && <span className="acct-badge">{opts.badge}</span>}
|
|
239
233
|
</button>
|
|
240
234
|
);
|
|
241
235
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
)
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
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>
|
|
236
|
+
/** language rows — not in the Figma menu, kept for phones: the header's DE/EN switch is hidden
|
|
237
|
+
* ≤600px, so this group (show-mobile) is the only language switch there. */
|
|
238
|
+
const renderLanguageRows = (): JSX.Element => (
|
|
239
|
+
<div className="acct-list show-mobile">
|
|
240
|
+
{LANGS.map(([code, label]) => (
|
|
241
|
+
<button
|
|
242
|
+
key={`lang-${code}`}
|
|
243
|
+
type="button"
|
|
244
|
+
className="acct-row"
|
|
245
|
+
aria-pressed={language === code}
|
|
246
|
+
onClick={() => { setAccount(false); if (onLangSelect) onLangSelect(code); }}
|
|
247
|
+
>
|
|
248
|
+
<span className="acct-flag"><Flag code={code} /></span>
|
|
249
|
+
<span className="acct-label">{label}</span>
|
|
250
|
+
{language === code && (
|
|
251
|
+
<span className="acct-check"><Icon name="check" size={13} color="#fff" stroke={3} /></span>
|
|
252
|
+
)}
|
|
253
|
+
</button>
|
|
254
|
+
))}
|
|
255
|
+
</div>
|
|
281
256
|
);
|
|
282
257
|
|
|
283
|
-
/**
|
|
284
|
-
*
|
|
285
|
-
*
|
|
286
|
-
const
|
|
287
|
-
|
|
288
|
-
|
|
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' }}>
|
|
258
|
+
/** Konto menu (Figma "Kontomenü (geöffnet)", 64243:14205 desktop / 64243:14299 mobile — the same
|
|
259
|
+
* 312px dropdown at every width): the name, then groups split by lines. Dealer and guest rows,
|
|
260
|
+
* which Figma doesn't draw, use the same row style. */
|
|
261
|
+
const renderAccountMenu = (): JSX.Element => (
|
|
262
|
+
<div className="acct-menu">
|
|
263
|
+
<div className="acct-scroll">
|
|
329
264
|
{isAuthorized ? (
|
|
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}
|
|
344
|
-
</div>
|
|
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>
|
|
352
|
-
</div>
|
|
353
|
-
</div>
|
|
354
|
-
) : (
|
|
355
265
|
<>
|
|
356
|
-
<
|
|
357
|
-
|
|
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')}
|
|
266
|
+
<div className="acct-head">
|
|
267
|
+
<span className="acct-name">{userLabel || t('autobahn:chrome.myAccount')}</span>
|
|
367
268
|
</div>
|
|
368
|
-
<div className="
|
|
369
|
-
{
|
|
269
|
+
<div className="acct-list">
|
|
270
|
+
{/* dealer-main users get the same route via the "Händler-Dashboard" row below */}
|
|
271
|
+
{!isDealerMain &&
|
|
272
|
+
acctRow('overview', t('autobahn:chrome.acct.overview'), () => goRoute(R_DASHBOARD), { icon: 'layout-grid' })}
|
|
273
|
+
{ordersCount > 0 &&
|
|
274
|
+
acctRow('myOrder', t('autobahn:chrome.acct.myOrder'), () => goRoute(R_MY_ORDERS), { icon: 'car-front' })}
|
|
275
|
+
{acctRow('savedSearches', t('autobahn:chrome.acct.savedSearches'), () => goRoute(R_SAVED_SEARCHES), { icon: 'bookmark', badge: savedSearchesCount })}
|
|
276
|
+
{acctRow('favorites', t('autobahn:chrome.acct.favorites'), () => goRoute(R_FAVOURITES), { icon: 'star', badge: favoritesCount })}
|
|
277
|
+
{acctRow('compare', t('autobahn:chrome.acct.compare'), () => goRoute(R_COMPARE), { icon: 'scale', badge: compareCount })}
|
|
278
|
+
</div>
|
|
279
|
+
<div className="acct-list">
|
|
280
|
+
{acctRow('profile', t('autobahn:chrome.acct.profile'), () => goRoute(R_SETTINGS), { icon: 'user' })}
|
|
281
|
+
</div>
|
|
282
|
+
<div className="acct-list">
|
|
283
|
+
{acctRow('support', t('autobahn:chrome.acct.support'), () => goRoute(R_KONTAKT), { icon: 'help-circle' })}
|
|
284
|
+
</div>
|
|
285
|
+
{isDealerMain && (
|
|
286
|
+
<div className="acct-list">
|
|
287
|
+
{acctRow('dealerDashboard', t('autobahn:chrome.dealerDashboard'), () => goRoute(R_DASHBOARD), { lucide: 'store' })}
|
|
288
|
+
{acctRow('imageSettings', t('autobahn:chrome.imageSettings'), () => goRoute(R_IMAGE_SETTINGS), { lucide: 'image' })}
|
|
289
|
+
{dealers.length > 1 && (
|
|
290
|
+
<>
|
|
291
|
+
<div className="acct-sub">{t('autobahn:chrome.myDealers')} ({dealers.length})</div>
|
|
292
|
+
{dealers.map((d) =>
|
|
293
|
+
acctRow(`dealer-${d.dealer.id}`, d.dealer.email, () => {
|
|
294
|
+
setAccount(false);
|
|
295
|
+
if (!d.isActive && onDealerSelect) onDealerSelect(d.dealer.id);
|
|
296
|
+
}, { lucide: d.isActive ? 'check' : 'store' }),
|
|
297
|
+
)}
|
|
298
|
+
</>
|
|
299
|
+
)}
|
|
300
|
+
</div>
|
|
301
|
+
)}
|
|
302
|
+
{renderLanguageRows()}
|
|
303
|
+
<div className="acct-list">
|
|
304
|
+
{acctRow('signOut', t('autobahn:chrome.signOut'), () => { setAccount(false); if (onSignOut) onSignOut(); }, { icon: 'log-out' })}
|
|
370
305
|
</div>
|
|
371
|
-
</>
|
|
372
|
-
)}
|
|
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
306
|
</>
|
|
388
307
|
) : (
|
|
389
308
|
<>
|
|
390
|
-
<
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
{
|
|
309
|
+
<div className="acct-list">
|
|
310
|
+
<div className="acct-cta">
|
|
311
|
+
<Button variant="filled" block onClick={() => goRoute(R_SIGN_IN)}>{t('autobahn:chrome.signIn')}</Button>
|
|
312
|
+
</div>
|
|
313
|
+
{acctRow('register', t('autobahn:chrome.register'), () => goRoute(R_SIGN_UP), { lucide: 'user-plus' })}
|
|
314
|
+
{acctRow('dealerSignUp', t('autobahn:chrome.dealerSignUp'), () => goRoute(R_DEALER), { lucide: 'store' })}
|
|
315
|
+
</div>
|
|
316
|
+
<div className="acct-list">
|
|
317
|
+
{acctRow('favorites', t('autobahn:chrome.acct.favorites'), () => goRoute(R_FAVOURITES), { icon: 'star', badge: favoritesCount })}
|
|
318
|
+
</div>
|
|
319
|
+
{renderLanguageRows()}
|
|
401
320
|
</>
|
|
402
321
|
)}
|
|
403
322
|
</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
|
-
)}
|
|
483
323
|
</div>
|
|
484
324
|
);
|
|
485
325
|
|
|
@@ -569,11 +409,11 @@ const TopBar: React.FunctionComponent<TopBarProps> = ({
|
|
|
569
409
|
</div>
|
|
570
410
|
)}
|
|
571
411
|
|
|
572
|
-
{/* Konto trigger +
|
|
573
|
-
|
|
412
|
+
{/* Konto trigger + menu — visible at EVERY width: this menu is the only place sign-out /
|
|
413
|
+
settings / dealer switching exist, so it must never be display:none'd (the
|
|
574
414
|
pre-cutover hide-tablet left 601–980px with no logout at all). Desktop keeps the
|
|
575
415
|
tonal "Konto" pill; ≤600px it collapses to a plain icon (topbar-account-btn CSS) and
|
|
576
|
-
opens the
|
|
416
|
+
opens the same 312px menu (Figma draws the phone one the same). */}
|
|
577
417
|
<span style={{ position: 'relative', display: 'inline-flex' }}>
|
|
578
418
|
<button
|
|
579
419
|
className="mbtn mbtn--tonal mbtn--sm topbar-account-btn"
|
|
@@ -589,8 +429,6 @@ const TopBar: React.FunctionComponent<TopBarProps> = ({
|
|
|
589
429
|
</div>
|
|
590
430
|
</div>
|
|
591
431
|
|
|
592
|
-
{account && renderMobileAccountLayer()}
|
|
593
|
-
|
|
594
432
|
{/* click-away backdrop for the account popover */}
|
|
595
433
|
{account && (
|
|
596
434
|
<div
|
package/constants/app.ts
CHANGED
|
@@ -40,17 +40,7 @@ export const LOCAL_STORAGE_KEY = {
|
|
|
40
40
|
i18n_KEY: 'i18nLanguage'
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
// SecurityError that took down the whole bundle. Blocked storage behaves like "nothing saved".
|
|
45
|
-
const readStoredLang = (): string | null => {
|
|
46
|
-
try {
|
|
47
|
-
return localStorage.getItem(LOCAL_STORAGE_KEY.i18n_KEY);
|
|
48
|
-
} catch (e) {
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export const DEFAULT_LANG: string = typeof window !== 'undefined' ? readStoredLang() : 'de';
|
|
43
|
+
export const DEFAULT_LANG: string = typeof window !== 'undefined' ? localStorage.getItem(LOCAL_STORAGE_KEY.i18n_KEY) : 'de';
|
|
54
44
|
|
|
55
45
|
// Default support contact phone
|
|
56
46
|
export const CONTACT_PHONE: string = '+498004030182';
|
package/constants/core.ts
CHANGED
|
@@ -35,18 +35,7 @@ export const LOCAL_STORAGE_KEY = {
|
|
|
35
35
|
i18n_KEY: 'i18nLanguage'
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
// window.localStorage throws a SecurityError, which took down the whole bundle (landing
|
|
40
|
-
// page never rendered). Treat blocked storage like "no language saved".
|
|
41
|
-
const readStoredLang = (): string | null => {
|
|
42
|
-
try {
|
|
43
|
-
return typeof window !== 'undefined' ? window.localStorage.getItem(LOCAL_STORAGE_KEY.i18n_KEY) : null;
|
|
44
|
-
} catch (e) {
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export const DEFAULT_LANG: string = readStoredLang() ?? 'de';
|
|
38
|
+
export const DEFAULT_LANG: string = (typeof window !== 'undefined' ? window.localStorage.getItem(LOCAL_STORAGE_KEY.i18n_KEY) : null) ?? 'de';
|
|
50
39
|
|
|
51
40
|
export const ROW_STYLES = {
|
|
52
41
|
marginBottom: 10
|
package/locales/de/autobahn.json
CHANGED
|
@@ -277,7 +277,16 @@
|
|
|
277
277
|
"myDealers": "Meine Händler",
|
|
278
278
|
"dashboard": "Dashboard",
|
|
279
279
|
"dealerDashboard": "Händler-Dashboard",
|
|
280
|
-
"imageSettings": "Bildeinstellungen"
|
|
280
|
+
"imageSettings": "Bildeinstellungen",
|
|
281
|
+
"acct": {
|
|
282
|
+
"overview": "Übersicht",
|
|
283
|
+
"myOrder": "Meine Bestellung",
|
|
284
|
+
"savedSearches": "Gespeicherte Suchen",
|
|
285
|
+
"favorites": "Favoriten",
|
|
286
|
+
"compare": "Fahrzeuge vergleichen",
|
|
287
|
+
"profile": "Profil",
|
|
288
|
+
"support": "Support & Rückruf"
|
|
289
|
+
}
|
|
281
290
|
},
|
|
282
291
|
"srp": {
|
|
283
292
|
"trust": {
|
|
@@ -485,8 +494,7 @@
|
|
|
485
494
|
"ratings": "Bewertungen"
|
|
486
495
|
},
|
|
487
496
|
"section": {
|
|
488
|
-
"similar": "Ähnliche Fahrzeuge"
|
|
489
|
-
"unavailableSimilar": "Ähnliche / vergleichbare Fahrzeuge"
|
|
497
|
+
"similar": "Ähnliche Fahrzeuge"
|
|
490
498
|
},
|
|
491
499
|
"breadcrumb": {
|
|
492
500
|
"home": "Start",
|
|
@@ -797,8 +805,7 @@
|
|
|
797
805
|
"serviceHistory": "Scheckheft",
|
|
798
806
|
"warranty": "Garantie",
|
|
799
807
|
"yes": "Ja",
|
|
800
|
-
"no": "Nein"
|
|
801
|
-
"notSpecified": "keine Angabe"
|
|
808
|
+
"no": "Nein"
|
|
802
809
|
},
|
|
803
810
|
"common": {
|
|
804
811
|
"needsData": "Daten folgt"
|
package/locales/en/autobahn.json
CHANGED
|
@@ -277,7 +277,16 @@
|
|
|
277
277
|
"myDealers": "My dealers",
|
|
278
278
|
"dashboard": "Dashboard",
|
|
279
279
|
"dealerDashboard": "Dealer dashboard",
|
|
280
|
-
"imageSettings": "Image settings"
|
|
280
|
+
"imageSettings": "Image settings",
|
|
281
|
+
"acct": {
|
|
282
|
+
"overview": "Overview",
|
|
283
|
+
"myOrder": "My order",
|
|
284
|
+
"savedSearches": "Saved searches",
|
|
285
|
+
"favorites": "Favorites",
|
|
286
|
+
"compare": "Compare vehicles",
|
|
287
|
+
"profile": "Profile",
|
|
288
|
+
"support": "Support & callback"
|
|
289
|
+
}
|
|
281
290
|
},
|
|
282
291
|
"srp": {
|
|
283
292
|
"trust": {
|
|
@@ -485,8 +494,7 @@
|
|
|
485
494
|
"ratings": "Ratings"
|
|
486
495
|
},
|
|
487
496
|
"section": {
|
|
488
|
-
"similar": "Similar vehicles"
|
|
489
|
-
"unavailableSimilar": "Similar / comparable vehicles"
|
|
497
|
+
"similar": "Similar vehicles"
|
|
490
498
|
},
|
|
491
499
|
"breadcrumb": {
|
|
492
500
|
"home": "Home",
|
|
@@ -797,8 +805,7 @@
|
|
|
797
805
|
"serviceHistory": "Full service history",
|
|
798
806
|
"warranty": "Warranty",
|
|
799
807
|
"yes": "Yes",
|
|
800
|
-
"no": "No"
|
|
801
|
-
"notSpecified": "not specified"
|
|
808
|
+
"no": "No"
|
|
802
809
|
},
|
|
803
810
|
"common": {
|
|
804
811
|
"needsData": "Data coming soon"
|
package/locales/legacy/data.ts
CHANGED
|
@@ -103,8 +103,7 @@ export const vehicleProps = (car?: any, isOfferAvailable: boolean = true) => {
|
|
|
103
103
|
wltpDischargedCombinedLabel: `${getFormattedNumber(vehicleOption.wltpCombined != null ? vehicleOption.wltpCombined : 19.9)}l/100km (entladen, komb)`,
|
|
104
104
|
wltpCo2WtdCombinedShort: `${getFormattedNumber(vehicleOption.wltpCo2)}g CO2/km (gew., komb)*`,
|
|
105
105
|
co2ClassWeighted: `CO2-Klasse ${(cbd.cbd as any)[vehicleOption.wltpEnergyEfficiencyClass] || vehicleOption.wltpEnergyEfficiencyClass || ''} (gew., komb)`,
|
|
106
|
-
|
|
107
|
-
co2ClassDischarged: `CO2-Klasse ${(cbd.cbd as any)[vehicleOption.wltpDischargedEnergyEfficiencyClass] || vehicleOption.wltpDischargedEnergyEfficiencyClass || ''} (entladen, komb)`
|
|
106
|
+
co2ClassDischarged: `CO2-Klasse ${(cbd.cbd as any)[vehicleOption.wltpDischargedEnergyEfficiencyClass || 'selector_energyEfficiencyClass_g'] || ''} (entladen, komb)`
|
|
108
107
|
},
|
|
109
108
|
title: {
|
|
110
109
|
'addOfferToMainSlide': 'Zum Schieberegler hinzufügen',
|
package/package.json
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@bytebrand/fe-ui-core-autobahn",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "auto.de md3 (Autobahn) design system — UI primitives, cards, chrome, VDP modules, theme CSS and locales. Ships raw TypeScript source (like fe-ui-core before it); each consumer's bundler compiles it.",
|
|
5
|
-
"main": "index.ts",
|
|
6
|
-
"license": "UNLICENSED",
|
|
7
|
-
"peerDependencies": {
|
|
8
|
-
"react": "^18.0.0",
|
|
9
|
-
"react-dom": "^18.0.0"
|
|
10
|
-
},
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"@bytebrand/car-schema-selectors": "^2.0.7",
|
|
13
|
-
"@bytebrand/fe-financing": "^5.14.20",
|
|
14
|
-
"classnames": "2.2.6",
|
|
15
|
-
"clsx": "^2.1.1",
|
|
16
|
-
"d3-format": "1.4.5",
|
|
17
|
-
"js-cookie": "^2.2.0",
|
|
18
|
-
"lodash": "^4.17.21",
|
|
19
|
-
"lucide-react": "^0.288.0",
|
|
20
|
-
"mobx-react": "^7.6.0",
|
|
21
|
-
"moment": "^2.29.1",
|
|
22
|
-
"qs": "^6.6.0",
|
|
23
|
-
"react-device-detect": "^2.1.2",
|
|
24
|
-
"react-grid-system": "^5.0.2",
|
|
25
|
-
"react-lazyload": "^3.2.0",
|
|
26
|
-
"react-scroll": "^1.9.3",
|
|
27
|
-
"react-slick": "^0.29.0",
|
|
28
|
-
"slick-carousel": "1.8.1"
|
|
29
|
-
}
|
|
30
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@bytebrand/fe-ui-core-autobahn",
|
|
3
|
+
"version": "1.0.169",
|
|
4
|
+
"description": "auto.de md3 (Autobahn) design system — UI primitives, cards, chrome, VDP modules, theme CSS and locales. Ships raw TypeScript source (like fe-ui-core before it); each consumer's bundler compiles it.",
|
|
5
|
+
"main": "index.ts",
|
|
6
|
+
"license": "UNLICENSED",
|
|
7
|
+
"peerDependencies": {
|
|
8
|
+
"react": "^18.0.0",
|
|
9
|
+
"react-dom": "^18.0.0"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@bytebrand/car-schema-selectors": "^2.0.7",
|
|
13
|
+
"@bytebrand/fe-financing": "^5.14.20",
|
|
14
|
+
"classnames": "2.2.6",
|
|
15
|
+
"clsx": "^2.1.1",
|
|
16
|
+
"d3-format": "1.4.5",
|
|
17
|
+
"js-cookie": "^2.2.0",
|
|
18
|
+
"lodash": "^4.17.21",
|
|
19
|
+
"lucide-react": "^0.288.0",
|
|
20
|
+
"mobx-react": "^7.6.0",
|
|
21
|
+
"moment": "^2.29.1",
|
|
22
|
+
"qs": "^6.6.0",
|
|
23
|
+
"react-device-detect": "^2.1.2",
|
|
24
|
+
"react-grid-system": "^5.0.2",
|
|
25
|
+
"react-lazyload": "^3.2.0",
|
|
26
|
+
"react-scroll": "^1.9.3",
|
|
27
|
+
"react-slick": "^0.29.0",
|
|
28
|
+
"slick-carousel": "1.8.1"
|
|
29
|
+
}
|
|
30
|
+
}
|