@bytebrand/fe-ui-core-autobahn 1.0.217 → 1.0.218
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 +59 -14
- package/cards/CarRow.tsx +33 -9
- package/cards/cardParts.tsx +58 -18
- package/compat/PriceRating/PriceRating.styl +5 -7
- package/compat/PriceRatingDetailed/PriceRatingDetailed.styl +8 -6
- package/compat/legacy-theme/priceReviewColors.styl +18 -5
- package/constants/app.ts +11 -1
- package/constants/autobahn.ts +39 -0
- package/constants/core.ts +12 -1
- package/data/fieldMapping.ts +3 -3
- package/data/toAutobahnCar.ts +14 -12
- package/locales/de/autobahn.json +9 -7
- package/locales/en/autobahn.json +9 -7
- package/package.json +30 -30
- package/theme/md3.css +113 -337
- package/ui/StatChip.tsx +8 -3
- package/ui/index.ts +1 -0
- package/ui/ratingLink.ts +36 -0
- package/vdp/FinanceCalculator.tsx +130 -27
- package/vdp/VdpModules.tsx +58 -924
- package/vdp/index.ts +0 -3
- package/vdp/types.ts +2 -12
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)` /
|
|
11
|
+
// - `equipFor(id)` / 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,40 +16,23 @@
|
|
|
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
|
-
//
|
|
19
|
+
// ('Daten folgt') marker rather than inventing a value. The VDP's price block
|
|
20
|
+
// ("Preis & Marktwert", with its own price history) lives in fe-main:
|
|
21
|
+
// VehicleDetailedNextPage/PriceMarket.
|
|
21
22
|
//
|
|
22
23
|
// All components render correctly only inside a `<div className="md3">` subtree.
|
|
23
24
|
|
|
24
25
|
import React, { useState } from 'react';
|
|
25
26
|
import { TranslationFunction } from '../types';
|
|
26
27
|
|
|
27
|
-
import { Button, CreditCostNotice,
|
|
28
|
-
import
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
28
|
+
import { Button, CreditCostNotice, Dropdown, DropdownOption, Icon, Modal, Spec, StatChip, Stars } from '../ui';
|
|
29
|
+
import { CO2_CLASSES, CO2_COLORS } from '../constants';
|
|
30
|
+
import { ratingTone } from '../data/toAutobahnCar';
|
|
31
|
+
import { ratingLinkProps } from '../ui/ratingLink';
|
|
32
|
+
import { defaultVdpSpecs, EquipmentGroups, VehicleDetail, VdpSpec, VdpReview, RatingPortal, RunningCostRow, EnergyTaxSummary } from './types';
|
|
33
|
+
import { AddServicesTooltipBody, CalcRow, DocCheckIcon, EvalBar, EvalPill, evalPillOf, expanderBtnStyle, FinanceMode, Slider, TermChips, ToggleRow } from './FinanceCalculator';
|
|
32
34
|
import { formatEur as eur, formatEurCents as eurCents, formatPct as pct } from '../utils/financeFormat';
|
|
33
35
|
|
|
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
|
-
|
|
53
36
|
/** mileage → 'X.XXX km' (de-DE grouping). */
|
|
54
37
|
function fmtKm(n: number): string {
|
|
55
38
|
return `${n.toLocaleString('de-DE')} km`;
|
|
@@ -77,6 +60,9 @@ function extractPS(s: string): string {
|
|
|
77
60
|
|
|
78
61
|
export interface VdpHeaderCardProps {
|
|
79
62
|
vehicle: VehicleDetail;
|
|
63
|
+
/** VdpHeaderSummary: the rating chip was clicked — the page scrolls to its "Preis & Marktwert"
|
|
64
|
+
* section (#vdp-preis). Omit and the chip is not a link. */
|
|
65
|
+
onShowPriceRating?: () => void;
|
|
80
66
|
/** i18n function (drilled from the page). */
|
|
81
67
|
t: TranslationFunction;
|
|
82
68
|
}
|
|
@@ -84,7 +70,7 @@ export interface VdpHeaderCardProps {
|
|
|
84
70
|
/** headline + trim/power + rating pill, then the dot-separated fact line — the vehicle's
|
|
85
71
|
* identity block. Split out so the mobile-only layout can show this BEFORE the finance
|
|
86
72
|
* card (see VdpTrustRow) while the highlights/condition tiles move after it. */
|
|
87
|
-
export const VdpHeaderSummary: React.FunctionComponent<VdpHeaderCardProps> = ({ vehicle, t }) => {
|
|
73
|
+
export const VdpHeaderSummary: React.FunctionComponent<VdpHeaderCardProps> = ({ vehicle, onShowPriceRating, t }) => {
|
|
88
74
|
// Order: Mileage, First Registration, Horsepower, Fuel Type, Gearbox, then owners last
|
|
89
75
|
// (unchanged position) — per request, desktop + mobile both use this order.
|
|
90
76
|
const factLine: ReadonlyArray<readonly [string, string]> = [
|
|
@@ -110,13 +96,23 @@ export const VdpHeaderSummary: React.FunctionComponent<VdpHeaderCardProps> = ({
|
|
|
110
96
|
{/* BL-08: no chip at all when there's no real rating (empty/broken price) — never a
|
|
111
97
|
fabricated "Top Preis"-shaped badge for `rating === ''`. */}
|
|
112
98
|
{vehicle.rating && (
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
99
|
+
// the same chip as the SRP list row: each tier in its own badge colours (--rating-*),
|
|
100
|
+
// "Keine Bewertung" grey; check icon for a good deal (Top/Guter Preis); the "4" footnote on all.
|
|
101
|
+
// A link to the page's "Preis & Marktwert" section when the page passes onShowPriceRating.
|
|
102
|
+
<span
|
|
103
|
+
className={onShowPriceRating ? 'vdp-rating-chip rating-link' : 'vdp-rating-chip'}
|
|
104
|
+
{...(onShowPriceRating
|
|
105
|
+
? ratingLinkProps(onShowPriceRating, t('autobahn:finance.priceRatingLink', { rating: t('autobahn:tier.' + vehicle.rating) }))
|
|
106
|
+
: {})}
|
|
116
107
|
>
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
108
|
+
<StatChip
|
|
109
|
+
rating={vehicle.rating}
|
|
110
|
+
icon={ratingTone(vehicle.rating) === 'good' ? 'check' : 'minus'}
|
|
111
|
+
>
|
|
112
|
+
{t('autobahn:tier.' + vehicle.rating)}
|
|
113
|
+
<sup>4</sup>
|
|
114
|
+
</StatChip>
|
|
115
|
+
</span>
|
|
120
116
|
)}
|
|
121
117
|
</div>
|
|
122
118
|
|
|
@@ -267,9 +263,9 @@ export const VdpHeaderCondition: React.FunctionComponent<VdpHeaderCardProps> = (
|
|
|
267
263
|
* is just the textual header card that sits beneath it. Desktop-only usage (mobile
|
|
268
264
|
* splits these 3 pieces across the "before/after finance card" layout — see the page).
|
|
269
265
|
*/
|
|
270
|
-
export const VdpHeaderCard: React.FunctionComponent<VdpHeaderCardProps> = ({ vehicle, t }) => (
|
|
266
|
+
export const VdpHeaderCard: React.FunctionComponent<VdpHeaderCardProps> = ({ vehicle, onShowPriceRating, t }) => (
|
|
271
267
|
<div className="mcard" style={{ marginTop: 16, padding: '18px 14px 18px' }}>
|
|
272
|
-
<VdpHeaderSummary vehicle={vehicle} t={t} />
|
|
268
|
+
<VdpHeaderSummary vehicle={vehicle} onShowPriceRating={onShowPriceRating} t={t} />
|
|
273
269
|
<div style={{ marginTop: 14 }}>
|
|
274
270
|
<VdpHeaderHighlights vehicle={vehicle} t={t} />
|
|
275
271
|
</div>
|
|
@@ -801,599 +797,6 @@ export const TrustStrip: React.FunctionComponent<TrustStripProps> = ({ items, t
|
|
|
801
797
|
</div>
|
|
802
798
|
);
|
|
803
799
|
|
|
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
|
-
|
|
1397
800
|
// ---------------------------------------------------------------------------
|
|
1398
801
|
// Protection products (CNP Santander upsell) — optional, non-functional UI
|
|
1399
802
|
// ---------------------------------------------------------------------------
|
|
@@ -1658,7 +1061,6 @@ export const VdpStickyBar: React.FunctionComponent<VdpStickyBarProps> = ({ vehic
|
|
|
1658
1061
|
// ---------------------------------------------------------------------------
|
|
1659
1062
|
|
|
1660
1063
|
export interface VdpBottomBarProps {
|
|
1661
|
-
vehicle: VehicleDetail;
|
|
1662
1064
|
/**
|
|
1663
1065
|
* Whether the bar is docked/visible — page-owned scroll-position toggle: shows after scrolling
|
|
1664
1066
|
* past the main offer card (same STICKY_SHOW_AT threshold VdpStickyBar uses), and additionally
|
|
@@ -1667,16 +1069,10 @@ export interface VdpBottomBarProps {
|
|
|
1667
1069
|
* VdpStickyBar's own `show` (the desktop bar has no such lower boundary).
|
|
1668
1070
|
*/
|
|
1669
1071
|
show: boolean;
|
|
1670
|
-
/** active payment mode — drives the tabs
|
|
1072
|
+
/** active payment mode — drives the tabs (and hides "Rate anpassen" on Kaufen). */
|
|
1671
1073
|
mode?: FinanceMode;
|
|
1672
1074
|
/** mode tab tapped; when omitted the tabs row is not rendered. */
|
|
1673
1075
|
onModeChange?: (mode: FinanceMode) => void;
|
|
1674
|
-
/** monthly rate for the CURRENT mode (fin/leasing differ); falls back to vehicle.monthly. */
|
|
1675
|
-
monthly?: number;
|
|
1676
|
-
/** struck old rate (oldMonthlyInstallment, isStrikeShown-gated) — Figma sticky footer strike. */
|
|
1677
|
-
oldMonthly?: number;
|
|
1678
|
-
/** price-rating label — drives the eval pill + gradient bar (same as the offer card). */
|
|
1679
|
-
ratingLabel?: string;
|
|
1680
1076
|
/** primary CTA click. */
|
|
1681
1077
|
onSecure?: () => void;
|
|
1682
1078
|
/** true once the customer already has an offer request/checkout in progress for this car —
|
|
@@ -1689,22 +1085,6 @@ export interface VdpBottomBarProps {
|
|
|
1689
1085
|
onCall?: () => void;
|
|
1690
1086
|
/** opens the "Rate anpassen" sheet; when omitted the button is not rendered. */
|
|
1691
1087
|
onOpenAdjust?: () => void;
|
|
1692
|
-
/** current down payment (fin) / Sonderzahlung (leasing) in EUR — drives the .fin-cond line. */
|
|
1693
|
-
down?: number;
|
|
1694
|
-
/** current term in months — drives the .fin-cond line. */
|
|
1695
|
-
term?: number;
|
|
1696
|
-
/** leasing annual mileage (km/yr) — leasing-only part of the .fin-cond line. */
|
|
1697
|
-
annualMileage?: number;
|
|
1698
|
-
/** ADV-405 follow-up: financing key figures (Kerndaten) of the current calculation — see
|
|
1699
|
-
* FinanceCalculatorProps.creditKeyFigures (same values, same rule). Financing only; when at
|
|
1700
|
-
* least one is real they replace the "0 € Anzahlung · 60 Monate" .fin-cond text and the bar
|
|
1701
|
-
* switches to content height (.vdp-bottom-bar--kf). Omit to keep the old line. */
|
|
1702
|
-
creditKeyFigures?: CreditKeyFiguresData;
|
|
1703
|
-
/** ADV-405 follow-up (leasing, 19.11): leasing key figures of the current leasing calculation —
|
|
1704
|
-
* see FinanceCalculatorProps.leasingKeyFigures (same values, same rule). Leasing tab only. */
|
|
1705
|
-
leasingKeyFigures?: CreditKeyFiguresData;
|
|
1706
|
-
/** opens the Finanzierungs-/Leasingdetails popup (expanded); when omitted the link is hidden. */
|
|
1707
|
-
onShowDetails?: () => void;
|
|
1708
1088
|
/** whether leasing is actually offered for this car — see FinanceCalculatorProps.leasingAvailable
|
|
1709
1089
|
* for the full rationale. Default true keeps existing callers' behavior. */
|
|
1710
1090
|
leasingAvailable?: boolean;
|
|
@@ -1712,86 +1092,24 @@ export interface VdpBottomBarProps {
|
|
|
1712
1092
|
t: TranslationFunction;
|
|
1713
1093
|
}
|
|
1714
1094
|
|
|
1715
|
-
/** Mobile sticky bottom bar (Figma "Sticky Footer"): mode tabs,
|
|
1716
|
-
*
|
|
1717
|
-
*
|
|
1095
|
+
/** Mobile sticky bottom bar (Figma "Sticky Footer"): mode tabs, then Angebot anfragen · phone ·
|
|
1096
|
+
* Rate anpassen. ADV-436: nothing else — the rate, the price rating, the conditions / key figures
|
|
1097
|
+
* and the credit-cost warning made the bar too tall; they stay in the offer card above. */
|
|
1718
1098
|
export const VdpBottomBar: React.FunctionComponent<VdpBottomBarProps> = ({
|
|
1719
|
-
vehicle,
|
|
1720
1099
|
show,
|
|
1721
1100
|
mode = 'fin',
|
|
1722
1101
|
onModeChange,
|
|
1723
|
-
monthly,
|
|
1724
|
-
oldMonthly,
|
|
1725
|
-
ratingLabel,
|
|
1726
1102
|
onSecure,
|
|
1727
1103
|
secured,
|
|
1728
1104
|
secureLabel,
|
|
1729
1105
|
onCall,
|
|
1730
1106
|
onOpenAdjust,
|
|
1731
|
-
down,
|
|
1732
|
-
term,
|
|
1733
|
-
annualMileage,
|
|
1734
|
-
creditKeyFigures,
|
|
1735
|
-
leasingKeyFigures,
|
|
1736
|
-
onShowDetails,
|
|
1737
1107
|
leasingAvailable = true,
|
|
1738
1108
|
t,
|
|
1739
1109
|
}) => {
|
|
1740
|
-
const [uvpTooltipOpen, setUvpTooltipOpen] = useState(false);
|
|
1741
1110
|
const isCash = mode === 'cash';
|
|
1742
|
-
// ADV-405 follow-up: financing shows the key figures instead of the conditions text below —
|
|
1743
|
-
// only when at least one figure is real (else the old line stays, and the bar its fixed height).
|
|
1744
|
-
const tabKeyFigures = mode === 'fin' ? creditKeyFigures : mode === 'leasing' ? leasingKeyFigures : undefined;
|
|
1745
|
-
const keyFigures = tabKeyFigures && hasCreditKeyFigures(tabKeyFigures) ? tabKeyFigures : undefined;
|
|
1746
|
-
// the bar's height follows whether the CAR has key figures (financing or leasing), not the active
|
|
1747
|
-
// tab, so the tab row (the bar's top edge) does not move under the finger when switching tabs.
|
|
1748
|
-
const tallBar =
|
|
1749
|
-
!!(creditKeyFigures && hasCreditKeyFigures(creditKeyFigures)) || !!(leasingAvailable && leasingKeyFigures && hasCreditKeyFigures(leasingKeyFigures));
|
|
1750
|
-
const rate = monthly != null ? monthly : vehicle.monthly;
|
|
1751
|
-
const tierIdx = TIER_LABELS.indexOf(ratingLabel as (typeof TIER_LABELS)[number]);
|
|
1752
|
-
const evalTier = tierIdx >= 0 ? tierIdx : 1;
|
|
1753
|
-
const isGoodTier = TIER_KEYS[evalTier] === 'good';
|
|
1754
|
-
// each tier shows its own real label now (Top/Guter/Fairer/Erhöht/Hoher Preis) — no more
|
|
1755
|
-
// collapsing 'good' onto the "Top-Preis" claim. Pill styling (colour/bg/class/footnote) unchanged.
|
|
1756
|
-
const evalTierLabel = t('autobahn:tier.' + TIER_KEYS[evalTier]);
|
|
1757
|
-
const evalPillColor = isGoodTier ? TIER_COLORS[0] : TIER_COLORS[evalTier];
|
|
1758
|
-
const evalPillBackground = isGoodTier ? TIER_BACKGROUNDS[0] : TIER_BACKGROUNDS[evalTier];
|
|
1759
|
-
// condition summary — same wording/order as FinanceCalculator's own .fin-cond (financing
|
|
1760
|
-
// "0 € Anzahlung · 60 Monate", leasing "0 € Sonderzahlung · 36 Mon. · 10.000 km/Jahr").
|
|
1761
|
-
const condParts: string[] = [];
|
|
1762
|
-
if (mode === 'leasing') {
|
|
1763
|
-
condParts.push(
|
|
1764
|
-
...t('autobahn:card.price.leaseTerms', {
|
|
1765
|
-
firstInstallment: eur(down || 0),
|
|
1766
|
-
months: term,
|
|
1767
|
-
mileage: annualMileage != null ? eur(annualMileage) : '',
|
|
1768
|
-
}).split(' · '),
|
|
1769
|
-
);
|
|
1770
|
-
} else if (!isCash) {
|
|
1771
|
-
condParts.push(t('autobahn:finance.downPaymentLabel', { value: eur(down || 0) }));
|
|
1772
|
-
condParts.push(t('autobahn:finance.monthsLabel', { months: term, count: term }));
|
|
1773
|
-
}
|
|
1774
|
-
const priceStyle: React.CSSProperties = isCash
|
|
1775
|
-
? {
|
|
1776
|
-
fontFamily: 'Arial, Helvetica, Arimo, sans-serif',
|
|
1777
|
-
fontWeight: 700,
|
|
1778
|
-
fontSize: 40,
|
|
1779
|
-
color: '#005CFF',
|
|
1780
|
-
letterSpacing: '-1px',
|
|
1781
|
-
}
|
|
1782
|
-
: {
|
|
1783
|
-
fontFamily: 'Arial, Helvetica, Arimo, sans-serif',
|
|
1784
|
-
fontWeight: 700,
|
|
1785
|
-
fontSize: 52,
|
|
1786
|
-
lineHeight: '58px',
|
|
1787
|
-
color: '#005CFF',
|
|
1788
|
-
letterSpacing: '-1px',
|
|
1789
|
-
};
|
|
1790
|
-
const priceValue = isCash ? vehicle.price : Math.round(rate);
|
|
1791
|
-
const priceLen = String(Math.round(priceValue)).length;
|
|
1792
|
-
const priceLenClass = isCash ? '' : priceLen >= 6 ? ' num--len6' : priceLen === 5 ? ' num--len5' : '';
|
|
1793
1111
|
return (
|
|
1794
|
-
<div className={'vdp-bottom-bar show-mobile' + (show ? ' vdp-bottom-bar--on' : '')
|
|
1112
|
+
<div className={'vdp-bottom-bar show-mobile' + (show ? ' vdp-bottom-bar--on' : '')}>
|
|
1795
1113
|
{onModeChange && (
|
|
1796
1114
|
<div className="fin-tabs bb-tabs" role="tablist">
|
|
1797
1115
|
{(
|
|
@@ -1814,183 +1132,6 @@ export const VdpBottomBar: React.FunctionComponent<VdpBottomBarProps> = ({
|
|
|
1814
1132
|
))}
|
|
1815
1133
|
</div>
|
|
1816
1134
|
)}
|
|
1817
|
-
<div className="bb-price-row">
|
|
1818
|
-
<div style={{ display: 'flex', flexDirection: 'column', minWidth: 0, flex: 1 }}>
|
|
1819
|
-
{isCash && vehicle.listPrice != null && vehicle.listPrice > vehicle.price && (
|
|
1820
|
-
// ADV-423: "UVP" label right before the struck list price (same 15px as the price)
|
|
1821
|
-
<span className="pp-uvp-strike" style={{ alignSelf: 'flex-end' }}>
|
|
1822
|
-
<span
|
|
1823
|
-
className="pp-uvp-label"
|
|
1824
|
-
onClick={(e) => {
|
|
1825
|
-
e.stopPropagation();
|
|
1826
|
-
setUvpTooltipOpen((v) => !v);
|
|
1827
|
-
}}
|
|
1828
|
-
>
|
|
1829
|
-
{t('autobahn:finance.uvp')}
|
|
1830
|
-
</span>
|
|
1831
|
-
<s
|
|
1832
|
-
className="num fin-rate-old fin-rate-old-bb"
|
|
1833
|
-
style={{ paddingBottom: 0, fontSize: 15 }}
|
|
1834
|
-
role="button"
|
|
1835
|
-
tabIndex={0}
|
|
1836
|
-
onClick={(e) => {
|
|
1837
|
-
e.stopPropagation();
|
|
1838
|
-
setUvpTooltipOpen((v) => !v);
|
|
1839
|
-
}}
|
|
1840
|
-
>
|
|
1841
|
-
{eur(vehicle.listPrice)} €
|
|
1842
|
-
<span className="pp-eyebrow-badge">2</span>
|
|
1843
|
-
{uvpTooltipOpen && (
|
|
1844
|
-
<div className="pp-uvp-tooltip" onClick={(e) => e.stopPropagation()}>
|
|
1845
|
-
<button
|
|
1846
|
-
type="button"
|
|
1847
|
-
className="pp-uvp-tooltip-close"
|
|
1848
|
-
aria-label={t('autobahn:modal.close')}
|
|
1849
|
-
onClick={(e) => {
|
|
1850
|
-
e.stopPropagation();
|
|
1851
|
-
setUvpTooltipOpen(false);
|
|
1852
|
-
}}
|
|
1853
|
-
>
|
|
1854
|
-
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1855
|
-
<path d="M5 5L15 15M15 5L5 15" stroke="white" strokeWidth={2.4} strokeLinecap="round" />
|
|
1856
|
-
</svg>
|
|
1857
|
-
</button>
|
|
1858
|
-
<div className="pp-uvp-tooltip-body">{t('autobahn:card.price.uvpListTooltipBody')}</div>
|
|
1859
|
-
</div>
|
|
1860
|
-
)}
|
|
1861
|
-
</s>
|
|
1862
|
-
</span>
|
|
1863
|
-
)}
|
|
1864
|
-
<div style={{ display: 'flex', alignItems: 'center', whiteSpace: 'nowrap', minWidth: 0 }}>
|
|
1865
|
-
<span className={'num' + priceLenClass} style={priceStyle}>
|
|
1866
|
-
{isCash ? eur(vehicle.price) : eur(Math.round(rate))}
|
|
1867
|
-
</span>
|
|
1868
|
-
<span className={'num' + priceLenClass} style={{ ...priceStyle, marginLeft: 10 }}>
|
|
1869
|
-
€
|
|
1870
|
-
</span>
|
|
1871
|
-
{isCash && <sup className="bb-price-cash-sup">1</sup>}
|
|
1872
|
-
{/* <span className="md-label-sm" style={{ fontWeight: 600 }}>{t('autobahn:finance.fixedPrice')}</span> */}
|
|
1873
|
-
{!isCash && (
|
|
1874
|
-
<span className="fin-rate-unit" style={{ fontSize: 12.5, paddingLeft: 15 }}>
|
|
1875
|
-
{oldMonthly != null && (
|
|
1876
|
-
<span
|
|
1877
|
-
style={{ display: 'contents' }}
|
|
1878
|
-
role="button"
|
|
1879
|
-
tabIndex={0}
|
|
1880
|
-
onClick={() => setUvpTooltipOpen((v) => !v)}
|
|
1881
|
-
>
|
|
1882
|
-
<span className="pp-eyebrow">
|
|
1883
|
-
{t('autobahn:card.price.uvpRateLabel')}
|
|
1884
|
-
<span className="pp-eyebrow-badge">3</span>
|
|
1885
|
-
{uvpTooltipOpen && (
|
|
1886
|
-
<div className="pp-uvp-tooltip" onClick={(e) => e.stopPropagation()}>
|
|
1887
|
-
<button
|
|
1888
|
-
type="button"
|
|
1889
|
-
className="pp-uvp-tooltip-close"
|
|
1890
|
-
aria-label={t('autobahn:modal.close')}
|
|
1891
|
-
onClick={(e) => {
|
|
1892
|
-
e.stopPropagation();
|
|
1893
|
-
setUvpTooltipOpen(false);
|
|
1894
|
-
}}
|
|
1895
|
-
>
|
|
1896
|
-
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1897
|
-
<path d="M5 5L15 15M15 5L5 15" stroke="white" strokeWidth={2.4} strokeLinecap="round" />
|
|
1898
|
-
</svg>
|
|
1899
|
-
</button>
|
|
1900
|
-
<div className="pp-uvp-tooltip-body">
|
|
1901
|
-
{t(mode === 'leasing' ? 'autobahn:card.price.uvpRateTooltipBodyLeasing' : 'autobahn:card.price.uvpRateTooltipBody')}
|
|
1902
|
-
</div>
|
|
1903
|
-
</div>
|
|
1904
|
-
)}
|
|
1905
|
-
</span>
|
|
1906
|
-
<s className="num fin-rate-old fin-rate-old-bb">
|
|
1907
|
-
{eur(Math.round(oldMonthly))} €
|
|
1908
|
-
</s>
|
|
1909
|
-
</span>
|
|
1910
|
-
)}
|
|
1911
|
-
{/* no struck old rate above it (strike hidden) — nudge "/ mtl." down so it
|
|
1912
|
-
sits level with the blue hero rate instead of centering high in the row. */}
|
|
1913
|
-
<span
|
|
1914
|
-
style={{
|
|
1915
|
-
fontFamily: 'Arial, Helvetica, Arimo, sans-serif',
|
|
1916
|
-
fontWeight: 700,
|
|
1917
|
-
fontSize: 18,
|
|
1918
|
-
lineHeight: '21px',
|
|
1919
|
-
color: '#5B6B7F',
|
|
1920
|
-
...(oldMonthly == null ? { paddingTop: 20 } : {}),
|
|
1921
|
-
}}
|
|
1922
|
-
>
|
|
1923
|
-
{t('autobahn:bottom.perMonth').replace(/^\/\s*/, '/ ')}
|
|
1924
|
-
</span>
|
|
1925
|
-
</span>
|
|
1926
|
-
)}
|
|
1927
|
-
</div>
|
|
1928
|
-
</div>
|
|
1929
|
-
{ratingLabel && (
|
|
1930
|
-
<div className="bb-eval">
|
|
1931
|
-
<span
|
|
1932
|
-
className="fin-eval-pill"
|
|
1933
|
-
style={{
|
|
1934
|
-
width: '100%',
|
|
1935
|
-
height: 27,
|
|
1936
|
-
padding: 0,
|
|
1937
|
-
marginBottom: 5,
|
|
1938
|
-
boxSizing: 'border-box',
|
|
1939
|
-
display: 'flex',
|
|
1940
|
-
alignItems: 'center',
|
|
1941
|
-
justifyContent: 'center',
|
|
1942
|
-
fontFamily: 'Arial, Helvetica, Arimo, sans-serif',
|
|
1943
|
-
fontWeight: 700,
|
|
1944
|
-
fontSize: 12,
|
|
1945
|
-
lineHeight: '14px',
|
|
1946
|
-
textAlign: 'center',
|
|
1947
|
-
borderRadius: 11,
|
|
1948
|
-
color: evalPillColor,
|
|
1949
|
-
background: evalPillBackground,
|
|
1950
|
-
}}
|
|
1951
|
-
>
|
|
1952
|
-
{evalTierLabel}
|
|
1953
|
-
{isGoodTier && <sup>4</sup>}
|
|
1954
|
-
</span>
|
|
1955
|
-
<EvalBar tier={evalTier} />
|
|
1956
|
-
</div>
|
|
1957
|
-
)}
|
|
1958
|
-
</div>
|
|
1959
|
-
{/* ADV-405 follow-up: financing with real key figures → the Kerndaten (2 lines in the
|
|
1960
|
-
.fin-cond style, wrapping on narrow phones) ending with the same details link. */}
|
|
1961
|
-
{keyFigures ? (
|
|
1962
|
-
<CreditKeyFigures
|
|
1963
|
-
t={t}
|
|
1964
|
-
figures={keyFigures}
|
|
1965
|
-
cls="fin-cond bb-ckf"
|
|
1966
|
-
details={
|
|
1967
|
-
onShowDetails && (
|
|
1968
|
-
<button type="button" className="cc-terms-link" onClick={onShowDetails}>
|
|
1969
|
-
{mode === 'leasing' ? t('autobahn:card.price.detailsLink') : t('autobahn:finance.financingDetails')}
|
|
1970
|
-
</button>
|
|
1971
|
-
)
|
|
1972
|
-
}
|
|
1973
|
-
/>
|
|
1974
|
-
) : !isCash && (
|
|
1975
|
-
<div className="fin-cond">
|
|
1976
|
-
{condParts.map((part, i) => (
|
|
1977
|
-
<React.Fragment key={i}>
|
|
1978
|
-
{i > 0 && <span className="cc-terms-dot"> · </span>}
|
|
1979
|
-
{part}
|
|
1980
|
-
</React.Fragment>
|
|
1981
|
-
))}
|
|
1982
|
-
{onShowDetails && (
|
|
1983
|
-
<>
|
|
1984
|
-
<span className="cc-terms-dot"> · </span>
|
|
1985
|
-
<button type="button" className="cc-terms-link" onClick={onShowDetails}>
|
|
1986
|
-
{mode === 'leasing' ? t('autobahn:card.price.detailsLink') : t('autobahn:finance.financingDetails')}
|
|
1987
|
-
</button>
|
|
1988
|
-
</>
|
|
1989
|
-
)}
|
|
1990
|
-
</div>
|
|
1991
|
-
)}
|
|
1992
|
-
{/* ADV-405/406 Kreditkosten-Hinweis (Sticky Footer): below the conditions line, above the CTAs. */}
|
|
1993
|
-
{!isCash && <CreditCostNotice t={t} cls="bb-ccn" />}
|
|
1994
1135
|
<div className="bb-cta-row">
|
|
1995
1136
|
<Button
|
|
1996
1137
|
variant="filled"
|
|
@@ -2171,6 +1312,9 @@ export interface FinanceDetailsModalProps {
|
|
|
2171
1312
|
onTermChange?: (term: number) => void;
|
|
2172
1313
|
onAnnualMileageChange?: (km: number) => void;
|
|
2173
1314
|
onClose: () => void;
|
|
1315
|
+
/** the price-rating badge + bar were clicked: the page closes the modal and scrolls to its
|
|
1316
|
+
* "Preis & Marktwert" section (#vdp-preis). Omit and they are not a link. */
|
|
1317
|
+
onShowPriceRating?: () => void;
|
|
2174
1318
|
/** opened directly via the page's Finanzierungs-/Leasingdetails link — the sheet opens
|
|
2175
1319
|
* scrolled to the breakdown instead of the "Rate anpassen" controls at its top. */
|
|
2176
1320
|
initialShowBreakdown?: boolean;
|
|
@@ -2254,6 +1398,7 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
|
|
|
2254
1398
|
onTermChange,
|
|
2255
1399
|
onAnnualMileageChange,
|
|
2256
1400
|
onClose,
|
|
1401
|
+
onShowPriceRating,
|
|
2257
1402
|
initialShowBreakdown,
|
|
2258
1403
|
skipInitialScroll,
|
|
2259
1404
|
ratingLabel,
|
|
@@ -2455,18 +1600,9 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
|
|
|
2455
1600
|
: isLease
|
|
2456
1601
|
? t('autobahn:modal.sheetTitleLeasing')
|
|
2457
1602
|
: t('autobahn:modal.sheetTitleFinancing');
|
|
2458
|
-
// price-evaluation
|
|
2459
|
-
|
|
2460
|
-
const evalTier
|
|
2461
|
-
const evalTierLabel = t('autobahn:tier.' + TIER_KEYS[evalTier]);
|
|
2462
|
-
// 'good' ("Guter Preis") always paints with the TOP tier's brighter green (TIER_COLORS[0]),
|
|
2463
|
-
// not its own dimmer TIER_COLORS[1] — same rule FinanceCalculator's collapsed card already
|
|
2464
|
-
// applies (FinanceCalculator.tsx's evalPillColor). The two render blocks below (desktop +
|
|
2465
|
-
// mobile sheet) used TIER_COLORS[evalTier] directly, which for the 'good' tier painted this
|
|
2466
|
-
// modal's pill a visibly different, dimmer green than the same-labeled pill on the card that
|
|
2467
|
-
// opened it — same text, two colors.
|
|
2468
|
-
const isGoodTier = TIER_KEYS[evalTier] === 'good';
|
|
2469
|
-
const evalPillColor = isGoodTier ? TIER_COLORS[0] : TIER_COLORS[evalTier];
|
|
1603
|
+
// price-evaluation pill + bar — identical derivation to the collapsed card (FinanceCalculator's
|
|
1604
|
+
// evalPillOf), so the modal's pill has the same label and colour as the card that opened it.
|
|
1605
|
+
const { tier: evalTier, isGood: isGoodTier, label: evalTierLabel, color: evalPillColor, background: evalPillBackground } = evalPillOf(ratingLabel, t);
|
|
2470
1606
|
// adjustable only for fin/leasing, and only when the page supplies the change handlers + bounds.
|
|
2471
1607
|
const adjustable = mode !== 'cash' && !!onDownChange && downMin != null && downMax != null && termMin != null && termMax != null;
|
|
2472
1608
|
// discrete term chip values (supplied periods, else derived from the bounds).
|
|
@@ -2826,16 +1962,15 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
|
|
|
2826
1962
|
)}
|
|
2827
1963
|
</div>
|
|
2828
1964
|
</div>
|
|
2829
|
-
<div
|
|
1965
|
+
<div
|
|
1966
|
+
className={ratingLabel && onShowPriceRating ? 'fin-eval-col rating-link' : 'fin-eval-col'}
|
|
1967
|
+
{...(ratingLabel && onShowPriceRating
|
|
1968
|
+
? ratingLinkProps(onShowPriceRating, t('autobahn:finance.priceRatingLink', { rating: evalTierLabel }))
|
|
1969
|
+
: {})}
|
|
1970
|
+
>
|
|
2830
1971
|
<div className="fin-eval-pill-cell">
|
|
2831
1972
|
{ratingLabel && (
|
|
2832
|
-
<
|
|
2833
|
-
className={`fin-eval-pill${isGoodTier ? ' fin-eval-pill--good' : ''}`}
|
|
2834
|
-
style={{ color: evalPillColor, background: `color-mix(in srgb, ${evalPillColor} 16%, transparent)` }}
|
|
2835
|
-
>
|
|
2836
|
-
{evalTierLabel}
|
|
2837
|
-
{isGoodTier && <sup>4</sup>}
|
|
2838
|
-
</span>
|
|
1973
|
+
<EvalPill label={evalTierLabel} color={evalPillColor} background={evalPillBackground} good={isGoodTier} />
|
|
2839
1974
|
)}
|
|
2840
1975
|
</div>
|
|
2841
1976
|
<div className="fin-eval-bar-cell">{ratingLabel && <EvalBar tier={evalTier} />}</div>
|
|
@@ -3363,16 +2498,15 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
|
|
|
3363
2498
|
)}
|
|
3364
2499
|
</div>
|
|
3365
2500
|
</div>
|
|
3366
|
-
<div
|
|
2501
|
+
<div
|
|
2502
|
+
className={ratingLabel && onShowPriceRating ? 'fin-eval-col rating-link' : 'fin-eval-col'}
|
|
2503
|
+
{...(ratingLabel && onShowPriceRating
|
|
2504
|
+
? ratingLinkProps(onShowPriceRating, t('autobahn:finance.priceRatingLink', { rating: evalTierLabel }))
|
|
2505
|
+
: {})}
|
|
2506
|
+
>
|
|
3367
2507
|
<div className="fin-eval-pill-cell">
|
|
3368
2508
|
{ratingLabel && (
|
|
3369
|
-
<
|
|
3370
|
-
className={`fin-eval-pill${isGoodTier ? ' fin-eval-pill--good' : ''}`}
|
|
3371
|
-
style={{ color: evalPillColor, background: `color-mix(in srgb, ${evalPillColor} 16%, transparent)` }}
|
|
3372
|
-
>
|
|
3373
|
-
{evalTierLabel}
|
|
3374
|
-
{isGoodTier && <sup>4</sup>}
|
|
3375
|
-
</span>
|
|
2509
|
+
<EvalPill label={evalTierLabel} color={evalPillColor} background={evalPillBackground} good={isGoodTier} />
|
|
3376
2510
|
)}
|
|
3377
2511
|
</div>
|
|
3378
2512
|
<div className="fin-eval-bar-cell">{ratingLabel && <EvalBar tier={evalTier} />}</div>
|