@bytebrand/fe-ui-core-autobahn 1.0.211 → 1.0.213
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cards/CarCard.tsx +51 -13
- package/cards/CarRow.tsx +5 -1
- package/cards/cardParts.tsx +11 -1
- package/constants/app.ts +11 -1
- package/constants/core.ts +12 -1
- package/locales/de/autobahn.json +11 -1
- package/locales/en/autobahn.json +11 -1
- package/package.json +30 -30
- package/theme/md3.css +135 -185
- package/ui/Stars.tsx +36 -18
- package/vdp/VdpModules.tsx +135 -621
- package/vdp/index.ts +6 -3
- package/vdp/types.ts +20 -10
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,22 @@
|
|
|
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, CreditKeyFigures, Dropdown, DropdownOption, hasCreditKeyFigures, Icon, Spec, StatChip, Stars } from '../ui';
|
|
28
|
+
import { Button, CreditCostNotice, CreditKeyFigures, Dropdown, DropdownOption, hasCreditKeyFigures, Icon, Modal, Spec, StatChip, Stars } from '../ui';
|
|
28
29
|
import type { CreditKeyFiguresData } from '../ui';
|
|
29
30
|
import { CO2_CLASSES, CO2_COLORS, TIER_LABELS, TIER_KEYS, TIER_COLORS, TIER_BACKGROUNDS } from '../constants';
|
|
30
|
-
import { defaultVdpSpecs, EquipmentGroups,
|
|
31
|
+
import { defaultVdpSpecs, EquipmentGroups, VehicleDetail, VdpSpec, VdpReview, RatingPortal, RunningCostRow, EnergyTaxSummary } from './types';
|
|
31
32
|
import { AddServicesTooltipBody, CalcRow, DocCheckIcon, EvalBar, expanderBtnStyle, FinanceMode, Slider, TermChips, ToggleRow } from './FinanceCalculator';
|
|
32
33
|
import { formatEur as eur, formatEurCents as eurCents, formatPct as pct } from '../utils/financeFormat';
|
|
33
34
|
|
|
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
35
|
/** mileage → 'X.XXX km' (de-DE grouping). */
|
|
54
36
|
function fmtKm(n: number): string {
|
|
55
37
|
return `${n.toLocaleString('de-DE')} km`;
|
|
@@ -801,599 +783,6 @@ export const TrustStrip: React.FunctionComponent<TrustStripProps> = ({ items, t
|
|
|
801
783
|
</div>
|
|
802
784
|
);
|
|
803
785
|
|
|
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
786
|
// ---------------------------------------------------------------------------
|
|
1398
787
|
// Protection products (CNP Santander upsell) — optional, non-functional UI
|
|
1399
788
|
// ---------------------------------------------------------------------------
|
|
@@ -3984,12 +3373,131 @@ export const ReviewsTeaser: React.FunctionComponent<ReviewsTeaserProps> = ({ cou
|
|
|
3984
3373
|
);
|
|
3985
3374
|
};
|
|
3986
3375
|
|
|
3376
|
+
/** rel for every link to a review portal: no SEO weight passed on, no window.opener. */
|
|
3377
|
+
export const REVIEW_LINK_REL = 'nofollow noopener noreferrer';
|
|
3378
|
+
|
|
3379
|
+
/** "2026-11-12" → "12.11.2026" ('' for anything else). */
|
|
3380
|
+
const reviewDate = (iso?: string): string =>
|
|
3381
|
+
/^\d{4}-\d{2}-\d{2}$/.test(String(iso || '')) ? String(iso).split('-').reverse().join('.') : '';
|
|
3382
|
+
|
|
3383
|
+
/**
|
|
3384
|
+
* A portal's rating with one decimal, cut (never rounded up): Trustpilot's 4,47 reads 4,4 —
|
|
3385
|
+
* what its own profile page shows — and no portal is ever shown better than it is.
|
|
3386
|
+
*/
|
|
3387
|
+
const portalRating = (value: number | null): string =>
|
|
3388
|
+
value == null ? '–' : (Math.floor(value * 10 + 1e-9) / 10).toLocaleString('de-DE', { minimumFractionDigits: 1, maximumFractionDigits: 1 });
|
|
3389
|
+
|
|
3390
|
+
export interface ReviewSourceCaptionProps {
|
|
3391
|
+
/** portal display name, e.g. "Trustpilot" (nothing renders without it). */
|
|
3392
|
+
source?: string;
|
|
3393
|
+
/** ISO yyyy-mm-dd. */
|
|
3394
|
+
date?: string;
|
|
3395
|
+
/** the review on its portal — the caption becomes a nofollow link when set. */
|
|
3396
|
+
url?: string;
|
|
3397
|
+
className?: string;
|
|
3398
|
+
style?: React.CSSProperties;
|
|
3399
|
+
t: TranslationFunction;
|
|
3400
|
+
}
|
|
3401
|
+
|
|
3402
|
+
/** "Trustpilot-Bewertung · 12.11.2026" — linked to that very review on the portal. */
|
|
3403
|
+
export const ReviewSourceCaption: React.FunctionComponent<ReviewSourceCaptionProps> = ({ source, date, url, className, style, t }) => {
|
|
3404
|
+
if (!source) return null;
|
|
3405
|
+
const d = reviewDate(date);
|
|
3406
|
+
const label = `${t('autobahn:reviews.sourceReview', { portal: source })}${d ? ` · ${d}` : ''}`;
|
|
3407
|
+
const cls = ['review-source', className].filter(Boolean).join(' ');
|
|
3408
|
+
return url ? (
|
|
3409
|
+
<a className={cls} style={style} href={url} target="_blank" rel={REVIEW_LINK_REL}>
|
|
3410
|
+
{label}
|
|
3411
|
+
</a>
|
|
3412
|
+
) : (
|
|
3413
|
+
<span className={cls} style={style}>{label}</span>
|
|
3414
|
+
);
|
|
3415
|
+
};
|
|
3416
|
+
|
|
3417
|
+
export interface RatingSourcesInfoProps {
|
|
3418
|
+
/** the site-wide average the popup explains (same value as next to the button). */
|
|
3419
|
+
average: number;
|
|
3420
|
+
/** the site-wide review count. */
|
|
3421
|
+
total: number;
|
|
3422
|
+
/** the portals behind it (Bewertung Welt `summary.portals`); no button without any. */
|
|
3423
|
+
portals: RatingPortal[];
|
|
3424
|
+
/** icon size (default 18). */
|
|
3425
|
+
size?: number;
|
|
3426
|
+
/** icon colour (default on-surface-variant). */
|
|
3427
|
+
color?: string;
|
|
3428
|
+
t: TranslationFunction;
|
|
3429
|
+
}
|
|
3430
|
+
|
|
3431
|
+
/**
|
|
3432
|
+
* "ⓘ" next to the site rating → a popup that explains it: the rating of each portal (Google,
|
|
3433
|
+
* Trustpilot) with its review count and a nofollow link to all auto.de reviews there, then the
|
|
3434
|
+
* combined, count-weighted average that the page shows.
|
|
3435
|
+
*/
|
|
3436
|
+
export const RatingSourcesInfo: React.FunctionComponent<RatingSourcesInfoProps> = ({ average, total, portals, size = 18, color, t }) => {
|
|
3437
|
+
const [open, setOpen] = useState(false);
|
|
3438
|
+
const list = (portals || []).filter((p) => p && p.name && p.total > 0);
|
|
3439
|
+
if (!list.length) return null;
|
|
3440
|
+
const names = list.map((p) => p.name).join(` ${t('autobahn:reviews.sources.and')} `);
|
|
3441
|
+
const avg = average.toLocaleString('de-DE', { minimumFractionDigits: 1, maximumFractionDigits: 1 });
|
|
3442
|
+
return (
|
|
3443
|
+
<>
|
|
3444
|
+
<button
|
|
3445
|
+
type="button"
|
|
3446
|
+
className="rating-info-btn"
|
|
3447
|
+
aria-label={t('autobahn:reviews.sources.open')}
|
|
3448
|
+
aria-haspopup="dialog"
|
|
3449
|
+
title={t('autobahn:reviews.sources.open')}
|
|
3450
|
+
onClick={(e) => {
|
|
3451
|
+
e.stopPropagation();
|
|
3452
|
+
setOpen(true);
|
|
3453
|
+
}}
|
|
3454
|
+
>
|
|
3455
|
+
<Icon name="info" size={size} color={color || 'var(--md-on-surface-variant)'} style={{ width: size, height: size }} />
|
|
3456
|
+
</button>
|
|
3457
|
+
<Modal open={open} onClose={() => setOpen(false)} size="sm" title={t('autobahn:reviews.sources.title')} className="rating-sources">
|
|
3458
|
+
<p className="md-body" style={{ margin: '0 0 16px', color: 'var(--md-on-surface-variant)' }}>
|
|
3459
|
+
{t('autobahn:reviews.sources.intro', { portals: names })}
|
|
3460
|
+
</p>
|
|
3461
|
+
<ul className="rating-sources-list">
|
|
3462
|
+
{list.map((p) => (
|
|
3463
|
+
<li key={p.source || p.name} className="rating-sources-row">
|
|
3464
|
+
<span className="rating-sources-name">{p.name}</span>
|
|
3465
|
+
<span className="rating-sources-score">
|
|
3466
|
+
<Stars value={p.average || 0} size={16} />
|
|
3467
|
+
<b className="num">{portalRating(p.average)}</b>
|
|
3468
|
+
</span>
|
|
3469
|
+
<span className="rating-sources-count">{t('autobahn:reviews.ratingCount', { count: p.total })}</span>
|
|
3470
|
+
{p.url ? (
|
|
3471
|
+
<a className="rating-sources-link" href={p.url} target="_blank" rel={REVIEW_LINK_REL}>
|
|
3472
|
+
{t('autobahn:reviews.sources.allOn', { portal: p.name })}
|
|
3473
|
+
<Icon name="external-link" size={14} />
|
|
3474
|
+
</a>
|
|
3475
|
+
) : (
|
|
3476
|
+
<span />
|
|
3477
|
+
)}
|
|
3478
|
+
</li>
|
|
3479
|
+
))}
|
|
3480
|
+
<li className="rating-sources-row rating-sources-row--total">
|
|
3481
|
+
<span className="rating-sources-name">{t('autobahn:reviews.sources.total')}</span>
|
|
3482
|
+
<span className="rating-sources-score">
|
|
3483
|
+
<Stars value={average} size={16} />
|
|
3484
|
+
<b className="num">{avg}</b>
|
|
3485
|
+
</span>
|
|
3486
|
+
<span className="rating-sources-count">{t('autobahn:reviews.ratingCount', { count: total })}</span>
|
|
3487
|
+
<span className="rating-sources-note">{t('autobahn:reviews.sources.weighted')}</span>
|
|
3488
|
+
</li>
|
|
3489
|
+
</ul>
|
|
3490
|
+
</Modal>
|
|
3491
|
+
</>
|
|
3492
|
+
);
|
|
3493
|
+
};
|
|
3494
|
+
|
|
3987
3495
|
export interface CustomerRatingsProps {
|
|
3988
3496
|
/** the loaded reviews (REAL — Bewertung Welt via fe-landing's /angebot/customer-quotes). */
|
|
3989
3497
|
reviews: VdpReview[];
|
|
3990
3498
|
/**
|
|
3991
3499
|
* Overall auto.de rating to display instead of the average of the few loaded
|
|
3992
|
-
* reviews (
|
|
3500
|
+
* reviews (only the newest few are loaded, not all of them). The page passes
|
|
3993
3501
|
* the real site-wide aggregate.
|
|
3994
3502
|
*/
|
|
3995
3503
|
average?: number;
|
|
@@ -4000,6 +3508,8 @@ export interface CustomerRatingsProps {
|
|
|
4000
3508
|
total?: number;
|
|
4001
3509
|
/** portals the average/total come from, e.g. "Google & Trustpilot" (default "Google"). */
|
|
4002
3510
|
sourceLabel?: string;
|
|
3511
|
+
/** per-portal figures + profile links → the "ⓘ" popup after the rating (none → no button). */
|
|
3512
|
+
portals?: RatingPortal[];
|
|
4003
3513
|
/** i18n function (drilled from the page). */
|
|
4004
3514
|
t: TranslationFunction;
|
|
4005
3515
|
}
|
|
@@ -4012,7 +3522,7 @@ export interface CustomerRatingsProps {
|
|
|
4012
3522
|
* the WordPress json-quotes feed); the page loads them and passes them in. When no
|
|
4013
3523
|
* reviews load, the page renders nothing (no fabricated content).
|
|
4014
3524
|
*/
|
|
4015
|
-
export const CustomerRatings: React.FunctionComponent<CustomerRatingsProps> = ({ reviews, average, total, sourceLabel, t }) => {
|
|
3525
|
+
export const CustomerRatings: React.FunctionComponent<CustomerRatingsProps> = ({ reviews, average, total, sourceLabel, portals, t }) => {
|
|
4016
3526
|
const [showAll, setShowAll] = useState(false);
|
|
4017
3527
|
if (!reviews || !reviews.length) return null;
|
|
4018
3528
|
const count = reviews.length;
|
|
@@ -4031,8 +3541,11 @@ export const CustomerRatings: React.FunctionComponent<CustomerRatingsProps> = ({
|
|
|
4031
3541
|
</span>
|
|
4032
3542
|
<span>
|
|
4033
3543
|
<Stars value={avg} size={16} />
|
|
4034
|
-
<span className="md-label-sm" style={{ display: '
|
|
3544
|
+
<span className="md-label-sm" style={{ display: 'flex', alignItems: 'center', gap: 2 }}>
|
|
4035
3545
|
{t('autobahn:reviews.ratingCount', { count: headerCount })} · via {sourceLabel || 'Google'}
|
|
3546
|
+
{portals && portals.length > 0 && (
|
|
3547
|
+
<RatingSourcesInfo average={avg} total={headerCount} portals={portals} size={16} t={t} />
|
|
3548
|
+
)}
|
|
4036
3549
|
</span>
|
|
4037
3550
|
</span>
|
|
4038
3551
|
</div>
|
|
@@ -4077,9 +3590,10 @@ export const CustomerRatings: React.FunctionComponent<CustomerRatingsProps> = ({
|
|
|
4077
3590
|
<Stars value={r.rating} />
|
|
4078
3591
|
</div>
|
|
4079
3592
|
</div>
|
|
4080
|
-
<p className="md-body-sm review-card-text" style={{ margin: 0, color: 'var(--md-on-surface-variant)' }}>
|
|
3593
|
+
<p className="md-body-sm review-card-text" title={r.review} style={{ margin: 0, color: 'var(--md-on-surface-variant)' }}>
|
|
4081
3594
|
{r.review}
|
|
4082
3595
|
</p>
|
|
3596
|
+
<ReviewSourceCaption source={r.source} date={r.date} url={r.url} className="review-card-source md-label-sm" t={t} />
|
|
4083
3597
|
</div>
|
|
4084
3598
|
))}
|
|
4085
3599
|
</div>
|