@bytebrand/fe-ui-core-autobahn 1.0.213 → 1.0.214
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 +13 -51
- package/cards/CarRow.tsx +1 -5
- package/cards/cardParts.tsx +1 -11
- package/constants/app.ts +1 -11
- package/constants/core.ts +1 -12
- package/package.json +30 -30
- package/theme/md3.css +185 -6
- package/vdp/VdpModules.tsx +616 -5
- package/vdp/index.ts +3 -0
- package/vdp/types.ts +12 -2
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"
|
|
@@ -288,50 +279,21 @@ const CarCard: React.FunctionComponent<CarCardProps> = ({
|
|
|
288
279
|
<div className="cc-price" style={{ marginTop: 0, borderTop: '1px solid var(--md-outline-variant)' }}>
|
|
289
280
|
<PriceTabs car={car} mode={mode} onModeChange={setMode} t={t} />
|
|
290
281
|
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 8, marginTop: 10 }}>
|
|
291
|
-
{
|
|
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>
|
|
282
|
+
<PriceHero car={car} mode={mode} t={t} alwaysShowUnit />
|
|
306
283
|
<PriceEvalCol car={car} t={t} />
|
|
307
284
|
</div>
|
|
308
285
|
{/* same fallback CardCtaRow already uses below: pages that haven't wired a real
|
|
309
|
-
"Rate anpassen" sheet yet still get a working "Details" link (opens the car).
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
{
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
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>
|
|
286
|
+
"Rate anpassen" sheet yet still get a working "Details" link (opens the car). */}
|
|
287
|
+
<PriceTerms
|
|
288
|
+
car={car}
|
|
289
|
+
mode={mode}
|
|
290
|
+
onOpenRateAdjust={onOpenRateAdjust || (() => onOpen(car))}
|
|
291
|
+
onShowDetails={onShowFinancingDetails ? () => onShowFinancingDetails(car, mode) : undefined}
|
|
292
|
+
t={t}
|
|
293
|
+
/>
|
|
294
|
+
{/* ADV-405/407 Kreditkosten-Hinweis: below the conditions line, above the CTA row (mobile)
|
|
295
|
+
/ eco line (desktop); not on Kaufen, which shows no financing terms either. */}
|
|
296
|
+
{mode !== 'buy' && <CreditCostNotice t={t} size="small" cls="cc-ccn" />}
|
|
335
297
|
</div>
|
|
336
298
|
{/* Mobile-only row (CardCtaRow itself carries the show-mobile class) — always
|
|
337
299
|
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
|
@@ -521,11 +521,6 @@ export const PriceEvalCol: React.FunctionComponent<{ car: AutobahnCar; t: Transl
|
|
|
521
521
|
|
|
522
522
|
export type PaymentMode = 'financing' | 'leasing' | 'buy';
|
|
523
523
|
|
|
524
|
-
/** The tab a card opens on: the requested one (default Finanzierung), but never Leasing for a car
|
|
525
|
-
* without a lease rate — PriceTabs has no Leasing tab for it. */
|
|
526
|
-
export const startPaymentMode = (car: AutobahnCar, requested?: PaymentMode): PaymentMode =>
|
|
527
|
-
requested === 'leasing' && car.lease == null ? 'financing' : requested || 'financing';
|
|
528
|
-
|
|
529
524
|
export interface PriceTabsProps {
|
|
530
525
|
car: AutobahnCar;
|
|
531
526
|
mode: PaymentMode;
|
|
@@ -760,12 +755,7 @@ export const PriceTerms: React.FunctionComponent<{
|
|
|
760
755
|
onShowDetails?: () => void;
|
|
761
756
|
t: TranslationFunction;
|
|
762
757
|
}> = ({ car, mode, onOpenRateAdjust, onShowDetails, t }) => {
|
|
763
|
-
|
|
764
|
-
// here, which collapsed .cc-terms to 0 height on that tab while Financing/Leasing rendered a
|
|
765
|
-
// real line, jumping the price row (and everything below it: rating pill, CTA row) up/down on
|
|
766
|
-
// every tab switch. Render an empty, still-present .cc-terms div instead — same fix as the VDP
|
|
767
|
-
// FinanceCalculator's .fin-cond (md3.css), which reserves its line's height the same way.
|
|
768
|
-
if (mode === 'buy') return <div className="cc-terms" />;
|
|
758
|
+
if (mode === 'buy') return null;
|
|
769
759
|
const finFirstInstallment =
|
|
770
760
|
car.finFirstInstallment != null ? car.finFirstInstallment.toLocaleString('de-DE') : _finFirstInstallment;
|
|
771
761
|
const finMonths = car.finMonths ?? _finMonths;
|
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/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.
|
|
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.214",
|
|
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.31",
|
|
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
|
+
}
|
package/theme/md3.css
CHANGED
|
@@ -10105,8 +10105,7 @@ line-height: 31px;
|
|
|
10105
10105
|
z-index: 71;
|
|
10106
10106
|
background: var(--md-surface);
|
|
10107
10107
|
border-radius: var(--md-r-xl) var(--md-r-xl) 0 0;
|
|
10108
|
-
|
|
10109
|
-
max-height: 92%;
|
|
10108
|
+
max-height: 92vh;
|
|
10110
10109
|
display: flex;
|
|
10111
10110
|
flex-direction: column;
|
|
10112
10111
|
box-shadow: 0 -8px 30px rgba(16, 22, 42, 0.22);
|
|
@@ -12238,6 +12237,7 @@ color: #005CFF;
|
|
|
12238
12237
|
.md3 .hiw-section,
|
|
12239
12238
|
.md3 #vdp-kontakt,
|
|
12240
12239
|
.md3 #vdp-bewertungen,
|
|
12240
|
+
.md3 #vdp-preis,
|
|
12241
12241
|
.md3 .vdp-similar {
|
|
12242
12242
|
margin-top: 14px !important;
|
|
12243
12243
|
}
|
|
@@ -12250,6 +12250,187 @@ color: #005CFF;
|
|
|
12250
12250
|
border: 1px solid #D4DDE7;
|
|
12251
12251
|
box-shadow: none;
|
|
12252
12252
|
}
|
|
12253
|
+
.md3 #vdp-preis {
|
|
12254
|
+
padding: 0 !important;
|
|
12255
|
+
border: 1px solid #D4DDE7;
|
|
12256
|
+
box-shadow: none;
|
|
12257
|
+
}
|
|
12258
|
+
.md3 #vdp-preis h2 {
|
|
12259
|
+
padding: 22px 22px 0 !important;
|
|
12260
|
+
margin-top: 0;
|
|
12261
|
+
margin-bottom: 11px !important;
|
|
12262
|
+
font-family: Arial, Helvetica, Arimo, sans-serif;
|
|
12263
|
+
font-style: normal;
|
|
12264
|
+
font-weight: 700;
|
|
12265
|
+
font-size: 24px;
|
|
12266
|
+
line-height: 29px;
|
|
12267
|
+
color: #1d2a38;
|
|
12268
|
+
}
|
|
12269
|
+
.md3 #vdp-preis .fin-eval-bar {
|
|
12270
|
+
height: 9px;
|
|
12271
|
+
}
|
|
12272
|
+
.md3 #vdp-preis .fin-eval-seg:first-child {
|
|
12273
|
+
border-radius: 4px 0 0 4px;
|
|
12274
|
+
}
|
|
12275
|
+
.md3 #vdp-preis .fin-eval-seg:last-of-type {
|
|
12276
|
+
border-radius: 0 4px 4px 0;
|
|
12277
|
+
}
|
|
12278
|
+
.md3 #vdp-preis > div:first-of-type {
|
|
12279
|
+
padding-left: 22px;
|
|
12280
|
+
padding-right: 22px;
|
|
12281
|
+
}
|
|
12282
|
+
.md3 #vdp-preis > div:last-child {
|
|
12283
|
+
margin-top: 24px !important;
|
|
12284
|
+
}
|
|
12285
|
+
.md3 .fin-criteria-card {
|
|
12286
|
+
padding: 0 !important;
|
|
12287
|
+
margin: 0 10px;
|
|
12288
|
+
}
|
|
12289
|
+
.md3 .fin-criteria-card > button {
|
|
12290
|
+
padding: 13px 13px 25px 13px !important;
|
|
12291
|
+
}
|
|
12292
|
+
.md3 #vdp-preis .fin-criteria-card > button .md-title-sm {
|
|
12293
|
+
font-family: Arial, Helvetica, Arimo, sans-serif;
|
|
12294
|
+
font-style: normal;
|
|
12295
|
+
font-weight: 700;
|
|
12296
|
+
font-size: 13px !important;
|
|
12297
|
+
line-height: 18px;
|
|
12298
|
+
color: #1d2a38;
|
|
12299
|
+
}
|
|
12300
|
+
.md3 .fin-criteria-card > button > svg:last-child {
|
|
12301
|
+
stroke-width: 2.6px !important;
|
|
12302
|
+
}
|
|
12303
|
+
.md3 .fin-criteria-card > button > svg:last-child path {
|
|
12304
|
+
stroke-width: 2.6px !important;
|
|
12305
|
+
}
|
|
12306
|
+
.md3 .fin-criteria-card .fin-criteria-grid {
|
|
12307
|
+
padding: 0 10px 20px 13px !important;
|
|
12308
|
+
column-gap: 10px !important;
|
|
12309
|
+
row-gap: 14px !important;
|
|
12310
|
+
}
|
|
12311
|
+
.md3 .fin-criteria-card .fin-criteria-icon-grid {
|
|
12312
|
+
padding-top: 13px !important;
|
|
12313
|
+
}
|
|
12314
|
+
.md3 .fin-criteria-card .fin-criteria-grid svg {
|
|
12315
|
+
width: 28px;
|
|
12316
|
+
height: 28px;
|
|
12317
|
+
}
|
|
12318
|
+
.md3 .fin-criteria-card .fin-criteria-grid > div {
|
|
12319
|
+
gap: 3px !important;
|
|
12320
|
+
}
|
|
12321
|
+
.md3 .fin-criteria-card .fin-criteria-grid > div.fin-criteria-tier-row {
|
|
12322
|
+
gap: 12px !important;
|
|
12323
|
+
}
|
|
12324
|
+
.md3 .fin-criteria-card .fin-criteria-grid svg[viewBox="0 0 21 21"] {
|
|
12325
|
+
width: 21px;
|
|
12326
|
+
height: 21px;
|
|
12327
|
+
}
|
|
12328
|
+
.md3 #vdp-preis .fin-criteria-card .md-label-sm {
|
|
12329
|
+
font-family: Arial, Helvetica, Arimo, sans-serif;
|
|
12330
|
+
font-style: normal;
|
|
12331
|
+
font-weight: 400;
|
|
12332
|
+
font-size: 10.3px;
|
|
12333
|
+
line-height: 14px;
|
|
12334
|
+
color: #5b6b7f;
|
|
12335
|
+
}
|
|
12336
|
+
.md3 #vdp-preis .fin-criteria-card .md-title-sm {
|
|
12337
|
+
font-family: Arial, Helvetica, Arimo, sans-serif;
|
|
12338
|
+
font-style: normal;
|
|
12339
|
+
font-weight: 700;
|
|
12340
|
+
font-size: 10.3px !important;
|
|
12341
|
+
line-height: 14px;
|
|
12342
|
+
color: #1d2a38;
|
|
12343
|
+
}
|
|
12344
|
+
.md3 .fin-criteria-note {
|
|
12345
|
+
margin: 0;
|
|
12346
|
+
padding: 0 13px 20px;
|
|
12347
|
+
font-family: Arial, Helvetica, Arimo, sans-serif;
|
|
12348
|
+
font-style: normal;
|
|
12349
|
+
font-weight: 400;
|
|
12350
|
+
font-size: 10px;
|
|
12351
|
+
line-height: 14px;
|
|
12352
|
+
color: #5b6b7f;
|
|
12353
|
+
}
|
|
12354
|
+
.md3 .fin-criteria-divider {
|
|
12355
|
+
width: 310px;
|
|
12356
|
+
height: 1px;
|
|
12357
|
+
background: #e6ecf3;
|
|
12358
|
+
margin: 0 auto;
|
|
12359
|
+
}
|
|
12360
|
+
.md3 #vdp-preis > div:last-child > button {
|
|
12361
|
+
font-family: Arial, Helvetica, Arimo, sans-serif;
|
|
12362
|
+
font-style: normal;
|
|
12363
|
+
font-weight: 700 !important;
|
|
12364
|
+
font-size: 13px !important;
|
|
12365
|
+
line-height: 18px;
|
|
12366
|
+
color: #005cff !important;
|
|
12367
|
+
padding-left: 22px !important;
|
|
12368
|
+
padding-right: 22px !important;
|
|
12369
|
+
}
|
|
12370
|
+
.md3 #vdp-preis > div:last-child > button .lucide {
|
|
12371
|
+
width: 18px;
|
|
12372
|
+
height: 18px;
|
|
12373
|
+
margin-left: auto;
|
|
12374
|
+
stroke-width: 2.6px !important;
|
|
12375
|
+
}
|
|
12376
|
+
.md3 #vdp-preis > div:last-child > button .lucide path {
|
|
12377
|
+
stroke-width: 2.6px !important;
|
|
12378
|
+
}
|
|
12379
|
+
.md3 #vdp-preis .fin-eval-thumb {
|
|
12380
|
+
width: 26px;
|
|
12381
|
+
height: 26px;
|
|
12382
|
+
background: #ffffff;
|
|
12383
|
+
border-width: 2px;
|
|
12384
|
+
border-radius: 13px;
|
|
12385
|
+
}
|
|
12386
|
+
.md3 #vdp-preis .fin-eval-thumb--good {
|
|
12387
|
+
border-color: #66b84d !important;
|
|
12388
|
+
}
|
|
12389
|
+
.md3 #vdp-preis .md-label-sm {
|
|
12390
|
+
font-family: Arial, Helvetica, Arimo, sans-serif;
|
|
12391
|
+
font-style: normal;
|
|
12392
|
+
font-weight: 400;
|
|
12393
|
+
font-size: 11.5px;
|
|
12394
|
+
line-height: 15px;
|
|
12395
|
+
color: #5b6b7f;
|
|
12396
|
+
}
|
|
12397
|
+
.md3 .fin-eval-good-badge {
|
|
12398
|
+
margin-top: 25px !important;
|
|
12399
|
+
height: 56px;
|
|
12400
|
+
width: 100%;
|
|
12401
|
+
box-sizing: border-box;
|
|
12402
|
+
background: #dff3e5 !important;
|
|
12403
|
+
border: 1px solid #a9e0b9;
|
|
12404
|
+
border-radius: 12px !important;
|
|
12405
|
+
padding-left: 22px !important;
|
|
12406
|
+
padding-right: 22px !important;
|
|
12407
|
+
}
|
|
12408
|
+
.md3 .fin-eval-good-badge svg {
|
|
12409
|
+
width: 18px;
|
|
12410
|
+
height: 18px;
|
|
12411
|
+
stroke: #66b84d;
|
|
12412
|
+
}
|
|
12413
|
+
.md3 .fin-eval-good-badge span {
|
|
12414
|
+
font-family: Arial, Helvetica, Arimo, sans-serif;
|
|
12415
|
+
font-style: normal;
|
|
12416
|
+
font-weight: 700 !important;
|
|
12417
|
+
font-size: 13px !important;
|
|
12418
|
+
line-height: 18px;
|
|
12419
|
+
color: #66b84d !important;
|
|
12420
|
+
}
|
|
12421
|
+
.md3 #vdp-preis > p {
|
|
12422
|
+
margin-top: 0;
|
|
12423
|
+
padding-top: 0;
|
|
12424
|
+
padding-left: 22px;
|
|
12425
|
+
padding-right: 22px;
|
|
12426
|
+
margin-bottom: 10px !important;
|
|
12427
|
+
font-family: Arial, Helvetica, Arimo, sans-serif;
|
|
12428
|
+
font-style: normal;
|
|
12429
|
+
font-weight: 400;
|
|
12430
|
+
font-size: 13px;
|
|
12431
|
+
line-height: 18px;
|
|
12432
|
+
color: #5b6b7f;
|
|
12433
|
+
}
|
|
12253
12434
|
.md3 #vdp-bewertungen > div:first-child {
|
|
12254
12435
|
gap: 26px !important;
|
|
12255
12436
|
margin-bottom: 28px !important;
|
|
@@ -14082,8 +14263,7 @@ color: #005CFF;
|
|
|
14082
14263
|
flex-direction: column;
|
|
14083
14264
|
width: 100%;
|
|
14084
14265
|
max-width: 560px;
|
|
14085
|
-
|
|
14086
|
-
max-height: 100%;
|
|
14266
|
+
max-height: calc(100vh - 32px);
|
|
14087
14267
|
background: var(--md-sc-lowest, #fff);
|
|
14088
14268
|
color: var(--md-on-surface);
|
|
14089
14269
|
border-radius: var(--md-r-lg);
|
|
@@ -14229,8 +14409,7 @@ color: #005CFF;
|
|
|
14229
14409
|
}
|
|
14230
14410
|
.md3 .mmodal {
|
|
14231
14411
|
max-width: 100%;
|
|
14232
|
-
|
|
14233
|
-
max-height: 92%;
|
|
14412
|
+
max-height: 92vh;
|
|
14234
14413
|
border-radius: var(--md-r-lg) var(--md-r-lg) 0 0;
|
|
14235
14414
|
border-bottom: 0;
|
|
14236
14415
|
animation: mmodal-sheet-up 0.25s ease-out;
|
package/vdp/VdpModules.tsx
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
//
|
|
9
9
|
// Replaces the design kit's globals:
|
|
10
10
|
// - `window.CO2_CLASSES` / `window.CO2_COLORS` → ../constants
|
|
11
|
-
// - `equipFor(id)` / market band
|
|
11
|
+
// - `equipFor(id)` / `car.priceHistory` / market band → typed props on VehicleDetail
|
|
12
12
|
// - `assetUrl(...)` → pre-resolved image URLs (caller's job)
|
|
13
13
|
// - `data-lucide` icons → the ui kit's <Icon />
|
|
14
14
|
// The DealerBlock from CdpModules is intentionally NOT ported (auto.de is the
|
|
@@ -16,9 +16,8 @@
|
|
|
16
16
|
//
|
|
17
17
|
// NEEDS-DATA discipline (the point of the ticket): wherever the design showed a
|
|
18
18
|
// figure we have no real source for, these render the NEEDS_DATA_LABEL
|
|
19
|
-
// ('Daten folgt') marker rather than inventing a value
|
|
20
|
-
//
|
|
21
|
-
// VehicleDetailedNextPage/PriceMarket.
|
|
19
|
+
// ('Daten folgt') marker rather than inventing a value — see PriceHistory (whole
|
|
20
|
+
// card) and its market band.
|
|
22
21
|
//
|
|
23
22
|
// All components render correctly only inside a `<div className="md3">` subtree.
|
|
24
23
|
|
|
@@ -28,10 +27,29 @@ import { TranslationFunction } from '../types';
|
|
|
28
27
|
import { Button, CreditCostNotice, CreditKeyFigures, Dropdown, DropdownOption, hasCreditKeyFigures, Icon, Modal, Spec, StatChip, Stars } from '../ui';
|
|
29
28
|
import type { CreditKeyFiguresData } from '../ui';
|
|
30
29
|
import { CO2_CLASSES, CO2_COLORS, TIER_LABELS, TIER_KEYS, TIER_COLORS, TIER_BACKGROUNDS } from '../constants';
|
|
31
|
-
import { defaultVdpSpecs, EquipmentGroups, VehicleDetail, VdpSpec, VdpReview, RatingPortal, RunningCostRow, EnergyTaxSummary } from './types';
|
|
30
|
+
import { defaultVdpSpecs, EquipmentGroups, PriceRatingBands, VehicleDetail, VdpSpec, VdpReview, RatingPortal, RunningCostRow, EnergyTaxSummary } from './types';
|
|
32
31
|
import { AddServicesTooltipBody, CalcRow, DocCheckIcon, EvalBar, expanderBtnStyle, FinanceMode, Slider, TermChips, ToggleRow } from './FinanceCalculator';
|
|
33
32
|
import { formatEur as eur, formatEurCents as eurCents, formatPct as pct } from '../utils/financeFormat';
|
|
34
33
|
|
|
34
|
+
/** Figma "check with open arc" glyph (modern lucide circle-check-big; the bundled lucide
|
|
35
|
+
* 0.288 only ships the closed-circle variant, so the two paths are inlined). */
|
|
36
|
+
const ArcCheckIcon: React.FunctionComponent<{ size?: number; color?: string }> = ({ size = 20, color = 'currentColor' }) => (
|
|
37
|
+
<svg
|
|
38
|
+
width={size}
|
|
39
|
+
height={size}
|
|
40
|
+
viewBox="0 0 24 24"
|
|
41
|
+
fill="none"
|
|
42
|
+
stroke={color}
|
|
43
|
+
strokeWidth={2.4}
|
|
44
|
+
strokeLinecap="round"
|
|
45
|
+
strokeLinejoin="round"
|
|
46
|
+
style={{ flex: 'none' }}
|
|
47
|
+
>
|
|
48
|
+
<path d="M21.801 10A10 10 0 1 1 17 3.335" />
|
|
49
|
+
<path d="m9 11 3 3L22 4" />
|
|
50
|
+
</svg>
|
|
51
|
+
);
|
|
52
|
+
|
|
35
53
|
/** mileage → 'X.XXX km' (de-DE grouping). */
|
|
36
54
|
function fmtKm(n: number): string {
|
|
37
55
|
return `${n.toLocaleString('de-DE')} km`;
|
|
@@ -783,6 +801,599 @@ export const TrustStrip: React.FunctionComponent<TrustStripProps> = ({ items, t
|
|
|
783
801
|
</div>
|
|
784
802
|
);
|
|
785
803
|
|
|
804
|
+
// ---------------------------------------------------------------------------
|
|
805
|
+
// Price history + market band (NEEDS-DATA by default)
|
|
806
|
+
// ---------------------------------------------------------------------------
|
|
807
|
+
|
|
808
|
+
export interface PriceHistoryProps {
|
|
809
|
+
vehicle: VehicleDetail;
|
|
810
|
+
/** i18n function (drilled from the page). */
|
|
811
|
+
t: TranslationFunction;
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
/**
|
|
815
|
+
* Price-history sparkline + market-value position bar.
|
|
816
|
+
*
|
|
817
|
+
* NEEDS-DATA: the sparkline needs `priceHistory` (with at least two points) and
|
|
818
|
+
* the position bar needs the full market band (`marketLow` / `marketAvg` /
|
|
819
|
+
* `marketHigh`). Either section that lacks real data renders the
|
|
820
|
+
* NEEDS_DATA_LABEL ('Daten folgt') marker — we never draw a fake trend or
|
|
821
|
+
* position. Both are needs-data by default, so until W3b supplies them this card
|
|
822
|
+
* shows the markers.
|
|
823
|
+
*/
|
|
824
|
+
export const PriceHistory: React.FunctionComponent<PriceHistoryProps> = ({ vehicle, t }) => {
|
|
825
|
+
const pts = vehicle.priceHistory;
|
|
826
|
+
const hasHistory = !!pts && pts.length >= 2;
|
|
827
|
+
const hasMarket =
|
|
828
|
+
vehicle.marketLow != null &&
|
|
829
|
+
vehicle.marketAvg != null &&
|
|
830
|
+
vehicle.marketHigh != null &&
|
|
831
|
+
vehicle.marketHigh > vehicle.marketLow;
|
|
832
|
+
|
|
833
|
+
// Nothing real to show yet — hide the whole card instead of rendering stubs.
|
|
834
|
+
if (!hasHistory && !hasMarket) return null;
|
|
835
|
+
|
|
836
|
+
// --- history sparkline (only when real points exist) ---
|
|
837
|
+
let historyBlock: React.ReactNode;
|
|
838
|
+
if (hasHistory) {
|
|
839
|
+
const prices = pts!.map((p) => p.price);
|
|
840
|
+
const lo = Math.min(...prices);
|
|
841
|
+
const hi = Math.max(...prices);
|
|
842
|
+
const W = 280;
|
|
843
|
+
const H = 70;
|
|
844
|
+
const x = (i: number) => (i / (pts!.length - 1)) * W;
|
|
845
|
+
const y = (p: number) => H - ((p - lo) / (hi - lo || 1)) * H;
|
|
846
|
+
const last = pts![pts!.length - 1];
|
|
847
|
+
const line = pts!.map((p, i) => `${i === 0 ? 'M' : 'L'} ${x(i).toFixed(1)} ${y(p.price).toFixed(1)}`).join(' ');
|
|
848
|
+
const area = `${line} L ${W} ${H} L 0 ${H} Z`;
|
|
849
|
+
const drop = vehicle.listPrice != null ? vehicle.listPrice - vehicle.price : null;
|
|
850
|
+
historyBlock = (
|
|
851
|
+
<div>
|
|
852
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: 8, marginBottom: 10 }}>
|
|
853
|
+
{drop != null && drop > 0 ? (
|
|
854
|
+
<>
|
|
855
|
+
<StatChip tone="good" icon="trending-down">
|
|
856
|
+
{t('autobahn:priceHistory.dropAmount', { amount: eur(drop) })}
|
|
857
|
+
</StatChip>
|
|
858
|
+
<span className="md-label-sm">{t('autobahn:priceHistory.sinceListing')}</span>
|
|
859
|
+
</>
|
|
860
|
+
) : (
|
|
861
|
+
<span className="md-label-sm">{t('autobahn:priceHistory.label')}</span>
|
|
862
|
+
)}
|
|
863
|
+
</div>
|
|
864
|
+
<svg viewBox={`0 0 ${W} ${H}`} width="100%" height="78" preserveAspectRatio="none" style={{ overflow: 'visible' }}>
|
|
865
|
+
<defs>
|
|
866
|
+
<linearGradient id="phg" x1="0" y1="0" x2="0" y2="1">
|
|
867
|
+
<stop offset="0%" stopColor="var(--md-primary)" stopOpacity=".22" />
|
|
868
|
+
<stop offset="100%" stopColor="var(--md-primary)" stopOpacity="0" />
|
|
869
|
+
</linearGradient>
|
|
870
|
+
</defs>
|
|
871
|
+
<path d={area} fill="url(#phg)" />
|
|
872
|
+
<path d={line} fill="none" stroke="var(--md-primary)" strokeWidth="2.5" strokeLinejoin="round" strokeLinecap="round" />
|
|
873
|
+
<circle cx={x(pts!.length - 1)} cy={y(last.price)} r="4.5" fill="var(--md-primary)" stroke="#fff" strokeWidth="2" />
|
|
874
|
+
</svg>
|
|
875
|
+
<div style={{ display: 'flex', justifyContent: 'space-between', marginTop: 4 }}>
|
|
876
|
+
<span className="md-label-sm">{pts![0].label}</span>
|
|
877
|
+
<span className="md-label-sm">{last.label}</span>
|
|
878
|
+
</div>
|
|
879
|
+
</div>
|
|
880
|
+
);
|
|
881
|
+
} else {
|
|
882
|
+
historyBlock = (
|
|
883
|
+
<div>
|
|
884
|
+
<div className="md-title-sm" style={{ marginBottom: 12 }}>
|
|
885
|
+
{t('autobahn:priceHistory.title')}
|
|
886
|
+
</div>
|
|
887
|
+
<p className="md-body-sm" style={{ margin: 0, fontStyle: 'italic', color: 'var(--md-on-surface-variant)' }}>
|
|
888
|
+
{t('autobahn:common.needsData')}
|
|
889
|
+
</p>
|
|
890
|
+
</div>
|
|
891
|
+
);
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
// --- market-value position (only when the full band exists) ---
|
|
895
|
+
let marketBlock: React.ReactNode;
|
|
896
|
+
if (hasMarket) {
|
|
897
|
+
const mpos = Math.max(
|
|
898
|
+
0,
|
|
899
|
+
Math.min(1, (vehicle.price - vehicle.marketLow!) / (vehicle.marketHigh! - vehicle.marketLow!)),
|
|
900
|
+
);
|
|
901
|
+
// marketAvg is the raw ML-predicted price (a float, e.g. 14284.277) — round before display,
|
|
902
|
+
// else eur()'s toLocaleString prints the fractional part as a bogus "1.035,277 €".
|
|
903
|
+
const delta = Math.round(vehicle.marketAvg! - vehicle.price);
|
|
904
|
+
marketBlock = (
|
|
905
|
+
<div>
|
|
906
|
+
<div className="md-title-sm" style={{ marginBottom: 12 }}>
|
|
907
|
+
{t('autobahn:marketValue.heading')}
|
|
908
|
+
</div>
|
|
909
|
+
{/* segmented tier bar (Figma — discrete colors, not a gradient), continuous marker;
|
|
910
|
+
ring color follows the car's actual rating tone */}
|
|
911
|
+
<EvalBar
|
|
912
|
+
tier={{ top: 0, good: 1, fair: 2, raised: 3, high: 4 }[vehicle.rating as 'top' | 'good' | 'fair' | 'raised' | 'high'] ?? 2}
|
|
913
|
+
leftPct={mpos * 100}
|
|
914
|
+
/>
|
|
915
|
+
<div style={{ display: 'flex', justifyContent: 'space-between', marginTop: 8 }}>
|
|
916
|
+
<span className="md-label-sm">{eur(vehicle.marketLow!)} €</span>
|
|
917
|
+
<span className="md-label-sm">{eur(vehicle.marketHigh!)} €</span>
|
|
918
|
+
</div>
|
|
919
|
+
{delta > 0 && (
|
|
920
|
+
<div
|
|
921
|
+
className="fin-eval-good-badge"
|
|
922
|
+
style={{
|
|
923
|
+
display: 'flex',
|
|
924
|
+
alignItems: 'center',
|
|
925
|
+
gap: 18,
|
|
926
|
+
marginTop: 12,
|
|
927
|
+
padding: '13px 14px',
|
|
928
|
+
borderRadius: 'var(--md-r-sm)',
|
|
929
|
+
background: 'var(--md-good-container)',
|
|
930
|
+
}}
|
|
931
|
+
>
|
|
932
|
+
<ArcCheckIcon size={20} color="var(--md-good)" />
|
|
933
|
+
<span style={{ fontSize: 14, fontWeight: 700, color: 'var(--md-good)' }}>
|
|
934
|
+
{t('autobahn:marketValue.belowAverage', { rating: t('autobahn:tier.' + vehicle.rating), amount: eur(delta) })}
|
|
935
|
+
</span>
|
|
936
|
+
</div>
|
|
937
|
+
)}
|
|
938
|
+
</div>
|
|
939
|
+
);
|
|
940
|
+
} else {
|
|
941
|
+
marketBlock = (
|
|
942
|
+
<div>
|
|
943
|
+
<div className="md-title-sm" style={{ marginBottom: 12 }}>
|
|
944
|
+
{t('autobahn:marketValue.heading')}
|
|
945
|
+
</div>
|
|
946
|
+
<p className="md-body-sm" style={{ margin: 0, fontStyle: 'italic', color: 'var(--md-on-surface-variant)' }}>
|
|
947
|
+
{t('autobahn:common.needsData')}
|
|
948
|
+
</p>
|
|
949
|
+
</div>
|
|
950
|
+
);
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
// mobile-only (2026-07-17 round 10 decision): the real market-value gauge is scoped to
|
|
954
|
+
// phone widths for now — desktop keeps its exact pre-existing needs-data behaviour
|
|
955
|
+
// (hidden unless a real price-history sparkline exists) by rendering the ORIGINAL
|
|
956
|
+
// hide-mobile grid unconditionally, so it stays byte-identical whenever hasHistory is
|
|
957
|
+
// false (today, always). Once priceHistory gets a real source, both paths coexist fine.
|
|
958
|
+
const mobileOnlyMarket = hasMarket && !hasHistory;
|
|
959
|
+
|
|
960
|
+
return (
|
|
961
|
+
<div className={'mcard' + (mobileOnlyMarket ? ' show-mobile' : '')} id="vdp-preis" style={{ padding: 22, ...(mobileOnlyMarket ? { flexDirection: 'column' } : {}) }}>
|
|
962
|
+
<h2 className="md-headline-sm" style={{ marginBottom: 4 }}>
|
|
963
|
+
{t('autobahn:priceMarket.heading')}
|
|
964
|
+
</h2>
|
|
965
|
+
<p className="md-body-sm" style={{ marginBottom: 18 }}>
|
|
966
|
+
{t('autobahn:priceMarket.description')}
|
|
967
|
+
</p>
|
|
968
|
+
{mobileOnlyMarket ? (
|
|
969
|
+
<>
|
|
970
|
+
{marketBlock}
|
|
971
|
+
<PriceRatingBreakdown vehicle={vehicle} t={t} />
|
|
972
|
+
<p
|
|
973
|
+
style={{
|
|
974
|
+
paddingTop: 10,
|
|
975
|
+
paddingBottom: 10,
|
|
976
|
+
fontFamily: 'Arial, Helvetica, Arimo, sans-serif',
|
|
977
|
+
fontWeight: 400,
|
|
978
|
+
fontSize: 9,
|
|
979
|
+
lineHeight: '14px',
|
|
980
|
+
color: '#5B6B7F',
|
|
981
|
+
}}
|
|
982
|
+
>
|
|
983
|
+
Alle Preise inkl. MwSt. | Stand: heute | Quelle: auto.de Marktwertanalyse
|
|
984
|
+
</p>
|
|
985
|
+
</>
|
|
986
|
+
) : (
|
|
987
|
+
<div className="pmv-grid hide-mobile">
|
|
988
|
+
{historyBlock}
|
|
989
|
+
{marketBlock}
|
|
990
|
+
</div>
|
|
991
|
+
)}
|
|
992
|
+
</div>
|
|
993
|
+
);
|
|
994
|
+
};
|
|
995
|
+
|
|
996
|
+
// ---------------------------------------------------------------------------
|
|
997
|
+
// "Details zur Preisbewertung" expandable — criteria grid + 5-tier band list
|
|
998
|
+
// (mobile-only, round 10; real data — see toVehicleDetail's getPriceRatingConfig call)
|
|
999
|
+
// ---------------------------------------------------------------------------
|
|
1000
|
+
|
|
1001
|
+
/** [tier key, text color, badge background, badge font-size]. Order matches the Figma "Bewertungskategorien" list. */
|
|
1002
|
+
const RATING_TIERS: ReadonlyArray<readonly [keyof PriceRatingBands, string, string, number]> = [
|
|
1003
|
+
['topPrice', '#168A45', '#DFF3E5', 12],
|
|
1004
|
+
['goodPrice', '#66B84D', '#E4F3DF', 12],
|
|
1005
|
+
['fairPrice', '#FFB800', '#FFF6DB', 12],
|
|
1006
|
+
['increasedPrice', '#F26B43', '#FFEFD5', 10.4],
|
|
1007
|
+
['highPrice', '#E60000', '#FFD3D3', 10.4],
|
|
1008
|
+
];
|
|
1009
|
+
|
|
1010
|
+
/** collapsible sub-card header (blue icon + bold title + chevron) — Figma round 12. */
|
|
1011
|
+
const BreakdownCardHead: React.FunctionComponent<{
|
|
1012
|
+
icon: string;
|
|
1013
|
+
title: string;
|
|
1014
|
+
open: boolean;
|
|
1015
|
+
onToggle: () => void;
|
|
1016
|
+
}> = ({ icon, title, open, onToggle }) => (
|
|
1017
|
+
<button
|
|
1018
|
+
type="button"
|
|
1019
|
+
onClick={onToggle}
|
|
1020
|
+
style={{
|
|
1021
|
+
display: 'flex',
|
|
1022
|
+
alignItems: 'center',
|
|
1023
|
+
gap: 10,
|
|
1024
|
+
width: '100%',
|
|
1025
|
+
background: 'none',
|
|
1026
|
+
border: 0,
|
|
1027
|
+
padding: 0,
|
|
1028
|
+
cursor: 'pointer',
|
|
1029
|
+
font: 'inherit',
|
|
1030
|
+
textAlign: 'left',
|
|
1031
|
+
}}
|
|
1032
|
+
>
|
|
1033
|
+
<Icon name={icon} size={19} color="var(--md-primary)" stroke={2} style={{ flex: 'none' }} />
|
|
1034
|
+
<span className="md-title-sm" style={{ flex: 1, minWidth: 0, fontSize: 15 }}>
|
|
1035
|
+
{title}
|
|
1036
|
+
</span>
|
|
1037
|
+
<Icon name={open ? 'chevron-up' : 'chevron-down'} size={18} color="var(--md-primary)" style={{ flex: 'none' }} />
|
|
1038
|
+
</button>
|
|
1039
|
+
);
|
|
1040
|
+
|
|
1041
|
+
const PriceRatingBreakdown: React.FunctionComponent<{ vehicle: VehicleDetail; t: TranslationFunction }> = ({ vehicle, t }) => {
|
|
1042
|
+
const [open, setOpen] = useState(false);
|
|
1043
|
+
const [criteriaOpen, setCriteriaOpen] = useState(true);
|
|
1044
|
+
const [categoriesOpen, setCategoriesOpen] = useState(true);
|
|
1045
|
+
const bands = vehicle.priceRatingBands;
|
|
1046
|
+
if (!bands) return null;
|
|
1047
|
+
|
|
1048
|
+
const totalEquipment = Object.values(vehicle.equipment || {}).reduce((s, a) => s + a.length, 0);
|
|
1049
|
+
const allCriteria: ReadonlyArray<readonly [icon: string, label: string, value: string]> = [
|
|
1050
|
+
['car-front', t('autobahn:priceMarket.criteria.makeModel'), `${vehicle.make} ${vehicle.model}`],
|
|
1051
|
+
['cog', t('autobahn:priceMarket.criteria.gear'), vehicle.gear],
|
|
1052
|
+
['calendar', t('autobahn:priceMarket.criteria.reg'), vehicle.reg],
|
|
1053
|
+
['droplet', t('autobahn:priceMarket.criteria.cons'), vehicle.cons],
|
|
1054
|
+
['fuel', t('autobahn:priceMarket.criteria.fuel'), vehicle.fuel],
|
|
1055
|
+
['leaf', t('autobahn:priceMarket.criteria.co2'), vehicle.co2],
|
|
1056
|
+
['zap', t('autobahn:priceMarket.criteria.power'), vehicle.power.replace(/\s*\([^)]*\)\s*$/, '')],
|
|
1057
|
+
['palette', t('autobahn:priceMarket.criteria.color'), vehicle.color],
|
|
1058
|
+
['gauge', t('autobahn:priceMarket.criteria.km'), fmtKm(vehicle.km)],
|
|
1059
|
+
['star', t('autobahn:priceMarket.criteria.equipment'), t('autobahn:priceMarket.criteria.equipmentCount', { count: totalEquipment })],
|
|
1060
|
+
];
|
|
1061
|
+
const criteria = allCriteria.filter(([, , v]) => !!v);
|
|
1062
|
+
|
|
1063
|
+
return (
|
|
1064
|
+
<div style={{ marginTop: 18 }}>
|
|
1065
|
+
<button
|
|
1066
|
+
type="button"
|
|
1067
|
+
onClick={() => setOpen((o) => !o)}
|
|
1068
|
+
style={{
|
|
1069
|
+
...expanderBtnStyle,
|
|
1070
|
+
justifyContent: 'flex-start',
|
|
1071
|
+
gap: 6,
|
|
1072
|
+
padding: '2px 0',
|
|
1073
|
+
margin: '0 22px',
|
|
1074
|
+
width: 'calc(100% - 44px)',
|
|
1075
|
+
}}
|
|
1076
|
+
>
|
|
1077
|
+
{t('autobahn:priceMarket.detailsLink')}
|
|
1078
|
+
<Icon
|
|
1079
|
+
name={open ? 'chevron-up' : 'chevron-down'}
|
|
1080
|
+
size={18}
|
|
1081
|
+
color="var(--md-primary)"
|
|
1082
|
+
stroke={2.6}
|
|
1083
|
+
style={{ flex: 'none', marginLeft: 'auto' }}
|
|
1084
|
+
/>
|
|
1085
|
+
</button>
|
|
1086
|
+
{open && (
|
|
1087
|
+
<div style={{ marginTop: 14, display: 'flex', flexDirection: 'column', gap: 18 }}>
|
|
1088
|
+
<div className="mcard mcard--filled fin-criteria-card" style={{ padding: 16, flexDirection: 'column' }}>
|
|
1089
|
+
<BreakdownCardHead
|
|
1090
|
+
icon="list"
|
|
1091
|
+
title={t('autobahn:priceMarket.criteriaTitle')}
|
|
1092
|
+
open={criteriaOpen}
|
|
1093
|
+
onToggle={() => setCriteriaOpen((o) => !o)}
|
|
1094
|
+
/>
|
|
1095
|
+
{criteriaOpen && (
|
|
1096
|
+
<>
|
|
1097
|
+
<div className="fin-criteria-divider" />
|
|
1098
|
+
<div className="fin-criteria-grid fin-criteria-icon-grid" style={{ display: 'flex', flexWrap: 'wrap', gap: 14 }}>
|
|
1099
|
+
{criteria.map(([ic, label, value]) => (
|
|
1100
|
+
<div key={label} style={{ display: 'flex', alignItems: 'flex-start', gap: 9, minWidth: '44%', flex: '1 1 44%' }}>
|
|
1101
|
+
{ic === 'car-front' ? (
|
|
1102
|
+
<svg width="17" height="17" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg" style={{ marginTop: 1, flex: 'none' }}>
|
|
1103
|
+
<path
|
|
1104
|
+
d="M6.06689 11.6668L7.70023 7.70016C7.88892 7.16585 8.23528 6.70136 8.69355 6.36807C9.15183 6.03478 9.70044 5.84838 10.2669 5.8335H17.7336C18.3 5.84838 18.8486 6.03478 19.3069 6.36807C19.7652 6.70136 20.1115 7.16585 20.3002 7.70016L21.9336 11.6668"
|
|
1105
|
+
stroke="#005CFF"
|
|
1106
|
+
strokeLinecap="round"
|
|
1107
|
+
strokeLinejoin="round"
|
|
1108
|
+
/>
|
|
1109
|
+
<path
|
|
1110
|
+
d="M5.83333 11.6665H22.1667C22.7855 11.6665 23.379 11.9123 23.8166 12.3499C24.2542 12.7875 24.5 13.381 24.5 13.9998V19.2498C24.5 19.714 24.3156 20.1591 23.9874 20.4873C23.6592 20.8155 23.2141 20.9998 22.75 20.9998H21V22.7498H18.6667V20.9998H9.33333V22.7498H7V20.9998H5.25C4.78587 20.9998 4.34075 20.8155 4.01256 20.4873C3.68437 20.1591 3.5 19.714 3.5 19.2498V13.9998C3.5 13.381 3.74583 12.7875 4.18342 12.3499C4.621 11.9123 5.21449 11.6665 5.83333 11.6665Z"
|
|
1111
|
+
stroke="#005CFF"
|
|
1112
|
+
strokeLinecap="round"
|
|
1113
|
+
strokeLinejoin="round"
|
|
1114
|
+
/>
|
|
1115
|
+
<path d="M7 15.1665H9M19 15.1665H21M10.5 18.6665H18" stroke="#005CFF" strokeLinecap="round" strokeLinejoin="round" />
|
|
1116
|
+
</svg>
|
|
1117
|
+
) : ic === 'calendar' ? (
|
|
1118
|
+
<svg width="17" height="17" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg" style={{ marginTop: 1, flex: 'none' }}>
|
|
1119
|
+
<path
|
|
1120
|
+
d="M20.9998 6.4165H6.99984C5.71117 6.4165 4.6665 7.46117 4.6665 8.74984V20.9998C4.6665 22.2885 5.71117 23.3332 6.99984 23.3332H20.9998C22.2885 23.3332 23.3332 22.2885 23.3332 20.9998V8.74984C23.3332 7.46117 22.2885 6.4165 20.9998 6.4165Z"
|
|
1121
|
+
stroke="#005CFF"
|
|
1122
|
+
strokeLinecap="round"
|
|
1123
|
+
strokeLinejoin="round"
|
|
1124
|
+
/>
|
|
1125
|
+
<path
|
|
1126
|
+
d="M9.33317 4.0835V8.75016M18.6665 4.0835V8.75016M4.6665 11.6668H23.3332M9.33317 15.1668H11.6665M13.9998 15.1668H16.3332M18.6665 15.1668H18.7832M9.33317 18.6668H11.6665M13.9998 18.6668H16.3332"
|
|
1127
|
+
stroke="#005CFF"
|
|
1128
|
+
strokeLinecap="round"
|
|
1129
|
+
strokeLinejoin="round"
|
|
1130
|
+
/>
|
|
1131
|
+
</svg>
|
|
1132
|
+
) : ic === 'fuel' ? (
|
|
1133
|
+
<svg width="17" height="17" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg" style={{ marginTop: 1, flex: 'none' }}>
|
|
1134
|
+
<path
|
|
1135
|
+
d="M7 23.3333V6.41667C7 5.64312 7.30729 4.90125 7.85427 4.35427C8.40125 3.80729 9.14312 3.5 9.91667 3.5H16.9167C17.6902 3.5 18.4321 3.80729 18.9791 4.35427C19.526 4.90125 19.8333 5.64312 19.8333 6.41667V23.3333"
|
|
1136
|
+
stroke="#005CFF"
|
|
1137
|
+
strokeLinecap="round"
|
|
1138
|
+
strokeLinejoin="round"
|
|
1139
|
+
/>
|
|
1140
|
+
<path d="M7 11.6667H19.8333M9.91667 7H16.9167" stroke="#005CFF" strokeLinecap="round" strokeLinejoin="round" />
|
|
1141
|
+
<path
|
|
1142
|
+
d="M19.8335 8.1665H21.3502L24.5002 11.3165V18.6665C24.5002 19.2853 24.2543 19.8788 23.8167 20.3164C23.3792 20.754 22.7857 20.9998 22.1668 20.9998H19.8335"
|
|
1143
|
+
stroke="#005CFF"
|
|
1144
|
+
strokeLinecap="round"
|
|
1145
|
+
strokeLinejoin="round"
|
|
1146
|
+
/>
|
|
1147
|
+
<path d="M4.6665 23.3335H22.1665" stroke="#005CFF" strokeLinecap="round" strokeLinejoin="round" />
|
|
1148
|
+
</svg>
|
|
1149
|
+
) : ic === 'zap' ? (
|
|
1150
|
+
<svg width="17" height="17" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg" style={{ marginTop: 1, flex: 'none' }}>
|
|
1151
|
+
<path
|
|
1152
|
+
d="M15.9833 3L7 14.9H13.3L12.3667 24.4667L21.4667 11.6333H15.2833L15.9833 3Z"
|
|
1153
|
+
stroke="#005CFF"
|
|
1154
|
+
strokeLinecap="round"
|
|
1155
|
+
strokeLinejoin="round"
|
|
1156
|
+
/>
|
|
1157
|
+
</svg>
|
|
1158
|
+
) : ic === 'gauge' ? (
|
|
1159
|
+
<svg width="17" height="17" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg" style={{ marginTop: 1, flex: 'none' }}>
|
|
1160
|
+
<path
|
|
1161
|
+
d="M4.6665 17.4998C4.6665 15.0245 5.64983 12.6505 7.40017 10.9002C9.15051 9.14983 11.5245 8.1665 13.9998 8.1665C16.4752 8.1665 18.8492 9.14983 20.5995 10.9002C22.3498 12.6505 23.3332 15.0245 23.3332 17.4998"
|
|
1162
|
+
stroke="#005CFF"
|
|
1163
|
+
strokeLinecap="round"
|
|
1164
|
+
strokeLinejoin="round"
|
|
1165
|
+
/>
|
|
1166
|
+
<path
|
|
1167
|
+
d="M9 17.5H18.5M14 17.5001L18.4333 11.4334M8.39997 12.2501L6.8833 11.0834M19.6 12.2501L21.1166 11.0834M14 9.33343V7.3501"
|
|
1168
|
+
stroke="#005CFF"
|
|
1169
|
+
strokeLinecap="round"
|
|
1170
|
+
strokeLinejoin="round"
|
|
1171
|
+
/>
|
|
1172
|
+
</svg>
|
|
1173
|
+
) : ic === 'cog' ? (
|
|
1174
|
+
<svg width="17" height="17" viewBox="0 0 21 21" fill="none" xmlns="http://www.w3.org/2000/svg" style={{ marginTop: 1, flex: 'none' }}>
|
|
1175
|
+
<path
|
|
1176
|
+
d="M18.2293 9.26087L20.5 10.5L20.3772 12.0836L17.9435 12.9486L17.4728 14.0974L18.5902 16.4514L17.5706 17.6586L15.1 16.9103L14.0533 17.5595L13.5902 20.1291L12.0641 20.5L10.5 18.4234L9.27609 18.3255L7.40978 20.1291L5.95978 19.5206L5.9 16.9103L4.9663 16.1025L2.40978 16.4514L1.59022 15.0967L3.05652 12.9486L2.77065 11.7391L0.5 10.5L0.622826 8.91642L3.05652 8.05145L3.52717 6.90255L2.40978 4.54864L3.42935 3.34142L5.9 4.08974L6.94674 3.44046L7.40978 0.870859L8.93587 0.5L10.5 2.57659L11.7239 2.67453L13.5902 0.870859L15.0402 1.47942L15.1 4.08974L16.0337 4.89749L18.5902 4.54864L19.4098 5.90332L17.9435 8.05145L18.2293 9.26087Z"
|
|
1177
|
+
stroke="#005CFF"
|
|
1178
|
+
strokeLinecap="round"
|
|
1179
|
+
strokeLinejoin="round"
|
|
1180
|
+
/>
|
|
1181
|
+
</svg>
|
|
1182
|
+
) : ic === 'droplet' ? (
|
|
1183
|
+
<svg width="17" height="17" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg" style={{ marginTop: 1, flex: 'none' }}>
|
|
1184
|
+
<path
|
|
1185
|
+
d="M14.0001 3.7334C14.0001 3.7334 20.7667 10.9667 20.7667 15.6334C20.7667 16.522 20.5917 17.4019 20.2516 18.2229C19.9116 19.0439 19.4132 19.7898 18.7848 20.4182C18.1565 21.0465 17.4105 21.5449 16.5896 21.885C15.7686 22.225 14.8887 22.4001 14.0001 22.4001C13.1115 22.4001 12.2315 22.225 11.4106 21.885C10.5896 21.5449 9.84365 21.0465 9.21531 20.4182C8.58697 19.7898 8.08854 19.0439 7.74848 18.2229C7.40842 17.4019 7.2334 16.522 7.2334 15.6334C7.2334 10.9667 14.0001 3.7334 14.0001 3.7334Z"
|
|
1186
|
+
stroke="#005CFF"
|
|
1187
|
+
strokeLinecap="round"
|
|
1188
|
+
strokeLinejoin="round"
|
|
1189
|
+
/>
|
|
1190
|
+
<path d="M10.9668 16.6831C11.4335 18.0831 12.4835 18.8998 14.0001 19.0164" stroke="#005CFF" strokeLinecap="round" strokeLinejoin="round" />
|
|
1191
|
+
</svg>
|
|
1192
|
+
) : ic === 'leaf' ? (
|
|
1193
|
+
<svg width="17" height="17" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg" style={{ marginTop: 1, flex: 'none' }}>
|
|
1194
|
+
<path
|
|
1195
|
+
d="M8.3999 19.8333H19.0166C19.6447 19.8716 20.2743 19.7858 20.8693 19.5808C21.4643 19.3758 22.0131 19.0557 22.4843 18.6386C22.9556 18.2215 23.3401 17.7157 23.6158 17.15C23.8916 16.5843 24.0533 15.9698 24.0916 15.3417C24.1299 14.7135 24.0441 14.084 23.8391 13.489C23.6341 12.894 23.3139 12.3452 22.8968 11.8739C22.4797 11.4027 21.9739 11.0182 21.4082 10.7424C20.8425 10.4666 20.2281 10.305 19.5999 10.2667C19.0554 8.97379 18.116 7.88622 16.916 7.15952C15.716 6.43283 14.317 6.10423 12.919 6.22073C11.521 6.33723 10.1956 6.89286 9.13247 7.80815C8.06934 8.72344 7.32289 9.9515 6.9999 11.3167C5.89206 11.5255 4.90988 12.1595 4.26335 13.083C3.61681 14.0066 3.35723 15.1464 3.54009 16.2588C3.72296 17.3712 4.33376 18.368 5.24191 19.0359C6.15006 19.7039 7.2835 19.9901 8.3999 19.8333Z"
|
|
1196
|
+
stroke="#005CFF"
|
|
1197
|
+
strokeLinecap="round"
|
|
1198
|
+
strokeLinejoin="round"
|
|
1199
|
+
/>
|
|
1200
|
+
<path
|
|
1201
|
+
d="M10.4998 15.9834C10.9508 15.9834 11.3164 15.6178 11.3164 15.1668C11.3164 14.7157 10.9508 14.3501 10.4998 14.3501C10.0487 14.3501 9.68311 14.7157 9.68311 15.1668C9.68311 15.6178 10.0487 15.9834 10.4998 15.9834Z"
|
|
1202
|
+
stroke="#005CFF"
|
|
1203
|
+
strokeLinecap="round"
|
|
1204
|
+
strokeLinejoin="round"
|
|
1205
|
+
/>
|
|
1206
|
+
<path
|
|
1207
|
+
d="M13.9998 15.9834C14.4508 15.9834 14.8164 15.6178 14.8164 15.1668C14.8164 14.7157 14.4508 14.3501 13.9998 14.3501C13.5487 14.3501 13.1831 14.7157 13.1831 15.1668C13.1831 15.6178 13.5487 15.9834 13.9998 15.9834Z"
|
|
1208
|
+
stroke="#005CFF"
|
|
1209
|
+
strokeLinecap="round"
|
|
1210
|
+
strokeLinejoin="round"
|
|
1211
|
+
/>
|
|
1212
|
+
<path
|
|
1213
|
+
d="M17.4998 15.9834C17.9508 15.9834 18.3164 15.6178 18.3164 15.1668C18.3164 14.7157 17.9508 14.3501 17.4998 14.3501C17.0487 14.3501 16.6831 14.7157 16.6831 15.1668C16.6831 15.6178 17.0487 15.9834 17.4998 15.9834Z"
|
|
1214
|
+
stroke="#005CFF"
|
|
1215
|
+
strokeLinecap="round"
|
|
1216
|
+
strokeLinejoin="round"
|
|
1217
|
+
/>
|
|
1218
|
+
</svg>
|
|
1219
|
+
) : ic === 'palette' ? (
|
|
1220
|
+
<svg width="17" height="17" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg" style={{ marginTop: 1, flex: 'none' }}>
|
|
1221
|
+
<path
|
|
1222
|
+
d="M16.6 7H9.1C7.9402 7 7 7.9402 7 9.1V19.7C7 20.8598 7.9402 21.8 9.1 21.8H16.6C17.7598 21.8 18.7 20.8598 18.7 19.7V9.1C18.7 7.9402 17.7598 7 16.6 7Z"
|
|
1223
|
+
stroke="#005CFF"
|
|
1224
|
+
strokeLinecap="round"
|
|
1225
|
+
strokeLinejoin="round"
|
|
1226
|
+
/>
|
|
1227
|
+
<path
|
|
1228
|
+
d="M18.6996 9.6001H19.9996C20.477 9.6001 20.9348 9.78974 21.2724 10.1273C21.61 10.4649 21.7996 10.9227 21.7996 11.4001V21.8001H11.5996"
|
|
1229
|
+
stroke="#005CFF"
|
|
1230
|
+
strokeLinecap="round"
|
|
1231
|
+
strokeLinejoin="round"
|
|
1232
|
+
/>
|
|
1233
|
+
<path
|
|
1234
|
+
d="M15.5996 18.0498C15.9033 18.0498 16.1493 18.2959 16.1494 18.5996C16.1494 18.9034 15.9034 19.1494 15.5996 19.1494C15.2959 19.1493 15.0498 18.9033 15.0498 18.5996C15.0499 18.296 15.296 18.0499 15.5996 18.0498Z"
|
|
1235
|
+
fill="#005CCB"
|
|
1236
|
+
stroke="#005CFF"
|
|
1237
|
+
/>
|
|
1238
|
+
</svg>
|
|
1239
|
+
) : ic === 'star' ? (
|
|
1240
|
+
<svg width="17" height="17" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg" style={{ marginTop: 1, flex: 'none' }}>
|
|
1241
|
+
<path
|
|
1242
|
+
d="M14.0001 3.5L17.1501 9.91667L24.2667 10.9667L19.1334 15.9833L20.3001 23.1L14.0001 19.7167L7.70006 23.1L8.86673 15.9833L3.7334 10.9667L10.8501 9.91667L14.0001 3.5Z"
|
|
1243
|
+
stroke="#005CFF"
|
|
1244
|
+
strokeLinecap="round"
|
|
1245
|
+
strokeLinejoin="round"
|
|
1246
|
+
/>
|
|
1247
|
+
</svg>
|
|
1248
|
+
) : (
|
|
1249
|
+
<Icon name={ic} size={17} color="var(--md-primary)" stroke={1.8} style={{ marginTop: 1, flex: 'none' }} />
|
|
1250
|
+
)}
|
|
1251
|
+
<span style={{ minWidth: 0, display: 'flex', flexDirection: 'column', rowGap: 2 }}>
|
|
1252
|
+
<span className="md-label-sm">{label}</span>
|
|
1253
|
+
<span className="md-title-sm" style={{ fontSize: 13.5 }}>
|
|
1254
|
+
{value}
|
|
1255
|
+
</span>
|
|
1256
|
+
</span>
|
|
1257
|
+
</div>
|
|
1258
|
+
))}
|
|
1259
|
+
</div>
|
|
1260
|
+
<p className="fin-criteria-note">* kombiniert</p>
|
|
1261
|
+
</>
|
|
1262
|
+
)}
|
|
1263
|
+
</div>
|
|
1264
|
+
|
|
1265
|
+
<div className="mcard mcard--filled fin-criteria-card" style={{ padding: 16, flexDirection: 'column' }}>
|
|
1266
|
+
<BreakdownCardHead
|
|
1267
|
+
icon="bar-chart-3"
|
|
1268
|
+
title={t('autobahn:priceMarket.categoriesTitle')}
|
|
1269
|
+
open={categoriesOpen}
|
|
1270
|
+
onToggle={() => setCategoriesOpen((o) => !o)}
|
|
1271
|
+
/>
|
|
1272
|
+
{categoriesOpen && (
|
|
1273
|
+
<>
|
|
1274
|
+
<div className="fin-criteria-divider" />
|
|
1275
|
+
<div className="fin-criteria-grid" style={{ display: 'flex', flexDirection: 'column' }}>
|
|
1276
|
+
{RATING_TIERS.map(([key, color, background, fontSize], i) => (
|
|
1277
|
+
<React.Fragment key={key}>
|
|
1278
|
+
{i > 0 && <div className="fin-criteria-divider" />}
|
|
1279
|
+
<div
|
|
1280
|
+
className="fin-criteria-tier-row"
|
|
1281
|
+
style={{ display: 'flex', alignItems: 'flex-start', gap: 10, paddingTop: i === 0 ? 13 : undefined }}
|
|
1282
|
+
>
|
|
1283
|
+
<span
|
|
1284
|
+
className="md-label-sm"
|
|
1285
|
+
style={{
|
|
1286
|
+
flexShrink: 0,
|
|
1287
|
+
fontFamily: 'Arial, Helvetica, Arimo, sans-serif',
|
|
1288
|
+
fontWeight: 700,
|
|
1289
|
+
fontSize,
|
|
1290
|
+
lineHeight: '14px',
|
|
1291
|
+
textAlign: 'center',
|
|
1292
|
+
borderRadius: 11,
|
|
1293
|
+
color,
|
|
1294
|
+
background,
|
|
1295
|
+
width: 82,
|
|
1296
|
+
height: 27,
|
|
1297
|
+
padding: 0,
|
|
1298
|
+
display: 'flex',
|
|
1299
|
+
alignItems: 'center',
|
|
1300
|
+
justifyContent: 'center',
|
|
1301
|
+
}}
|
|
1302
|
+
>
|
|
1303
|
+
{t(`autobahn:priceMarket.categories.${key}.label`)}
|
|
1304
|
+
</span>
|
|
1305
|
+
<div style={{ display: 'flex', flexDirection: 'column', minWidth: 0 }}>
|
|
1306
|
+
<span
|
|
1307
|
+
className="num md-label-sm"
|
|
1308
|
+
style={{
|
|
1309
|
+
fontFamily: 'Arial, Helvetica, Arimo, sans-serif',
|
|
1310
|
+
fontWeight: 700,
|
|
1311
|
+
fontSize: 10.2,
|
|
1312
|
+
lineHeight: '14px',
|
|
1313
|
+
color: '#1D2A38',
|
|
1314
|
+
}}
|
|
1315
|
+
>
|
|
1316
|
+
{eur(bands[key].min)} – {eur(bands[key].max)} €
|
|
1317
|
+
</span>
|
|
1318
|
+
<p
|
|
1319
|
+
className="md-body-sm"
|
|
1320
|
+
style={{
|
|
1321
|
+
margin: '2px 0 0',
|
|
1322
|
+
fontFamily: 'Arial, Helvetica, Arimo, sans-serif',
|
|
1323
|
+
fontWeight: 400,
|
|
1324
|
+
fontSize: 8.7,
|
|
1325
|
+
lineHeight: '12px',
|
|
1326
|
+
color: '#5B6B7F',
|
|
1327
|
+
}}
|
|
1328
|
+
>
|
|
1329
|
+
{t(`autobahn:priceMarket.categories.${key}.description`)}
|
|
1330
|
+
</p>
|
|
1331
|
+
</div>
|
|
1332
|
+
</div>
|
|
1333
|
+
</React.Fragment>
|
|
1334
|
+
))}
|
|
1335
|
+
<div className="fin-criteria-divider" />
|
|
1336
|
+
<div className="fin-criteria-tier-row" style={{ display: 'flex', alignItems: 'flex-start', gap: 10 }}>
|
|
1337
|
+
<span
|
|
1338
|
+
className="md-label-sm"
|
|
1339
|
+
style={{
|
|
1340
|
+
flexShrink: 0,
|
|
1341
|
+
fontFamily: 'Arial, Helvetica, Arimo, sans-serif',
|
|
1342
|
+
fontWeight: 700,
|
|
1343
|
+
fontSize: 9,
|
|
1344
|
+
lineHeight: '14px',
|
|
1345
|
+
textAlign: 'center',
|
|
1346
|
+
borderRadius: 11,
|
|
1347
|
+
color: '#5B6B7F',
|
|
1348
|
+
background: '#C8D1DE',
|
|
1349
|
+
width: 82,
|
|
1350
|
+
height: 27,
|
|
1351
|
+
padding: 0,
|
|
1352
|
+
display: 'flex',
|
|
1353
|
+
alignItems: 'center',
|
|
1354
|
+
justifyContent: 'center',
|
|
1355
|
+
}}
|
|
1356
|
+
>
|
|
1357
|
+
{t('autobahn:priceMarket.categories.noRating.label')}
|
|
1358
|
+
</span>
|
|
1359
|
+
<div style={{ display: 'flex', flexDirection: 'column', minWidth: 0 }}>
|
|
1360
|
+
<span
|
|
1361
|
+
className="num md-label-sm"
|
|
1362
|
+
style={{
|
|
1363
|
+
fontFamily: 'Arial, Helvetica, Arimo, sans-serif',
|
|
1364
|
+
fontWeight: 700,
|
|
1365
|
+
fontSize: 10.2,
|
|
1366
|
+
lineHeight: '14px',
|
|
1367
|
+
color: '#1D2A38',
|
|
1368
|
+
}}
|
|
1369
|
+
>
|
|
1370
|
+
??? – ??? €
|
|
1371
|
+
</span>
|
|
1372
|
+
<p
|
|
1373
|
+
className="md-body-sm"
|
|
1374
|
+
style={{
|
|
1375
|
+
margin: '2px 0 0',
|
|
1376
|
+
fontFamily: 'Arial, Helvetica, Arimo, sans-serif',
|
|
1377
|
+
fontWeight: 400,
|
|
1378
|
+
fontSize: 8.7,
|
|
1379
|
+
lineHeight: '12px',
|
|
1380
|
+
color: '#5B6B7F',
|
|
1381
|
+
}}
|
|
1382
|
+
>
|
|
1383
|
+
{t('autobahn:priceMarket.categories.noRating.description')}
|
|
1384
|
+
</p>
|
|
1385
|
+
</div>
|
|
1386
|
+
</div>
|
|
1387
|
+
</div>
|
|
1388
|
+
</>
|
|
1389
|
+
)}
|
|
1390
|
+
</div>
|
|
1391
|
+
</div>
|
|
1392
|
+
)}
|
|
1393
|
+
</div>
|
|
1394
|
+
);
|
|
1395
|
+
};
|
|
1396
|
+
|
|
786
1397
|
// ---------------------------------------------------------------------------
|
|
787
1398
|
// Protection products (CNP Santander upsell) — optional, non-functional UI
|
|
788
1399
|
// ---------------------------------------------------------------------------
|
package/vdp/index.ts
CHANGED
|
@@ -35,6 +35,7 @@ export {
|
|
|
35
35
|
Co2Label,
|
|
36
36
|
VehicleDescription,
|
|
37
37
|
TrustStrip,
|
|
38
|
+
PriceHistory,
|
|
38
39
|
ProtectionProducts,
|
|
39
40
|
VdpAnchors,
|
|
40
41
|
VdpStickyBar,
|
|
@@ -60,6 +61,7 @@ export type {
|
|
|
60
61
|
VehicleDescriptionProps,
|
|
61
62
|
TrustStripProps,
|
|
62
63
|
TrustItem,
|
|
64
|
+
PriceHistoryProps,
|
|
63
65
|
ProtectionProductsProps,
|
|
64
66
|
ProtectionProduct,
|
|
65
67
|
VdpAnchorsProps,
|
|
@@ -87,6 +89,7 @@ export type {
|
|
|
87
89
|
EnergyTaxSummary,
|
|
88
90
|
Co2CostsSummary,
|
|
89
91
|
EquipmentGroups,
|
|
92
|
+
PriceHistoryPoint,
|
|
90
93
|
PriceRatingBand,
|
|
91
94
|
PriceRatingBands,
|
|
92
95
|
VdpReview,
|
package/vdp/types.ts
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
// (`?`) fields are ones we have NO real source for yet; they are optional ON
|
|
11
11
|
// PURPOSE so the components can detect their absence and render the
|
|
12
12
|
// NEEDS_DATA_LABEL ('Daten folgt') marker instead of a fabricated value. Never
|
|
13
|
-
// default these to placeholder numbers.
|
|
14
|
-
// marketHigh)
|
|
13
|
+
// default these to placeholder numbers. priceHistory + the market band
|
|
14
|
+
// (marketLow / marketAvg / marketHigh) are needs-data by default.
|
|
15
15
|
|
|
16
16
|
import type { AutobahnPhev } from '../cards/types';
|
|
17
17
|
|
|
@@ -158,6 +158,14 @@ export interface RatingPortal {
|
|
|
158
158
|
url?: string;
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
+
/** One point on the price-history sparkline. */
|
|
162
|
+
export interface PriceHistoryPoint {
|
|
163
|
+
/** x-axis label, e.g. 'vor 6 Wo.' / 'heute'. */
|
|
164
|
+
label: string;
|
|
165
|
+
/** price in EUR at that point. */
|
|
166
|
+
price: number;
|
|
167
|
+
}
|
|
168
|
+
|
|
161
169
|
/** One [min,max] EUR band of the 5-tier Preisbewertung (mirrors legacy IRatingConfig). */
|
|
162
170
|
export interface PriceRatingBand {
|
|
163
171
|
min: number;
|
|
@@ -279,6 +287,8 @@ export interface VehicleDetail {
|
|
|
279
287
|
// --- NEEDS DATA: no real source yet (NEVER fabricate) ---
|
|
280
288
|
/** original list price (for the struck-through reference + history endpoint). */
|
|
281
289
|
listPrice?: number;
|
|
290
|
+
/** price-history points (sparkline). Needs-data by default. */
|
|
291
|
+
priceHistory?: PriceHistoryPoint[];
|
|
282
292
|
/** lowest comparable market price in EUR (market band lower bound). */
|
|
283
293
|
marketLow?: number;
|
|
284
294
|
/** average comparable market price in EUR (market band reference). */
|