@bytebrand/fe-ui-core-autobahn 1.0.211 → 1.0.212
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 +51 -13
- package/cards/CarRow.tsx +5 -1
- package/cards/cardParts.tsx +1368 -1358
- package/cards/types.ts +182 -182
- package/constants/app.ts +11 -1
- package/constants/core.ts +12 -1
- package/data/toAutobahnCar.ts +600 -600
- package/locales/de/autobahn.json +891 -891
- package/locales/en/autobahn.json +891 -891
- package/package.json +2 -2
- package/theme/md3.css +15678 -15857
- package/ui/CreditKeyFigures.tsx +244 -244
- package/ui/index.ts +96 -96
- package/vdp/FinanceCalculator.tsx +1148 -1148
- package/vdp/VdpModules.tsx +3869 -4480
- package/vdp/index.ts +0 -3
- package/vdp/types.ts +2 -12
package/cards/CarCard.tsx
CHANGED
|
@@ -38,6 +38,7 @@ import {
|
|
|
38
38
|
GalleryActivityPill,
|
|
39
39
|
cardSpec,
|
|
40
40
|
PaymentMode,
|
|
41
|
+
startPaymentMode,
|
|
41
42
|
callDealerSalesPhone,
|
|
42
43
|
DEALER_SALES_PHONE,
|
|
43
44
|
} from './cardParts';
|
|
@@ -98,6 +99,11 @@ export interface CarCardProps {
|
|
|
98
99
|
* (still onOpenRateAdjust).
|
|
99
100
|
*/
|
|
100
101
|
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;
|
|
101
107
|
}
|
|
102
108
|
|
|
103
109
|
const CarCard: React.FunctionComponent<CarCardProps> = ({
|
|
@@ -113,8 +119,9 @@ const CarCard: React.FunctionComponent<CarCardProps> = ({
|
|
|
113
119
|
onCall,
|
|
114
120
|
onOpenRateAdjust,
|
|
115
121
|
onShowFinancingDetails,
|
|
122
|
+
initialMode,
|
|
116
123
|
}) => {
|
|
117
|
-
const [mode, setMode] = useState<PaymentMode>(
|
|
124
|
+
const [mode, setMode] = useState<PaymentMode>(() => startPaymentMode(car, initialMode));
|
|
118
125
|
const [photoIndex, setPhotoIndex] = useState(0);
|
|
119
126
|
const [viewerOpen, setViewerOpen] = useState(false);
|
|
120
127
|
const mediaRef = useRef<HTMLDivElement | null>(null);
|
|
@@ -157,6 +164,8 @@ const CarCard: React.FunctionComponent<CarCardProps> = ({
|
|
|
157
164
|
// active that's already 3, so NEU is dropped rather than causing a 4th to overflow.
|
|
158
165
|
const activeDealChips = [showDrop || showSave, showPct, !!car.zeroDown].filter(Boolean).length;
|
|
159
166
|
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'];
|
|
160
169
|
return (
|
|
161
170
|
<article
|
|
162
171
|
className="mcard mcard--interactive cc-card"
|
|
@@ -279,21 +288,50 @@ const CarCard: React.FunctionComponent<CarCardProps> = ({
|
|
|
279
288
|
<div className="cc-price" style={{ marginTop: 0, borderTop: '1px solid var(--md-outline-variant)' }}>
|
|
280
289
|
<PriceTabs car={car} mode={mode} onModeChange={setMode} t={t} />
|
|
281
290
|
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 8, marginTop: 10 }}>
|
|
282
|
-
|
|
291
|
+
{/* every tab's hero stacked in one grid cell (.cc-hero-stack), only the active one
|
|
292
|
+
visible, bottom-aligned — Kaufen's struck list price sits on its own line above
|
|
293
|
+
the price, so without this the row (and the card) grew/shrank by that line on
|
|
294
|
+
every tab switch. Same trick as .cc-terms-stack below. */}
|
|
295
|
+
<div className="cc-hero-stack">
|
|
296
|
+
{paymentModes.map((m) => (
|
|
297
|
+
<div
|
|
298
|
+
key={m}
|
|
299
|
+
className={'cc-hero-slot' + (m === mode ? '' : ' cc-hero-slot--hidden')}
|
|
300
|
+
aria-hidden={m === mode ? undefined : true}
|
|
301
|
+
>
|
|
302
|
+
<PriceHero car={car} mode={m} t={t} alwaysShowUnit />
|
|
303
|
+
</div>
|
|
304
|
+
))}
|
|
305
|
+
</div>
|
|
283
306
|
<PriceEvalCol car={car} t={t} />
|
|
284
307
|
</div>
|
|
285
308
|
{/* same fallback CardCtaRow already uses below: pages that haven't wired a real
|
|
286
|
-
"Rate anpassen" sheet yet still get a working "Details" link (opens the car).
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
309
|
+
"Rate anpassen" sheet yet still get a working "Details" link (opens the car).
|
|
310
|
+
Every tab's terms line is rendered into the same grid cell (.cc-terms-stack) and
|
|
311
|
+
only the active one is visible — the cell is as tall as the tallest line, so the
|
|
312
|
+
card keeps one height across Finanzierung/Leasing/Kaufen (Leasing's longer line
|
|
313
|
+
wraps to 2 lines on narrow phones). No change to the visible line itself. */}
|
|
314
|
+
<div className="cc-terms-stack">
|
|
315
|
+
{paymentModes.map((m) => (
|
|
316
|
+
<div
|
|
317
|
+
key={m}
|
|
318
|
+
className={'cc-terms-slot' + (m === mode ? '' : ' cc-terms-slot--hidden')}
|
|
319
|
+
aria-hidden={m === mode ? undefined : true}
|
|
320
|
+
>
|
|
321
|
+
<PriceTerms
|
|
322
|
+
car={car}
|
|
323
|
+
mode={m}
|
|
324
|
+
onOpenRateAdjust={onOpenRateAdjust || (() => onOpen(car))}
|
|
325
|
+
onShowDetails={onShowFinancingDetails ? () => onShowFinancingDetails(car, m) : undefined}
|
|
326
|
+
t={t}
|
|
327
|
+
/>
|
|
328
|
+
{/* ADV-405/407 Kreditkosten-Hinweis under the financing/leasing conditions line. Inside the
|
|
329
|
+
slot, so the stack keeps one height across the tabs (no jump on Kaufen); hidden slots
|
|
330
|
+
are visibility:hidden + aria-hidden like their terms line. */}
|
|
331
|
+
{m !== 'buy' && <CreditCostNotice t={t} size="small" cls="cc-ccn" />}
|
|
332
|
+
</div>
|
|
333
|
+
))}
|
|
334
|
+
</div>
|
|
297
335
|
</div>
|
|
298
336
|
{/* Mobile-only row (CardCtaRow itself carries the show-mobile class) — always
|
|
299
337
|
rendered, with real fallbacks the page can override once it wires its own
|
package/cards/CarRow.tsx
CHANGED
|
@@ -41,6 +41,7 @@ import {
|
|
|
41
41
|
ZeroDownChip,
|
|
42
42
|
fmtKm,
|
|
43
43
|
PaymentMode,
|
|
44
|
+
startPaymentMode,
|
|
44
45
|
ratingTone,
|
|
45
46
|
} from './cardParts';
|
|
46
47
|
import { AutobahnCar } from './types';
|
|
@@ -80,6 +81,8 @@ export interface CarRowProps {
|
|
|
80
81
|
* links render as plain text (see PricePaths' own fallback).
|
|
81
82
|
*/
|
|
82
83
|
onShowFinancingDetails?: (car: AutobahnCar, mode: PaymentMode) => void;
|
|
84
|
+
/** Tab the mobile price tabs open on — see CarCard's identically-named prop. */
|
|
85
|
+
initialMode?: PaymentMode;
|
|
83
86
|
}
|
|
84
87
|
|
|
85
88
|
const CarRow: React.FunctionComponent<CarRowProps> = ({
|
|
@@ -92,8 +95,9 @@ const CarRow: React.FunctionComponent<CarRowProps> = ({
|
|
|
92
95
|
t,
|
|
93
96
|
adminAction,
|
|
94
97
|
onShowFinancingDetails,
|
|
98
|
+
initialMode,
|
|
95
99
|
}) => {
|
|
96
|
-
const [mode, setMode] = useState<PaymentMode>(
|
|
100
|
+
const [mode, setMode] = useState<PaymentMode>(() => startPaymentMode(car, initialMode));
|
|
97
101
|
const [photoIndex, setPhotoIndex] = useState(0);
|
|
98
102
|
const mediaRef = useRef<HTMLDivElement | null>(null);
|
|
99
103
|
// always call the LATEST onMediaEnter without re-arming the observer on every render (the
|