@bytebrand/fe-ui-core-autobahn 1.0.214 → 1.0.215
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 +3 -1
- package/locales/en/autobahn.json +3 -1
- package/package.json +30 -30
- package/theme/md3.css +115 -218
- 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 +66 -665
- 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,8 +16,9 @@
|
|
|
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
|
|
|
@@ -26,30 +27,13 @@ import { TranslationFunction } from '../types';
|
|
|
26
27
|
|
|
27
28
|
import { Button, CreditCostNotice, CreditKeyFigures, Dropdown, DropdownOption, hasCreditKeyFigures, Icon, Modal, Spec, StatChip, Stars } from '../ui';
|
|
28
29
|
import type { CreditKeyFiguresData } from '../ui';
|
|
29
|
-
import { CO2_CLASSES, CO2_COLORS
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
30
|
+
import { CO2_CLASSES, CO2_COLORS } from '../constants';
|
|
31
|
+
import { ratingTone } from '../data/toAutobahnCar';
|
|
32
|
+
import { ratingLinkProps } from '../ui/ratingLink';
|
|
33
|
+
import { defaultVdpSpecs, EquipmentGroups, VehicleDetail, VdpSpec, VdpReview, RatingPortal, RunningCostRow, EnergyTaxSummary } from './types';
|
|
34
|
+
import { AddServicesTooltipBody, CalcRow, DocCheckIcon, EvalBar, EvalPill, evalPillOf, expanderBtnStyle, FinanceMode, Slider, TermChips, ToggleRow } from './FinanceCalculator';
|
|
32
35
|
import { formatEur as eur, formatEurCents as eurCents, formatPct as pct } from '../utils/financeFormat';
|
|
33
36
|
|
|
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
37
|
/** mileage → 'X.XXX km' (de-DE grouping). */
|
|
54
38
|
function fmtKm(n: number): string {
|
|
55
39
|
return `${n.toLocaleString('de-DE')} km`;
|
|
@@ -77,6 +61,9 @@ function extractPS(s: string): string {
|
|
|
77
61
|
|
|
78
62
|
export interface VdpHeaderCardProps {
|
|
79
63
|
vehicle: VehicleDetail;
|
|
64
|
+
/** VdpHeaderSummary: the rating chip was clicked — the page scrolls to its "Preis & Marktwert"
|
|
65
|
+
* section (#vdp-preis). Omit and the chip is not a link. */
|
|
66
|
+
onShowPriceRating?: () => void;
|
|
80
67
|
/** i18n function (drilled from the page). */
|
|
81
68
|
t: TranslationFunction;
|
|
82
69
|
}
|
|
@@ -84,7 +71,7 @@ export interface VdpHeaderCardProps {
|
|
|
84
71
|
/** headline + trim/power + rating pill, then the dot-separated fact line — the vehicle's
|
|
85
72
|
* identity block. Split out so the mobile-only layout can show this BEFORE the finance
|
|
86
73
|
* card (see VdpTrustRow) while the highlights/condition tiles move after it. */
|
|
87
|
-
export const VdpHeaderSummary: React.FunctionComponent<VdpHeaderCardProps> = ({ vehicle, t }) => {
|
|
74
|
+
export const VdpHeaderSummary: React.FunctionComponent<VdpHeaderCardProps> = ({ vehicle, onShowPriceRating, t }) => {
|
|
88
75
|
// Order: Mileage, First Registration, Horsepower, Fuel Type, Gearbox, then owners last
|
|
89
76
|
// (unchanged position) — per request, desktop + mobile both use this order.
|
|
90
77
|
const factLine: ReadonlyArray<readonly [string, string]> = [
|
|
@@ -110,13 +97,23 @@ export const VdpHeaderSummary: React.FunctionComponent<VdpHeaderCardProps> = ({
|
|
|
110
97
|
{/* BL-08: no chip at all when there's no real rating (empty/broken price) — never a
|
|
111
98
|
fabricated "Top Preis"-shaped badge for `rating === ''`. */}
|
|
112
99
|
{vehicle.rating && (
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
100
|
+
// the same chip as the SRP list row: each tier in its own badge colours (--rating-*),
|
|
101
|
+
// "Keine Bewertung" grey; check icon for a good deal (Top/Guter Preis); the "4" footnote on all.
|
|
102
|
+
// A link to the page's "Preis & Marktwert" section when the page passes onShowPriceRating.
|
|
103
|
+
<span
|
|
104
|
+
className={onShowPriceRating ? 'vdp-rating-chip rating-link' : 'vdp-rating-chip'}
|
|
105
|
+
{...(onShowPriceRating
|
|
106
|
+
? ratingLinkProps(onShowPriceRating, t('autobahn:finance.priceRatingLink', { rating: t('autobahn:tier.' + vehicle.rating) }))
|
|
107
|
+
: {})}
|
|
116
108
|
>
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
109
|
+
<StatChip
|
|
110
|
+
rating={vehicle.rating}
|
|
111
|
+
icon={ratingTone(vehicle.rating) === 'good' ? 'check' : 'minus'}
|
|
112
|
+
>
|
|
113
|
+
{t('autobahn:tier.' + vehicle.rating)}
|
|
114
|
+
<sup>4</sup>
|
|
115
|
+
</StatChip>
|
|
116
|
+
</span>
|
|
120
117
|
)}
|
|
121
118
|
</div>
|
|
122
119
|
|
|
@@ -267,9 +264,9 @@ export const VdpHeaderCondition: React.FunctionComponent<VdpHeaderCardProps> = (
|
|
|
267
264
|
* is just the textual header card that sits beneath it. Desktop-only usage (mobile
|
|
268
265
|
* splits these 3 pieces across the "before/after finance card" layout — see the page).
|
|
269
266
|
*/
|
|
270
|
-
export const VdpHeaderCard: React.FunctionComponent<VdpHeaderCardProps> = ({ vehicle, t }) => (
|
|
267
|
+
export const VdpHeaderCard: React.FunctionComponent<VdpHeaderCardProps> = ({ vehicle, onShowPriceRating, t }) => (
|
|
271
268
|
<div className="mcard" style={{ marginTop: 16, padding: '18px 14px 18px' }}>
|
|
272
|
-
<VdpHeaderSummary vehicle={vehicle} t={t} />
|
|
269
|
+
<VdpHeaderSummary vehicle={vehicle} onShowPriceRating={onShowPriceRating} t={t} />
|
|
273
270
|
<div style={{ marginTop: 14 }}>
|
|
274
271
|
<VdpHeaderHighlights vehicle={vehicle} t={t} />
|
|
275
272
|
</div>
|
|
@@ -801,599 +798,6 @@ export const TrustStrip: React.FunctionComponent<TrustStripProps> = ({ items, t
|
|
|
801
798
|
</div>
|
|
802
799
|
);
|
|
803
800
|
|
|
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
801
|
// ---------------------------------------------------------------------------
|
|
1398
802
|
// Protection products (CNP Santander upsell) — optional, non-functional UI
|
|
1399
803
|
// ---------------------------------------------------------------------------
|
|
@@ -1705,6 +1109,9 @@ export interface VdpBottomBarProps {
|
|
|
1705
1109
|
leasingKeyFigures?: CreditKeyFiguresData;
|
|
1706
1110
|
/** opens the Finanzierungs-/Leasingdetails popup (expanded); when omitted the link is hidden. */
|
|
1707
1111
|
onShowDetails?: () => void;
|
|
1112
|
+
/** the price-rating badge + bar were clicked: the page scrolls to its "Preis & Marktwert"
|
|
1113
|
+
* section (#vdp-preis). Omit and they are not a link. */
|
|
1114
|
+
onShowPriceRating?: () => void;
|
|
1708
1115
|
/** whether leasing is actually offered for this car — see FinanceCalculatorProps.leasingAvailable
|
|
1709
1116
|
* for the full rationale. Default true keeps existing callers' behavior. */
|
|
1710
1117
|
leasingAvailable?: boolean;
|
|
@@ -1734,6 +1141,7 @@ export const VdpBottomBar: React.FunctionComponent<VdpBottomBarProps> = ({
|
|
|
1734
1141
|
creditKeyFigures,
|
|
1735
1142
|
leasingKeyFigures,
|
|
1736
1143
|
onShowDetails,
|
|
1144
|
+
onShowPriceRating,
|
|
1737
1145
|
leasingAvailable = true,
|
|
1738
1146
|
t,
|
|
1739
1147
|
}) => {
|
|
@@ -1748,14 +1156,9 @@ export const VdpBottomBar: React.FunctionComponent<VdpBottomBarProps> = ({
|
|
|
1748
1156
|
const tallBar =
|
|
1749
1157
|
!!(creditKeyFigures && hasCreditKeyFigures(creditKeyFigures)) || !!(leasingAvailable && leasingKeyFigures && hasCreditKeyFigures(leasingKeyFigures));
|
|
1750
1158
|
const rate = monthly != null ? monthly : vehicle.monthly;
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
const
|
|
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];
|
|
1159
|
+
// each tier shows its own real label (Top/Guter/Fairer/Erhöht/Hoher Preis), "Keine Bewertung"
|
|
1160
|
+
// grey without a marker; same derivation as FinanceCalculator (evalPillOf).
|
|
1161
|
+
const { tier: evalTier, label: evalTierLabel, color: evalPillColor, background: evalPillBackground } = evalPillOf(ratingLabel, t);
|
|
1759
1162
|
// condition summary — same wording/order as FinanceCalculator's own .fin-cond (financing
|
|
1760
1163
|
// "0 € Anzahlung · 60 Monate", leasing "0 € Sonderzahlung · 36 Mon. · 10.000 km/Jahr").
|
|
1761
1164
|
const condParts: string[] = [];
|
|
@@ -1927,7 +1330,12 @@ export const VdpBottomBar: React.FunctionComponent<VdpBottomBarProps> = ({
|
|
|
1927
1330
|
</div>
|
|
1928
1331
|
</div>
|
|
1929
1332
|
{ratingLabel && (
|
|
1930
|
-
<div
|
|
1333
|
+
<div
|
|
1334
|
+
className={onShowPriceRating ? 'bb-eval rating-link' : 'bb-eval'}
|
|
1335
|
+
{...(onShowPriceRating
|
|
1336
|
+
? ratingLinkProps(onShowPriceRating, t('autobahn:finance.priceRatingLink', { rating: evalTierLabel }))
|
|
1337
|
+
: {})}
|
|
1338
|
+
>
|
|
1931
1339
|
<span
|
|
1932
1340
|
className="fin-eval-pill"
|
|
1933
1341
|
style={{
|
|
@@ -1950,7 +1358,7 @@ export const VdpBottomBar: React.FunctionComponent<VdpBottomBarProps> = ({
|
|
|
1950
1358
|
}}
|
|
1951
1359
|
>
|
|
1952
1360
|
{evalTierLabel}
|
|
1953
|
-
|
|
1361
|
+
<sup>4</sup>
|
|
1954
1362
|
</span>
|
|
1955
1363
|
<EvalBar tier={evalTier} />
|
|
1956
1364
|
</div>
|
|
@@ -2171,6 +1579,9 @@ export interface FinanceDetailsModalProps {
|
|
|
2171
1579
|
onTermChange?: (term: number) => void;
|
|
2172
1580
|
onAnnualMileageChange?: (km: number) => void;
|
|
2173
1581
|
onClose: () => void;
|
|
1582
|
+
/** the price-rating badge + bar were clicked: the page closes the modal and scrolls to its
|
|
1583
|
+
* "Preis & Marktwert" section (#vdp-preis). Omit and they are not a link. */
|
|
1584
|
+
onShowPriceRating?: () => void;
|
|
2174
1585
|
/** opened directly via the page's Finanzierungs-/Leasingdetails link — the sheet opens
|
|
2175
1586
|
* scrolled to the breakdown instead of the "Rate anpassen" controls at its top. */
|
|
2176
1587
|
initialShowBreakdown?: boolean;
|
|
@@ -2254,6 +1665,7 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
|
|
|
2254
1665
|
onTermChange,
|
|
2255
1666
|
onAnnualMileageChange,
|
|
2256
1667
|
onClose,
|
|
1668
|
+
onShowPriceRating,
|
|
2257
1669
|
initialShowBreakdown,
|
|
2258
1670
|
skipInitialScroll,
|
|
2259
1671
|
ratingLabel,
|
|
@@ -2455,18 +1867,9 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
|
|
|
2455
1867
|
: isLease
|
|
2456
1868
|
? t('autobahn:modal.sheetTitleLeasing')
|
|
2457
1869
|
: 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];
|
|
1870
|
+
// price-evaluation pill + bar — identical derivation to the collapsed card (FinanceCalculator's
|
|
1871
|
+
// evalPillOf), so the modal's pill has the same label and colour as the card that opened it.
|
|
1872
|
+
const { tier: evalTier, isGood: isGoodTier, label: evalTierLabel, color: evalPillColor, background: evalPillBackground } = evalPillOf(ratingLabel, t);
|
|
2470
1873
|
// adjustable only for fin/leasing, and only when the page supplies the change handlers + bounds.
|
|
2471
1874
|
const adjustable = mode !== 'cash' && !!onDownChange && downMin != null && downMax != null && termMin != null && termMax != null;
|
|
2472
1875
|
// discrete term chip values (supplied periods, else derived from the bounds).
|
|
@@ -2826,16 +2229,15 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
|
|
|
2826
2229
|
)}
|
|
2827
2230
|
</div>
|
|
2828
2231
|
</div>
|
|
2829
|
-
<div
|
|
2232
|
+
<div
|
|
2233
|
+
className={ratingLabel && onShowPriceRating ? 'fin-eval-col rating-link' : 'fin-eval-col'}
|
|
2234
|
+
{...(ratingLabel && onShowPriceRating
|
|
2235
|
+
? ratingLinkProps(onShowPriceRating, t('autobahn:finance.priceRatingLink', { rating: evalTierLabel }))
|
|
2236
|
+
: {})}
|
|
2237
|
+
>
|
|
2830
2238
|
<div className="fin-eval-pill-cell">
|
|
2831
2239
|
{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>
|
|
2240
|
+
<EvalPill label={evalTierLabel} color={evalPillColor} background={evalPillBackground} good={isGoodTier} />
|
|
2839
2241
|
)}
|
|
2840
2242
|
</div>
|
|
2841
2243
|
<div className="fin-eval-bar-cell">{ratingLabel && <EvalBar tier={evalTier} />}</div>
|
|
@@ -3363,16 +2765,15 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
|
|
|
3363
2765
|
)}
|
|
3364
2766
|
</div>
|
|
3365
2767
|
</div>
|
|
3366
|
-
<div
|
|
2768
|
+
<div
|
|
2769
|
+
className={ratingLabel && onShowPriceRating ? 'fin-eval-col rating-link' : 'fin-eval-col'}
|
|
2770
|
+
{...(ratingLabel && onShowPriceRating
|
|
2771
|
+
? ratingLinkProps(onShowPriceRating, t('autobahn:finance.priceRatingLink', { rating: evalTierLabel }))
|
|
2772
|
+
: {})}
|
|
2773
|
+
>
|
|
3367
2774
|
<div className="fin-eval-pill-cell">
|
|
3368
2775
|
{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>
|
|
2776
|
+
<EvalPill label={evalTierLabel} color={evalPillColor} background={evalPillBackground} good={isGoodTier} />
|
|
3376
2777
|
)}
|
|
3377
2778
|
</div>
|
|
3378
2779
|
<div className="fin-eval-bar-cell">{ratingLabel && <EvalBar tier={evalTier} />}</div>
|