@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/cards/CarCard.tsx
CHANGED
|
@@ -38,7 +38,6 @@ import {
|
|
|
38
38
|
GalleryActivityPill,
|
|
39
39
|
cardSpec,
|
|
40
40
|
PaymentMode,
|
|
41
|
-
startPaymentMode,
|
|
42
41
|
callDealerSalesPhone,
|
|
43
42
|
DEALER_SALES_PHONE,
|
|
44
43
|
} from './cardParts';
|
|
@@ -99,11 +98,6 @@ export interface CarCardProps {
|
|
|
99
98
|
* (still onOpenRateAdjust).
|
|
100
99
|
*/
|
|
101
100
|
onShowFinancingDetails?: (car: AutobahnCar, mode: PaymentMode) => void;
|
|
102
|
-
/**
|
|
103
|
-
* Tab the price block opens on (default Finanzierung) — e.g. the SRP's leasing-only results
|
|
104
|
-
* open every card on Leasing. Ignored for a car without a lease rate (it has no Leasing tab).
|
|
105
|
-
*/
|
|
106
|
-
initialMode?: PaymentMode;
|
|
107
101
|
}
|
|
108
102
|
|
|
109
103
|
const CarCard: React.FunctionComponent<CarCardProps> = ({
|
|
@@ -119,9 +113,8 @@ const CarCard: React.FunctionComponent<CarCardProps> = ({
|
|
|
119
113
|
onCall,
|
|
120
114
|
onOpenRateAdjust,
|
|
121
115
|
onShowFinancingDetails,
|
|
122
|
-
initialMode,
|
|
123
116
|
}) => {
|
|
124
|
-
const [mode, setMode] = useState<PaymentMode>(
|
|
117
|
+
const [mode, setMode] = useState<PaymentMode>('financing');
|
|
125
118
|
const [photoIndex, setPhotoIndex] = useState(0);
|
|
126
119
|
const [viewerOpen, setViewerOpen] = useState(false);
|
|
127
120
|
const mediaRef = useRef<HTMLDivElement | null>(null);
|
|
@@ -164,8 +157,6 @@ const CarCard: React.FunctionComponent<CarCardProps> = ({
|
|
|
164
157
|
// active that's already 3, so NEU is dropped rather than causing a 4th to overflow.
|
|
165
158
|
const activeDealChips = [showDrop || showSave, showPct, !!car.zeroDown].filter(Boolean).length;
|
|
166
159
|
const showNeu = asGoodAsNew && car.isNew && activeDealChips < 3;
|
|
167
|
-
// tabs the price block can switch to (PriceTabs shows Leasing only when the car has a lease rate)
|
|
168
|
-
const paymentModes: PaymentMode[] = car.lease != null ? ['financing', 'leasing', 'buy'] : ['financing', 'buy'];
|
|
169
160
|
return (
|
|
170
161
|
<article
|
|
171
162
|
className="mcard mcard--interactive cc-card"
|
|
@@ -286,46 +277,18 @@ const CarCard: React.FunctionComponent<CarCardProps> = ({
|
|
|
286
277
|
<div className="cc-price" style={{ marginTop: 0, borderTop: '1px solid var(--md-outline-variant)' }}>
|
|
287
278
|
<PriceTabs car={car} mode={mode} onModeChange={setMode} t={t} />
|
|
288
279
|
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 8, marginTop: 10 }}>
|
|
289
|
-
{
|
|
290
|
-
visible, bottom-aligned — Kaufen's struck list price sits on its own line above
|
|
291
|
-
the price, so without this the row (and the card) grew/shrank by that line on
|
|
292
|
-
every tab switch. Same trick as .cc-terms-stack below. */}
|
|
293
|
-
<div className="cc-hero-stack">
|
|
294
|
-
{paymentModes.map((m) => (
|
|
295
|
-
<div
|
|
296
|
-
key={m}
|
|
297
|
-
className={'cc-hero-slot' + (m === mode ? '' : ' cc-hero-slot--hidden')}
|
|
298
|
-
aria-hidden={m === mode ? undefined : true}
|
|
299
|
-
>
|
|
300
|
-
<PriceHero car={car} mode={m} t={t} alwaysShowUnit />
|
|
301
|
-
</div>
|
|
302
|
-
))}
|
|
303
|
-
</div>
|
|
280
|
+
<PriceHero car={car} mode={mode} t={t} alwaysShowUnit />
|
|
304
281
|
<PriceEvalCol car={car} t={t} />
|
|
305
282
|
</div>
|
|
306
283
|
{/* same fallback CardCtaRow already uses below: pages that haven't wired a real
|
|
307
|
-
"Rate anpassen" sheet yet still get a working "Details" link (opens the car).
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
{
|
|
314
|
-
|
|
315
|
-
key={m}
|
|
316
|
-
className={'cc-terms-slot' + (m === mode ? '' : ' cc-terms-slot--hidden')}
|
|
317
|
-
aria-hidden={m === mode ? undefined : true}
|
|
318
|
-
>
|
|
319
|
-
<PriceTerms
|
|
320
|
-
car={car}
|
|
321
|
-
mode={m}
|
|
322
|
-
onOpenRateAdjust={onOpenRateAdjust || (() => onOpen(car))}
|
|
323
|
-
onShowDetails={onShowFinancingDetails ? () => onShowFinancingDetails(car, m) : undefined}
|
|
324
|
-
t={t}
|
|
325
|
-
/>
|
|
326
|
-
</div>
|
|
327
|
-
))}
|
|
328
|
-
</div>
|
|
284
|
+
"Rate anpassen" sheet yet still get a working "Details" link (opens the car). */}
|
|
285
|
+
<PriceTerms
|
|
286
|
+
car={car}
|
|
287
|
+
mode={mode}
|
|
288
|
+
onOpenRateAdjust={onOpenRateAdjust || (() => onOpen(car))}
|
|
289
|
+
onShowDetails={onShowFinancingDetails ? () => onShowFinancingDetails(car, mode) : undefined}
|
|
290
|
+
t={t}
|
|
291
|
+
/>
|
|
329
292
|
</div>
|
|
330
293
|
{/* Mobile-only row (CardCtaRow itself carries the show-mobile class) — always
|
|
331
294
|
rendered, with real fallbacks the page can override once it wires its own
|
package/cards/CarRow.tsx
CHANGED
|
@@ -41,7 +41,6 @@ import {
|
|
|
41
41
|
ZeroDownChip,
|
|
42
42
|
fmtKm,
|
|
43
43
|
PaymentMode,
|
|
44
|
-
startPaymentMode,
|
|
45
44
|
ratingTone,
|
|
46
45
|
} from './cardParts';
|
|
47
46
|
import { AutobahnCar } from './types';
|
|
@@ -81,8 +80,6 @@ export interface CarRowProps {
|
|
|
81
80
|
* links render as plain text (see PricePaths' own fallback).
|
|
82
81
|
*/
|
|
83
82
|
onShowFinancingDetails?: (car: AutobahnCar, mode: PaymentMode) => void;
|
|
84
|
-
/** Tab the mobile price tabs open on — see CarCard's identically-named prop. */
|
|
85
|
-
initialMode?: PaymentMode;
|
|
86
83
|
}
|
|
87
84
|
|
|
88
85
|
const CarRow: React.FunctionComponent<CarRowProps> = ({
|
|
@@ -95,9 +92,8 @@ const CarRow: React.FunctionComponent<CarRowProps> = ({
|
|
|
95
92
|
t,
|
|
96
93
|
adminAction,
|
|
97
94
|
onShowFinancingDetails,
|
|
98
|
-
initialMode,
|
|
99
95
|
}) => {
|
|
100
|
-
const [mode, setMode] = useState<PaymentMode>(
|
|
96
|
+
const [mode, setMode] = useState<PaymentMode>('financing');
|
|
101
97
|
const [photoIndex, setPhotoIndex] = useState(0);
|
|
102
98
|
const mediaRef = useRef<HTMLDivElement | null>(null);
|
|
103
99
|
// always call the LATEST onMediaEnter without re-arming the observer on every render (the
|
package/cards/cardParts.tsx
CHANGED
|
@@ -489,11 +489,6 @@ export const PriceEvalCol: React.FunctionComponent<{ car: AutobahnCar; t: Transl
|
|
|
489
489
|
|
|
490
490
|
export type PaymentMode = 'financing' | 'leasing' | 'buy';
|
|
491
491
|
|
|
492
|
-
/** The tab a card opens on: the requested one (default Finanzierung), but never Leasing for a car
|
|
493
|
-
* without a lease rate — PriceTabs has no Leasing tab for it. */
|
|
494
|
-
export const startPaymentMode = (car: AutobahnCar, requested?: PaymentMode): PaymentMode =>
|
|
495
|
-
requested === 'leasing' && car.lease == null ? 'financing' : requested || 'financing';
|
|
496
|
-
|
|
497
492
|
export interface PriceTabsProps {
|
|
498
493
|
car: AutobahnCar;
|
|
499
494
|
mode: PaymentMode;
|
|
@@ -715,12 +710,7 @@ export const PriceTerms: React.FunctionComponent<{
|
|
|
715
710
|
onShowDetails?: () => void;
|
|
716
711
|
t: TranslationFunction;
|
|
717
712
|
}> = ({ car, mode, onOpenRateAdjust, onShowDetails, t }) => {
|
|
718
|
-
|
|
719
|
-
// here, which collapsed .cc-terms to 0 height on that tab while Financing/Leasing rendered a
|
|
720
|
-
// real line, jumping the price row (and everything below it: rating pill, CTA row) up/down on
|
|
721
|
-
// every tab switch. Render an empty, still-present .cc-terms div instead — same fix as the VDP
|
|
722
|
-
// FinanceCalculator's .fin-cond (md3.css), which reserves its line's height the same way.
|
|
723
|
-
if (mode === 'buy') return <div className="cc-terms" />;
|
|
713
|
+
if (mode === 'buy') return null;
|
|
724
714
|
const finFirstInstallment =
|
|
725
715
|
car.finFirstInstallment != null ? car.finFirstInstallment.toLocaleString('de-DE') : _finFirstInstallment;
|
|
726
716
|
const finMonths = car.finMonths ?? _finMonths;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
export type AccountMenuIconName =
|
|
4
|
+
| 'layout-grid' | 'car-front' | 'bookmark' | 'star' | 'scale' | 'user' | 'help-circle' | 'log-out';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Row icons of the Konto menu (Figma "Konto / Kontomenü", 64243:14111): Lucide-style glyphs in a
|
|
8
|
+
* 22px frame with a 1.8px stroke, but with Figma's own geometry — e.g. its bookmark is narrower and
|
|
9
|
+
* square-cornered, unlike lucide-react 0.288's — so the paths are Figma's export, not the lib Icon.
|
|
10
|
+
* `at` moves each export to where Figma places it in the frame: the group inset minus half the stroke.
|
|
11
|
+
*/
|
|
12
|
+
const GLYPHS: Record<AccountMenuIconName, { at: [number, number]; d: string[] }> = {
|
|
13
|
+
'layout-grid': {
|
|
14
|
+
at: [1.85, 1.85],
|
|
15
|
+
d: [
|
|
16
|
+
'M1.81667 0.9H6.4C6.90626 0.9 7.31667 1.31041 7.31667 1.81667V6.4C7.31667 6.90626 6.90626 7.31667 6.4 7.31667H1.81667C1.31041 7.31667 0.9 6.90626 0.9 6.4V1.81667C0.9 1.31041 1.31041 0.9 1.81667 0.9Z',
|
|
17
|
+
'M11.9 0.9H16.4833C16.9896 0.9 17.4 1.31041 17.4 1.81667V6.4C17.4 6.90626 16.9896 7.31667 16.4833 7.31667H11.9C11.3937 7.31667 10.9833 6.90626 10.9833 6.4V1.81667C10.9833 1.31041 11.3937 0.9 11.9 0.9Z',
|
|
18
|
+
'M1.81667 10.9833H6.4C6.90626 10.9833 7.31667 11.3937 7.31667 11.9V16.4833C7.31667 16.9896 6.90626 17.4 6.4 17.4H1.81667C1.31041 17.4 0.9 16.9896 0.9 16.4833V11.9C0.9 11.3937 1.31041 10.9833 1.81667 10.9833Z',
|
|
19
|
+
'M11.9 10.9833H16.4833C16.9896 10.9833 17.4 11.3937 17.4 11.9V16.4833C17.4 16.9896 16.9896 17.4 16.4833 17.4H11.9C11.3937 17.4 10.9833 16.9896 10.9833 16.4833V11.9C10.9833 11.3937 11.3937 10.9833 11.9 10.9833Z',
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
'car-front': {
|
|
23
|
+
at: [1.85, 3.68333],
|
|
24
|
+
d: [
|
|
25
|
+
'M2.73333 6.4L4.10833 2.275C4.20846 1.88695 4.43297 1.5424 4.74752 1.29408C5.06206 1.04575 5.44931 0.907329 5.85 0.9H12.45C12.8507 0.907329 13.2379 1.04575 13.5525 1.29408C13.867 1.5424 14.0915 1.88695 14.1917 2.275L15.5667 6.4',
|
|
26
|
+
'M2.73333 6.4H15.5667C16.5792 6.4 17.4 7.22081 17.4 8.23333V10.9833C17.4 11.9959 16.5792 12.8167 15.5667 12.8167H2.73333C1.72081 12.8167 0.9 11.9959 0.9 10.9833V8.23333C0.9 7.22081 1.72081 6.4 2.73333 6.4Z',
|
|
27
|
+
'M4.56667 12.8167V14.65M13.7333 12.8167V14.65',
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
bookmark: {
|
|
31
|
+
at: [4.6, 1.85],
|
|
32
|
+
d: ['M0.9 0.9H11.9V17.4L6.4 13.275L0.9 17.4V0.9Z'],
|
|
33
|
+
},
|
|
34
|
+
star: {
|
|
35
|
+
at: [2.03333, 1.85],
|
|
36
|
+
d: ['M8.96669 0.9L11.4417 6.03333L17.0334 6.85833L13 10.8L13.9167 16.3917L8.96669 13.7333L4.01669 16.3917L4.93336 10.8L0.900026 6.85833L6.49169 6.03333L8.96669 0.9Z'],
|
|
37
|
+
},
|
|
38
|
+
scale: {
|
|
39
|
+
at: [1.85, 1.85],
|
|
40
|
+
d: [
|
|
41
|
+
'M9.15 0.9V4.56667M9.15 4.56667V17.4M9.15 4.56667H3.65M9.15 4.56667H14.65',
|
|
42
|
+
'M3.65 4.56667L0.900003 10.9833H6.4L3.65 4.56667ZM14.65 4.56667L11.9 10.9833H17.4L14.65 4.56667Z',
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
user: {
|
|
46
|
+
at: [2.76667, 2.76667],
|
|
47
|
+
d: [
|
|
48
|
+
'M11.9 4.56667C11.9 6.59171 10.2584 8.23333 8.23333 8.23333C6.20829 8.23333 4.56667 6.59171 4.56667 4.56667C4.56667 2.54162 6.20829 0.9 8.23333 0.9C10.2584 0.9 11.9 2.54162 11.9 4.56667Z',
|
|
49
|
+
'M0.9 16.4833C0.9 12.8167 4.2 10.9833 8.23333 10.9833C12.2667 10.9833 15.5667 12.8167 15.5667 16.4833',
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
'help-circle': {
|
|
53
|
+
at: [1.85, 1.85],
|
|
54
|
+
d: [
|
|
55
|
+
'M17.4 9.15C17.4 13.7063 13.7063 17.4 9.15 17.4C4.59365 17.4 0.9 13.7063 0.9 9.15C0.9 4.59365 4.59365 0.9 9.15 0.9C13.7063 0.9 17.4 4.59365 17.4 9.15Z',
|
|
56
|
+
'M6.85833 6.85833C6.84973 6.4229 6.96538 5.99402 7.19175 5.62195C7.41811 5.24988 7.74582 4.95001 8.13647 4.75748C8.52713 4.56495 8.96456 4.48772 9.39752 4.53485C9.83049 4.58197 10.2411 4.7515 10.5811 5.02357C10.9212 5.29564 11.1767 5.65898 11.3178 6.07104C11.4588 6.4831 11.4795 6.92681 11.3774 7.3502C11.2753 7.77359 11.0547 8.15913 10.7414 8.46165C10.4281 8.76417 10.035 8.97114 9.60833 9.05833V10.25',
|
|
57
|
+
'M9.15 13.7333H9.16',
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
'log-out': {
|
|
61
|
+
at: [1.85, 1.85],
|
|
62
|
+
d: [
|
|
63
|
+
'M6.4 17.4H2.73333C2.2471 17.4 1.78079 17.2068 1.43697 16.863C1.09315 16.5192 0.9 16.0529 0.9 15.5667V2.73333C0.9 2.2471 1.09315 1.78079 1.43697 1.43697C1.78079 1.09315 2.2471 0.9 2.73333 0.9H6.4',
|
|
64
|
+
'M12.8167 4.56667L17.4 9.15L12.8167 13.7333M17.4 9.15H6.4',
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const AccountMenuIcon: React.FunctionComponent<{ name: AccountMenuIconName }> = ({ name }) => {
|
|
70
|
+
const { at, d } = GLYPHS[name];
|
|
71
|
+
return (
|
|
72
|
+
<svg
|
|
73
|
+
className="acct-icon"
|
|
74
|
+
width="22"
|
|
75
|
+
height="22"
|
|
76
|
+
viewBox="0 0 22 22"
|
|
77
|
+
fill="none"
|
|
78
|
+
stroke="currentColor"
|
|
79
|
+
strokeWidth="1.8"
|
|
80
|
+
strokeLinecap="round"
|
|
81
|
+
strokeLinejoin="round"
|
|
82
|
+
aria-hidden="true"
|
|
83
|
+
>
|
|
84
|
+
<g transform={`translate(${at[0]} ${at[1]})`}>
|
|
85
|
+
{d.map((path) => <path key={path} d={path} />)}
|
|
86
|
+
</g>
|
|
87
|
+
</svg>
|
|
88
|
+
);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export default AccountMenuIcon;
|