@bytebrand/fe-ui-core-autobahn 1.0.228 → 1.0.231

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.
Files changed (62) hide show
  1. package/campaign/CampaignBand.tsx +26 -26
  2. package/campaign/CampaignBanner.tsx +86 -0
  3. package/campaign/CampaignBar.tsx +37 -0
  4. package/campaign/CampaignHero.tsx +56 -0
  5. package/campaign/CampaignSwitch.tsx +43 -0
  6. package/campaign/campaignVars.ts +12 -12
  7. package/campaign/campaigns.ts +77 -74
  8. package/campaign/index.ts +18 -6
  9. package/campaign/openInApp.ts +8 -0
  10. package/campaign/useCountdown.ts +28 -0
  11. package/cards/CarCard.tsx +407 -393
  12. package/cards/CarCardSkeleton.tsx +103 -0
  13. package/cards/CarRow.tsx +46 -22
  14. package/cards/CarRowSkeleton.tsx +152 -0
  15. package/cards/cardParts.tsx +53 -18
  16. package/cards/dealSignals.ts +36 -36
  17. package/cards/index.ts +6 -0
  18. package/chrome/AccountMenuIcon.tsx +109 -0
  19. package/chrome/Footer.tsx +16 -3
  20. package/chrome/TopBar.tsx +139 -266
  21. package/compat/CookieModal/CookieModal.tsx +20 -6
  22. package/compat/CookieModal/Modal.tsx +6 -3
  23. package/compat/CookieModal/modals/ManageCookieModal/ManageCookieModal.tsx +43 -15
  24. package/compat/CookieModal/modals/PreviewCookieModal/PreviewCookieModal.tsx +4 -3
  25. package/compat/CookieModal/useModal.ts +5 -1
  26. package/compat/Loader/Loader.tsx +1 -7
  27. package/compat/MdField/MdField.tsx +28 -4
  28. package/compat/PriceRating/PriceRating.styl +5 -7
  29. package/compat/PriceRatingDetailed/PriceRatingDetailed.styl +8 -6
  30. package/compat/TimePicker/TimePicker.tsx +12 -2
  31. package/compat/legacy-theme/priceReviewColors.styl +18 -5
  32. package/constants/autobahn.ts +39 -0
  33. package/data/fieldMapping.ts +3 -3
  34. package/data/toAutobahnCar.ts +30 -14
  35. package/iconsvg/IconSVG.tsx +1 -5
  36. package/index.ts +19 -19
  37. package/locales/de/autobahn.json +925 -862
  38. package/locales/en/autobahn.json +925 -862
  39. package/package.json +2 -2
  40. package/theme/md3.css +16518 -11808
  41. package/ui/Dropdown.tsx +29 -10
  42. package/ui/FormCheckbox.tsx +22 -2
  43. package/ui/FormField.tsx +2 -1
  44. package/ui/Icon.tsx +6 -0
  45. package/ui/MfieldCheckIcon.tsx +13 -0
  46. package/ui/Modal.tsx +84 -6
  47. package/ui/Skeleton.tsx +79 -20
  48. package/ui/Stars.tsx +36 -18
  49. package/ui/StatChip.tsx +8 -3
  50. package/ui/index.ts +3 -0
  51. package/ui/ratingLink.ts +36 -0
  52. package/ui/scrollFieldIntoView.ts +41 -0
  53. package/ui/usePortalMenuPosition.ts +27 -15
  54. package/utils/cookieConsent.ts +84 -0
  55. package/utils/index.ts +10 -0
  56. package/vdp/FinanceCalculator.tsx +162 -34
  57. package/vdp/VdpModules.tsx +348 -976
  58. package/vdp/index.ts +6 -3
  59. package/vdp/types.ts +25 -15
  60. package/vehiclesProps/accidentDisclosure.ts +25 -0
  61. package/vehiclesProps/decoratedLightProps.tsx +4 -0
  62. package/vehiclesProps/decoratedProps.tsx +4 -0
@@ -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)` / `car.priceHistory` / market band → typed props on VehicleDetail
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 — see PriceHistory (whole
20
- // card) and its market band.
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 type { CreditKeyFiguresData } from '../ui';
29
- import { CO2_CLASSES, CO2_COLORS, TIER_LABELS, TIER_KEYS, TIER_COLORS, TIER_BACKGROUNDS } from '../constants';
30
- import { defaultVdpSpecs, EquipmentGroups, PriceRatingBands, VehicleDetail, VdpSpec, VdpReview, RunningCostRow, EnergyTaxSummary } from './types';
31
- import { AddServicesTooltipBody, CalcRow, DocCheckIcon, EvalBar, expanderBtnStyle, FinanceMode, Slider, TermChips, ToggleRow } from './FinanceCalculator';
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, DetailsLink, 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]> = [
@@ -93,7 +79,7 @@ export const VdpHeaderSummary: React.FunctionComponent<VdpHeaderCardProps> = ({
93
79
  ['zap', extractPS(vehicle.power)],
94
80
  ['fuel', stripParen(vehicle.fuel)],
95
81
  ['cog', vehicle.gear],
96
- ['user', t('autobahn:header.owners', { owners: vehicle.owners, count: vehicle.owners })],
82
+ ...(vehicle.owners == null ? [] : ([['user', t('autobahn:header.owners', { owners: vehicle.owners, count: vehicle.owners })]] as const)),
97
83
  ];
98
84
  return (
99
85
  <>
@@ -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
- <StatChip
114
- tone={vehicle.rating === 'fair' ? 'warn' : 'good'}
115
- icon={vehicle.rating === 'fair' ? 'minus' : 'check'}
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
- {t('autobahn:tier.' + vehicle.rating)}
118
- {vehicle.rating !== 'fair' && <sup>4</sup>}
119
- </StatChip>
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
 
@@ -143,7 +139,7 @@ export const VdpFactsGrid: React.FunctionComponent<VdpHeaderCardProps> = ({ vehi
143
139
  ['calendar', vehicle.reg],
144
140
  ['cog', vehicle.gear],
145
141
  ['fuel', stripParen(vehicle.fuel)],
146
- ['user', t('autobahn:header.owners', { owners: vehicle.owners, count: vehicle.owners })],
142
+ ...(vehicle.owners == null ? [] : ([['user', t('autobahn:header.owners', { owners: vehicle.owners, count: vehicle.owners })]] as const)),
147
143
  ...(vehicle.body ? ([['car-front', vehicle.body]] as const) : []),
148
144
  ];
149
145
  return (
@@ -217,7 +213,7 @@ export const VdpHeaderCondition: React.FunctionComponent<VdpHeaderCardProps> = (
217
213
  // only the Garantie tile has one, linking out to auto.de's warranty policy page.
218
214
  const tiles: ReadonlyArray<readonly [string, string, string, string?]> = [
219
215
  ['wrench', t('autobahn:header.huLabel'), condition.hu === 'Neu' ? t('autobahn:header.huNew') : t('autobahn:header.huUntil', { date: condition.hu })],
220
- ['shield-check', t('autobahn:header.accidentFree'), condition.unfallfrei ? t('autobahn:header.yes') : t('autobahn:header.no')],
216
+ ['shield-check', t('autobahn:header.accidentFree'), condition.unfallfrei == null ? t('autobahn:header.notSpecified', { defaultValue: 'keine Angabe' }) : condition.unfallfrei ? t('autobahn:header.yes') : t('autobahn:header.no')],
221
217
  ['clipboard-check', t('autobahn:header.serviceHistory'), condition.scheckheft ? t('autobahn:header.yes') : t('autobahn:header.no')],
222
218
  ['award', t('autobahn:header.warranty'), condition.garantie, 'https://www.auto.de/garantie/'],
223
219
  ];
@@ -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
  // ---------------------------------------------------------------------------
@@ -1607,12 +1010,19 @@ export interface VdpStickyBarProps {
1607
1010
  show: boolean;
1608
1011
  /** primary CTA click. */
1609
1012
  onSecure?: () => void;
1013
+ /** active tab of the calculator: Leasing shows the leasing rate, every other tab the financing rate. */
1014
+ mode?: FinanceMode;
1015
+ /**
1016
+ * Opens the details of the rate shown here (ADV-438): the "ⓘ" after "/mtl.", the same one as in
1017
+ * front of "Finanzierungs-Details" next to the auto.de-ID. No handler → no "ⓘ".
1018
+ */
1019
+ onShowDetails?: () => void;
1610
1020
  /** i18n function (drilled from the page). */
1611
1021
  t: TranslationFunction;
1612
1022
  }
1613
1023
 
1614
1024
  /** Desktop sticky summary bar (AS24 pattern) — docks to top, driven by `show`. */
1615
- export const VdpStickyBar: React.FunctionComponent<VdpStickyBarProps> = ({ vehicle, image, show, onSecure, t }) => (
1025
+ export const VdpStickyBar: React.FunctionComponent<VdpStickyBarProps> = ({ vehicle, image, show, onSecure, mode, onShowDetails, t }) => (
1616
1026
  <div className={'vdp-stickytop hide-mobile' + (show ? ' vdp-stickytop--on' : '')}>
1617
1027
  <div className="container" style={{ display: 'flex', alignItems: 'center', gap: 18, padding: '10px 24px' }}>
1618
1028
  <img
@@ -1636,15 +1046,21 @@ export const VdpStickyBar: React.FunctionComponent<VdpStickyBarProps> = ({ vehic
1636
1046
  {fmtKm(vehicle.km)} · {vehicle.reg} · {vehicle.gear}
1637
1047
  </div>
1638
1048
  </div>
1639
- <div style={{ textAlign: 'right', flex: 'none' }}>
1640
- <div style={{ display: 'flex', alignItems: 'baseline', gap: 4, justifyContent: 'flex-end' }}>
1641
- <span className="md-label-sm">{t('autobahn:sticky.from')}</span>
1642
- <span className="num" style={{ fontWeight: 700, fontSize: 20, color: 'var(--md-primary)', letterSpacing: '-.4px' }}>
1643
- {vehicle.monthly} €
1644
- </span>
1645
- <span className="md-label-sm">{t('autobahn:sticky.perMonth')}</span>
1049
+ <div className="vdp-sticky-price">
1050
+ <div className="vdp-sticky-rate">
1051
+ <span>{t('autobahn:sticky.from')}</span>
1052
+ <span className="num">{eur(Math.round(vehicle.monthly))} €</span>
1053
+ <span>{t('autobahn:sticky.perMonth')}</span>
1646
1054
  </div>
1647
- <div className="md-label-sm">{t('autobahn:sticky.purchasePrice', { price: eur(vehicle.price) })}</div>
1055
+ {onShowDetails && (
1056
+ <DetailsLink
1057
+ iconOnly
1058
+ label={mode === 'leasing' ? t('autobahn:finance.leasingDetails') : t('autobahn:finance.financingDetails')}
1059
+ onClick={onShowDetails}
1060
+ tabIndex={show ? undefined : -1}
1061
+ />
1062
+ )}
1063
+ <div className="vdp-sticky-buy">{t('autobahn:sticky.purchasePrice', { price: eur(vehicle.price) })}</div>
1648
1064
  </div>
1649
1065
  <Button variant="filled" icon="shield-check" style={{ flex: 'none' }} onClick={onSecure}>
1650
1066
  {t('autobahn:sticky.secureOffer')}
@@ -1658,7 +1074,6 @@ export const VdpStickyBar: React.FunctionComponent<VdpStickyBarProps> = ({ vehic
1658
1074
  // ---------------------------------------------------------------------------
1659
1075
 
1660
1076
  export interface VdpBottomBarProps {
1661
- vehicle: VehicleDetail;
1662
1077
  /**
1663
1078
  * Whether the bar is docked/visible — page-owned scroll-position toggle: shows after scrolling
1664
1079
  * past the main offer card (same STICKY_SHOW_AT threshold VdpStickyBar uses), and additionally
@@ -1667,16 +1082,10 @@ export interface VdpBottomBarProps {
1667
1082
  * VdpStickyBar's own `show` (the desktop bar has no such lower boundary).
1668
1083
  */
1669
1084
  show: boolean;
1670
- /** active payment mode — drives the tabs + the displayed figure (rate vs price). */
1085
+ /** active payment mode — drives the tabs (and hides "Rate anpassen" on Kaufen). */
1671
1086
  mode?: FinanceMode;
1672
1087
  /** mode tab tapped; when omitted the tabs row is not rendered. */
1673
1088
  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
1089
  /** primary CTA click. */
1681
1090
  onSecure?: () => void;
1682
1091
  /** true once the customer already has an offer request/checkout in progress for this car —
@@ -1689,22 +1098,6 @@ export interface VdpBottomBarProps {
1689
1098
  onCall?: () => void;
1690
1099
  /** opens the "Rate anpassen" sheet; when omitted the button is not rendered. */
1691
1100
  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
1101
  /** whether leasing is actually offered for this car — see FinanceCalculatorProps.leasingAvailable
1709
1102
  * for the full rationale. Default true keeps existing callers' behavior. */
1710
1103
  leasingAvailable?: boolean;
@@ -1712,86 +1105,24 @@ export interface VdpBottomBarProps {
1712
1105
  t: TranslationFunction;
1713
1106
  }
1714
1107
 
1715
- /** Mobile sticky bottom bar (Figma "Sticky Footer"): mode tabs, rate + price rating,
1716
- * then Angebot anfragen · phone · Rate anpassen. No struck old rate — there is no
1717
- * real previous-rate source (needs-data discipline), so nothing is fabricated. */
1108
+ /** Mobile sticky bottom bar (Figma "Sticky Footer"): mode tabs, then Angebot anfragen · phone ·
1109
+ * Rate anpassen. ADV-436: nothing else — the rate, the price rating, the conditions / key figures
1110
+ * and the credit-cost warning made the bar too tall; they stay in the offer card above. */
1718
1111
  export const VdpBottomBar: React.FunctionComponent<VdpBottomBarProps> = ({
1719
- vehicle,
1720
1112
  show,
1721
1113
  mode = 'fin',
1722
1114
  onModeChange,
1723
- monthly,
1724
- oldMonthly,
1725
- ratingLabel,
1726
1115
  onSecure,
1727
1116
  secured,
1728
1117
  secureLabel,
1729
1118
  onCall,
1730
1119
  onOpenAdjust,
1731
- down,
1732
- term,
1733
- annualMileage,
1734
- creditKeyFigures,
1735
- leasingKeyFigures,
1736
- onShowDetails,
1737
1120
  leasingAvailable = true,
1738
1121
  t,
1739
1122
  }) => {
1740
- const [uvpTooltipOpen, setUvpTooltipOpen] = useState(false);
1741
1123
  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
1124
  return (
1794
- <div className={'vdp-bottom-bar show-mobile' + (show ? ' vdp-bottom-bar--on' : '') + (tallBar ? ' vdp-bottom-bar--kf' : '')}>
1125
+ <div className={'vdp-bottom-bar show-mobile' + (show ? ' vdp-bottom-bar--on' : '')}>
1795
1126
  {onModeChange && (
1796
1127
  <div className="fin-tabs bb-tabs" role="tablist">
1797
1128
  {(
@@ -1814,183 +1145,6 @@ export const VdpBottomBar: React.FunctionComponent<VdpBottomBarProps> = ({
1814
1145
  ))}
1815
1146
  </div>
1816
1147
  )}
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
1148
  <div className="bb-cta-row">
1995
1149
  <Button
1996
1150
  variant="filled"
@@ -2171,8 +1325,13 @@ export interface FinanceDetailsModalProps {
2171
1325
  onTermChange?: (term: number) => void;
2172
1326
  onAnnualMileageChange?: (km: number) => void;
2173
1327
  onClose: () => void;
2174
- /** opened directly via the page's Finanzierungs-/Leasingdetails link — the sheet opens
2175
- * scrolled to the breakdown instead of the "Rate anpassen" controls at its top. */
1328
+ /** the price-rating badge + bar were clicked: the page closes the modal and scrolls to its
1329
+ * "Preis & Marktwert" section (#vdp-preis). Omit and they are not a link. */
1330
+ onShowPriceRating?: () => void;
1331
+ /** opened directly via the page's Finanzierungs-/Leasingdetails link — on mobile the sheet
1332
+ * opens expanded (full height) instead of sized to the "Rate anpassen" controls. It always
1333
+ * opens at its top: no automatic scroll down to the "Repräsentatives Beispiel" (auto.de
1334
+ * feedback 25.11), neither in the mobile sheet nor in the desktop popup. */
2176
1335
  initialShowBreakdown?: boolean;
2177
1336
  /** mobile only — price-rating label, drives the eval pill/bar (same as the collapsed card). */
2178
1337
  ratingLabel?: string;
@@ -2202,6 +1361,10 @@ export interface FinanceDetailsModalProps {
2202
1361
  leasingAvailable?: boolean;
2203
1362
  /** i18n function (drilled from the page). */
2204
1363
  t: TranslationFunction;
1364
+ /** overrides the desktop dialog heading (default: the mode's own, shorter "Details" text) —
1365
+ * a consumer whose own trigger already carries a specific label (e.g. checkout's cf-details
1366
+ * button, "Finanzierungsdetails"/"Leasingdetails") can pass that same text through here. */
1367
+ titleOverride?: string;
2205
1368
  }
2206
1369
 
2207
1370
  /**
@@ -2244,6 +1407,7 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
2244
1407
  onTermChange,
2245
1408
  onAnnualMileageChange,
2246
1409
  onClose,
1410
+ onShowPriceRating,
2247
1411
  initialShowBreakdown,
2248
1412
  ratingLabel,
2249
1413
  available,
@@ -2259,6 +1423,7 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
2259
1423
  onToggleAddServices,
2260
1424
  leasingAvailable = true,
2261
1425
  t,
1426
+ titleOverride,
2262
1427
  }) => {
2263
1428
  // same "UVP-Rate"/list-price footnote badge + popover as FinanceCalculator's own hero — this
2264
1429
  // modal's mobile "Rate anpassen" sheet renders its own separate copy of that hero row, so it
@@ -2268,10 +1433,7 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
2268
1433
  // anpassen") or expanded (opened directly via the page's details link) — reset on every open,
2269
1434
  // since this component stays mounted (the page always renders it, gated by `open`).
2270
1435
  const [showBreakdown, setShowBreakdown] = React.useState(!!initialShowBreakdown);
2271
- // Desktop always shows the breakdown inline but it can sit below the fold of .fin-modal-body's
2272
- // own scroll area too — whichever of the two refs is actually visible (show-mobile/hide-mobile
2273
- // via CSS) is the one scrolled to.
2274
- const desktopBreakdownRef = React.useRef<HTMLDivElement | null>(null);
1436
+ // the mobile sheet's breakdown — the in-sheet details link scrolls to it.
2275
1437
  const mobileBreakdownRef = React.useRef<HTMLDivElement | null>(null);
2276
1438
  // mobile (ADV-276): the sheet opens sized to its rate controls — its bottom edge sits right
2277
1439
  // under the "Finanzierungs-/Leasing-Details" link (the [data-sheet-fold] element; on Kaufen its
@@ -2358,17 +1520,11 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
2358
1520
  React.useEffect(() => {
2359
1521
  if (!open) setSheetAnimated(false);
2360
1522
  }, [open]);
2361
- // opened directly via the page's details link: open expanded and scrolled to the breakdown.
1523
+ // opened directly via the page's details link: the mobile sheet opens expanded, but at its top —
1524
+ // no auto-scroll to the "Repräsentatives Beispiel" (auto.de feedback 25.11).
2362
1525
  React.useEffect(() => {
2363
1526
  if (!open) return;
2364
1527
  setShowBreakdown(!!initialShowBreakdown);
2365
- if (!initialShowBreakdown) return;
2366
- const timer = window.setTimeout(() => {
2367
- if (mobileBreakdownRef.current?.offsetParent) scrollSheetToBreakdown();
2368
- else desktopBreakdownRef.current?.scrollIntoView({ behavior: 'smooth', block: 'start' });
2369
- }, 50);
2370
- return () => window.clearTimeout(timer);
2371
- // eslint-disable-next-line react-hooks/exhaustive-deps
2372
1528
  }, [open, initialShowBreakdown]);
2373
1529
  // in-sheet details link: expanding scrolls down to the breakdown, collapsing back to the top.
2374
1530
  const revealBreakdownRef = React.useRef(false);
@@ -2379,6 +1535,54 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
2379
1535
  else animateSheetScroll(() => 0);
2380
1536
  }, [showBreakdown, scrollSheetToBreakdown, animateSheetScroll]);
2381
1537
 
1538
+ // desktop: the popup scrolls wherever the pointer is (it opens under the click, e.g. from the VDP's
1539
+ // sticky header), and by keyboard, so it takes the focus. The page behind is locked: a class on <html>
1540
+ // (md3.css), because other dialogs opened above this one set and clear the inline overflow.
1541
+ const bodyRef = React.useRef<HTMLDivElement | null>(null);
1542
+ React.useLayoutEffect(() => {
1543
+ const body = bodyRef.current;
1544
+ const scrim = sheetRef.current?.parentElement;
1545
+ if (!open || !body || !scrim || !window.matchMedia('(min-width: 601px)').matches) return;
1546
+ const html = document.documentElement;
1547
+ // the scrollbar's width stays reserved, so the page behind does not move
1548
+ html.style.setProperty('--fin-modal-scrollbar', `${window.innerWidth - html.clientWidth}px`);
1549
+ html.classList.add('fin-modal-open');
1550
+ const prevFocus = document.activeElement as HTMLElement | null;
1551
+ body.tabIndex = -1;
1552
+ body.focus({ preventScroll: true });
1553
+ const onWheel = (e: WheelEvent): void => {
1554
+ if (e.ctrlKey) return; // zoom
1555
+ if (body.contains(e.target as Node) && body.scrollHeight > body.clientHeight) return; // scrolls natively
1556
+ e.preventDefault();
1557
+ body.scrollTop += e.deltaMode === 1 ? e.deltaY * 16 : e.deltaY;
1558
+ };
1559
+ scrim.addEventListener('wheel', onWheel, { passive: false });
1560
+ return () => {
1561
+ scrim.removeEventListener('wheel', onWheel);
1562
+ html.classList.remove('fin-modal-open');
1563
+ html.style.removeProperty('--fin-modal-scrollbar');
1564
+ if (prevFocus && document.contains(prevFocus)) prevFocus.focus({ preventScroll: true });
1565
+ };
1566
+ }, [open]);
1567
+
1568
+ // iOS Safari (26+, "Allow Website Tinting") paints its bottom toolbar area with the page's
1569
+ // <meta name="theme-color"> (site-wide blue #005CCB) — under the open white sheet that showed
1570
+ // as a solid blue band right below the CTA. While the sheet is open, theme-color is white;
1571
+ // on close the previous value(s) are restored. Other pages/states are untouched.
1572
+ React.useEffect(() => {
1573
+ if (!open || typeof document === 'undefined') return;
1574
+ const metas = Array.from(document.querySelectorAll<HTMLMetaElement>('meta[name="theme-color"]'));
1575
+ const prev = metas.map((m) => m.getAttribute('content'));
1576
+ metas.forEach((m) => m.setAttribute('content', '#FFFFFF'));
1577
+ return () => {
1578
+ metas.forEach((m, i) => {
1579
+ const v = prev[i];
1580
+ if (v == null) m.removeAttribute('content');
1581
+ else m.setAttribute('content', v);
1582
+ });
1583
+ };
1584
+ }, [open]);
1585
+
2382
1586
  // mobile-only: swipe-down-to-dismiss on the grabber/header (the mockup's drag handle).
2383
1587
  // The sheet follows the finger (imperative transform — no re-renders while dragging);
2384
1588
  // released past 90px it slides out and closes, otherwise it springs back. The element
@@ -2419,24 +1623,15 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
2419
1623
  if (!open) return null;
2420
1624
  const isLease = mode === 'leasing';
2421
1625
  const isCash = mode === 'cash';
2422
- const title = isLease ? t('autobahn:modal.leasingDetails') : t('autobahn:modal.financingDetails');
1626
+ const title = titleOverride || (isLease ? t('autobahn:modal.leasingDetails') : t('autobahn:modal.financingDetails'));
2423
1627
  const mobileTitle = isCash
2424
1628
  ? t('autobahn:modal.sheetTitleCash')
2425
1629
  : isLease
2426
1630
  ? t('autobahn:modal.sheetTitleLeasing')
2427
1631
  : t('autobahn:modal.sheetTitleFinancing');
2428
- // price-evaluation tier — identical derivation to the collapsed card (FinanceCalculator).
2429
- const tierIdx = TIER_LABELS.indexOf(ratingLabel as (typeof TIER_LABELS)[number]);
2430
- const evalTier = tierIdx >= 0 ? tierIdx : 1;
2431
- const evalTierLabel = t('autobahn:tier.' + TIER_KEYS[evalTier]);
2432
- // 'good' ("Guter Preis") always paints with the TOP tier's brighter green (TIER_COLORS[0]),
2433
- // not its own dimmer TIER_COLORS[1] — same rule FinanceCalculator's collapsed card already
2434
- // applies (FinanceCalculator.tsx's evalPillColor). The two render blocks below (desktop +
2435
- // mobile sheet) used TIER_COLORS[evalTier] directly, which for the 'good' tier painted this
2436
- // modal's pill a visibly different, dimmer green than the same-labeled pill on the card that
2437
- // opened it — same text, two colors.
2438
- const isGoodTier = TIER_KEYS[evalTier] === 'good';
2439
- const evalPillColor = isGoodTier ? TIER_COLORS[0] : TIER_COLORS[evalTier];
1632
+ // price-evaluation pill + bar — identical derivation to the collapsed card (FinanceCalculator's
1633
+ // evalPillOf), so the modal's pill has the same label and colour as the card that opened it.
1634
+ const { tier: evalTier, isGood: isGoodTier, label: evalTierLabel, color: evalPillColor, background: evalPillBackground } = evalPillOf(ratingLabel, t);
2440
1635
  // adjustable only for fin/leasing, and only when the page supplies the change handlers + bounds.
2441
1636
  const adjustable = mode !== 'cash' && !!onDownChange && downMin != null && downMax != null && termMin != null && termMax != null;
2442
1637
  // discrete term chip values (supplied periods, else derived from the bounds).
@@ -2610,7 +1805,8 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
2610
1805
  ));
2611
1806
 
2612
1807
  return (
2613
- <div className="fin-modal-scrim" onClick={onClose}>
1808
+ // the second click of a double click on what opened it must not close it again
1809
+ <div className="fin-modal-scrim" onClick={(e) => e.detail < 2 && onClose()}>
2614
1810
  <div
2615
1811
  className={
2616
1812
  'fin-modal' +
@@ -2645,7 +1841,7 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
2645
1841
  <Icon name="x" size={20} />
2646
1842
  </button>
2647
1843
  </div>
2648
- <div className="fin-modal-body">
1844
+ <div className="fin-modal-body" ref={bodyRef}>
2649
1845
  {/* ============================== DESKTOP (≥601px) — always-expanded breakdown, no tabs
2650
1846
  (the desktop .fin-calc-card owns its own tabs outside this modal) ============================== */}
2651
1847
  <div className="hide-mobile">
@@ -2796,16 +1992,15 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
2796
1992
  )}
2797
1993
  </div>
2798
1994
  </div>
2799
- <div className="fin-eval-col">
1995
+ <div
1996
+ className={ratingLabel && onShowPriceRating ? 'fin-eval-col rating-link' : 'fin-eval-col'}
1997
+ {...(ratingLabel && onShowPriceRating
1998
+ ? ratingLinkProps(onShowPriceRating, t('autobahn:finance.priceRatingLink', { rating: evalTierLabel }))
1999
+ : {})}
2000
+ >
2800
2001
  <div className="fin-eval-pill-cell">
2801
2002
  {ratingLabel && (
2802
- <span
2803
- className={`fin-eval-pill${isGoodTier ? ' fin-eval-pill--good' : ''}`}
2804
- style={{ color: evalPillColor, background: `color-mix(in srgb, ${evalPillColor} 16%, transparent)` }}
2805
- >
2806
- {evalTierLabel}
2807
- {isGoodTier && <sup>4</sup>}
2808
- </span>
2003
+ <EvalPill label={evalTierLabel} color={evalPillColor} background={evalPillBackground} good={isGoodTier} />
2809
2004
  )}
2810
2005
  </div>
2811
2006
  <div className="fin-eval-bar-cell">{ratingLabel && <EvalBar tier={evalTier} />}</div>
@@ -2890,7 +2085,7 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
2890
2085
  t={t}
2891
2086
  />
2892
2087
  )}
2893
- <div ref={desktopBreakdownRef} style={!isCash ? { marginTop: 18 } : undefined}>
2088
+ <div style={!isCash ? { marginTop: 18 } : undefined}>
2894
2089
  {!isCash && (
2895
2090
  <>
2896
2091
  <p
@@ -3333,16 +2528,15 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
3333
2528
  )}
3334
2529
  </div>
3335
2530
  </div>
3336
- <div className="fin-eval-col">
2531
+ <div
2532
+ className={ratingLabel && onShowPriceRating ? 'fin-eval-col rating-link' : 'fin-eval-col'}
2533
+ {...(ratingLabel && onShowPriceRating
2534
+ ? ratingLinkProps(onShowPriceRating, t('autobahn:finance.priceRatingLink', { rating: evalTierLabel }))
2535
+ : {})}
2536
+ >
3337
2537
  <div className="fin-eval-pill-cell">
3338
2538
  {ratingLabel && (
3339
- <span
3340
- className={`fin-eval-pill${isGoodTier ? ' fin-eval-pill--good' : ''}`}
3341
- style={{ color: evalPillColor, background: `color-mix(in srgb, ${evalPillColor} 16%, transparent)` }}
3342
- >
3343
- {evalTierLabel}
3344
- {isGoodTier && <sup>4</sup>}
3345
- </span>
2539
+ <EvalPill label={evalTierLabel} color={evalPillColor} background={evalPillBackground} good={isGoodTier} />
3346
2540
  )}
3347
2541
  </div>
3348
2542
  <div className="fin-eval-bar-cell">{ratingLabel && <EvalBar tier={evalTier} />}</div>
@@ -3877,10 +3071,16 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
3877
3071
  // ---------------------------------------------------------------------------
3878
3072
 
3879
3073
  export interface ReviewsTeaserProps {
3880
- /** review count (REAL — reviews.length from the same WP json-quotes source). */
3074
+ /** number of reviews loaded on the page — the teaser only renders when there are any. */
3881
3075
  count: number;
3882
- /** overall Google rating average — same real aggregate CustomerRatings displays. */
3076
+ /** site-wide rating average — same real aggregate CustomerRatings displays. */
3883
3077
  average: number;
3078
+ /**
3079
+ * Site-wide review count (Bewertung Welt `summary`, all Google + Trustpilot reviews) — the
3080
+ * same figure the CustomerRatings header shows ("873 Bewertungen"), not the few loaded ones.
3081
+ * Falls back to `count` when unset.
3082
+ */
3083
+ total?: number;
3884
3084
  /** i18n function (drilled from the page). */
3885
3085
  t: TranslationFunction;
3886
3086
  }
@@ -3890,8 +3090,9 @@ export interface ReviewsTeaserProps {
3890
3090
  * and the highlights card (Figma "Google Review Teaser / Card"). Scrolls the CustomerRatings
3891
3091
  * section into view on tap; renders nothing when there are no real reviews to jump to.
3892
3092
  */
3893
- export const ReviewsTeaser: React.FunctionComponent<ReviewsTeaserProps> = ({ count, average, t }) => {
3093
+ export const ReviewsTeaser: React.FunctionComponent<ReviewsTeaserProps> = ({ count, average, total, t }) => {
3894
3094
  if (!count) return null;
3095
+ const shownCount = total != null && total > 0 ? total : count;
3895
3096
  const go = (): void => {
3896
3097
  if (typeof document === 'undefined') return;
3897
3098
  const el = document.getElementById('vdp-bewertungen');
@@ -3946,7 +3147,9 @@ export const ReviewsTeaser: React.FunctionComponent<ReviewsTeaserProps> = ({ cou
3946
3147
  color: '#1D2A38',
3947
3148
  }}
3948
3149
  >
3949
- {t('autobahn:reviews.teaserCount', { count })}
3150
+ {/* same wording + figure as the reviews section header below ("873 Bewertungen") —
3151
+ the reviews come from Google AND Trustpilot, so no "Google-" here */}
3152
+ {t('autobahn:reviews.ratingCount', { count: shownCount })}
3950
3153
  </span>
3951
3154
  </span>
3952
3155
  <Icon name="chevron-right" size={24} color="var(--md-on-surface-variant)" style={{ flex: 'none' }} />
@@ -3954,15 +3157,171 @@ export const ReviewsTeaser: React.FunctionComponent<ReviewsTeaserProps> = ({ cou
3954
3157
  );
3955
3158
  };
3956
3159
 
3160
+ /** rel for every link to a review portal: no SEO weight passed on, no window.opener. */
3161
+ export const REVIEW_LINK_REL = 'nofollow noopener noreferrer';
3162
+
3163
+ /** "2026-11-12" → "12.11.2026" ('' for anything else). */
3164
+ const reviewDate = (iso?: string): string =>
3165
+ /^\d{4}-\d{2}-\d{2}$/.test(String(iso || '')) ? String(iso).split('-').reverse().join('.') : '';
3166
+
3167
+ /**
3168
+ * A portal's rating with one decimal, cut (never rounded up): Trustpilot's 4,47 reads 4,4 —
3169
+ * what its own profile page shows — and no portal is ever shown better than it is.
3170
+ */
3171
+ const portalRating = (value: number | null): string =>
3172
+ value == null ? '–' : (Math.floor(value * 10 + 1e-9) / 10).toLocaleString('de-DE', { minimumFractionDigits: 1, maximumFractionDigits: 1 });
3173
+
3174
+ export interface ReviewSourceCaptionProps {
3175
+ /** portal display name, e.g. "Trustpilot" (nothing renders without it). */
3176
+ source?: string;
3177
+ /** ISO yyyy-mm-dd. */
3178
+ date?: string;
3179
+ /** the review on its portal — the caption becomes a nofollow link when set. */
3180
+ url?: string;
3181
+ className?: string;
3182
+ style?: React.CSSProperties;
3183
+ t: TranslationFunction;
3184
+ }
3185
+
3186
+ /** "Trustpilot-Bewertung · 12.11.2026" — linked to that very review on the portal. */
3187
+ export const ReviewSourceCaption: React.FunctionComponent<ReviewSourceCaptionProps> = ({ source, date, url, className, style, t }) => {
3188
+ if (!source) return null;
3189
+ const d = reviewDate(date);
3190
+ const label = `${t('autobahn:reviews.sourceReview', { portal: source })}${d ? ` · ${d}` : ''}`;
3191
+ const cls = ['review-source', className].filter(Boolean).join(' ');
3192
+ return url ? (
3193
+ <a className={cls} style={style} href={url} target="_blank" rel={REVIEW_LINK_REL}>
3194
+ {label}
3195
+ </a>
3196
+ ) : (
3197
+ <span className={cls} style={style}>{label}</span>
3198
+ );
3199
+ };
3200
+
3201
+ export interface RatingSourcesInfoProps {
3202
+ /** the site-wide average the popup explains (same value as next to the button). */
3203
+ average: number;
3204
+ /** the site-wide review count. */
3205
+ total: number;
3206
+ /** the portals behind it (Bewertung Welt `summary.portals`); no button without any. */
3207
+ portals: RatingPortal[];
3208
+ /** icon size (default 18). */
3209
+ size?: number;
3210
+ /** icon colour (default on-surface-variant). */
3211
+ color?: string;
3212
+ /**
3213
+ * The rating the popup explains (stars, "4,5 / 5", "876 Bewertungen" …). Given, that whole area
3214
+ * plus the "ⓘ" is ONE button that opens the popup, not just the circle. Called with the "ⓘ"
3215
+ * (null without portals) so the caller places it in its own layout. Without portals the area is
3216
+ * rendered as plain content, no button.
3217
+ */
3218
+ children?: (info: React.ReactElement | null) => React.ReactNode;
3219
+ /** layout of the area (children mode only), e.g. its gap. */
3220
+ style?: React.CSSProperties;
3221
+ t: TranslationFunction;
3222
+ }
3223
+
3224
+ /**
3225
+ * "ⓘ" next to the site rating → a popup that explains it: the rating of each portal (Google,
3226
+ * Trustpilot) with its review count and a nofollow link to all auto.de reviews there, then the
3227
+ * combined, count-weighted average that the page shows, and a note on which reviews count and that
3228
+ * auto.de does not verify them (ADV-440). With `children`, the rating next to the
3229
+ * "ⓘ" opens it too (PM 2026-11-24: "link the entire area, not just the circle").
3230
+ */
3231
+ export const RatingSourcesInfo: React.FunctionComponent<RatingSourcesInfoProps> = ({ average, total, portals, size = 18, color, children, style, t }) => {
3232
+ const [open, setOpen] = useState(false);
3233
+ const list = (portals || []).filter((p) => p && p.name && p.total > 0);
3234
+ if (!list.length) {
3235
+ return children ? (
3236
+ <span className="rating-info-area rating-info-area--static" style={style}>
3237
+ {children(null)}
3238
+ </span>
3239
+ ) : null;
3240
+ }
3241
+ const names = list.map((p) => p.name).join(` ${t('autobahn:reviews.sources.and')} `);
3242
+ const avg = average.toLocaleString('de-DE', { minimumFractionDigits: 1, maximumFractionDigits: 1 });
3243
+ const label = t('autobahn:reviews.sources.open');
3244
+ const openPopup = (e: React.MouseEvent) => {
3245
+ e.stopPropagation();
3246
+ setOpen(true);
3247
+ };
3248
+ const icon = <Icon name="info" size={size} color={color || 'var(--md-on-surface-variant)'} style={{ width: size, height: size }} />;
3249
+ return (
3250
+ <>
3251
+ {children ? (
3252
+ // the visible rating names the button; the hidden text says what it opens
3253
+ <button type="button" className="rating-info-area" aria-haspopup="dialog" title={label} style={style} onClick={openPopup}>
3254
+ {children(
3255
+ <span className="rating-info-btn" aria-hidden="true">
3256
+ {icon}
3257
+ </span>,
3258
+ )}
3259
+ <span className="rating-info-sr">{label}</span>
3260
+ </button>
3261
+ ) : (
3262
+ <button type="button" className="rating-info-btn" aria-label={label} aria-haspopup="dialog" title={label} onClick={openPopup}>
3263
+ {icon}
3264
+ </button>
3265
+ )}
3266
+ <Modal open={open} onClose={() => setOpen(false)} size="sm" title={t('autobahn:reviews.sources.title')} className="rating-sources">
3267
+ <p className="md-body" style={{ margin: '0 0 16px', color: 'var(--md-on-surface-variant)' }}>
3268
+ {t('autobahn:reviews.sources.intro', { portals: names })}
3269
+ </p>
3270
+ <ul className="rating-sources-list">
3271
+ {list.map((p) => (
3272
+ <li key={p.source || p.name} className="rating-sources-row">
3273
+ <span className="rating-sources-name">{p.name}</span>
3274
+ <span className="rating-sources-score">
3275
+ <Stars value={p.average || 0} size={16} />
3276
+ <b className="num">{portalRating(p.average)}</b>
3277
+ </span>
3278
+ <span className="rating-sources-count">{t('autobahn:reviews.ratingCount', { count: p.total })}</span>
3279
+ {p.url ? (
3280
+ <a className="rating-sources-link" href={p.url} target="_blank" rel={REVIEW_LINK_REL}>
3281
+ {t('autobahn:reviews.sources.allOn', { portal: p.name })}
3282
+ <Icon name="external-link" size={14} />
3283
+ </a>
3284
+ ) : (
3285
+ <span />
3286
+ )}
3287
+ </li>
3288
+ ))}
3289
+ <li className="rating-sources-row rating-sources-row--total">
3290
+ <span className="rating-sources-name">{t('autobahn:reviews.sources.total')}</span>
3291
+ <span className="rating-sources-score">
3292
+ <Stars value={average} size={16} />
3293
+ <b className="num">{avg}</b>
3294
+ </span>
3295
+ <span className="rating-sources-count">{t('autobahn:reviews.ratingCount', { count: total })}</span>
3296
+ <span className="rating-sources-note">{t('autobahn:reviews.sources.weighted')}</span>
3297
+ </li>
3298
+ </ul>
3299
+ <div className="rating-sources-info">
3300
+ <p>{t('autobahn:reviews.sources.info', { portals: names })}</p>
3301
+ </div>
3302
+ </Modal>
3303
+ </>
3304
+ );
3305
+ };
3306
+
3957
3307
  export interface CustomerRatingsProps {
3958
- /** the loaded reviews (REAL — from the WP json-quotes source). */
3308
+ /** the loaded reviews (REAL — Bewertung Welt via fe-landing's /angebot/customer-quotes). */
3959
3309
  reviews: VdpReview[];
3960
3310
  /**
3961
- * Overall auto.de Google rating to display instead of the average of the few
3962
- * loaded reviews (which skews to 5,0 — the review feed only carries 5-star
3963
- * quotes). The page passes the real aggregate (4,6 per Google, review round 9).
3311
+ * Overall auto.de rating to display instead of the average of the few loaded
3312
+ * reviews (only the newest few are loaded, not all of them). The page passes
3313
+ * the real site-wide aggregate.
3964
3314
  */
3965
3315
  average?: number;
3316
+ /**
3317
+ * Site-wide review count shown next to the average (Bewertung Welt `summary`). When set,
3318
+ * the header shows it instead of reviews.length and the expander reads "Weitere N …".
3319
+ */
3320
+ total?: number;
3321
+ /** portals the average/total come from, e.g. "Google & Trustpilot" (default "Google"). */
3322
+ sourceLabel?: string;
3323
+ /** per-portal figures + profile links → the "ⓘ" popup after the rating (none → no button). */
3324
+ portals?: RatingPortal[];
3966
3325
  /** i18n function (drilled from the page). */
3967
3326
  t: TranslationFunction;
3968
3327
  }
@@ -3975,10 +3334,11 @@ export interface CustomerRatingsProps {
3975
3334
  * the WordPress json-quotes feed); the page loads them and passes them in. When no
3976
3335
  * reviews load, the page renders nothing (no fabricated content).
3977
3336
  */
3978
- export const CustomerRatings: React.FunctionComponent<CustomerRatingsProps> = ({ reviews, average, t }) => {
3337
+ export const CustomerRatings: React.FunctionComponent<CustomerRatingsProps> = ({ reviews, average, total, sourceLabel, portals, t }) => {
3979
3338
  const [showAll, setShowAll] = useState(false);
3980
3339
  if (!reviews || !reviews.length) return null;
3981
3340
  const count = reviews.length;
3341
+ const headerCount = total != null && total > 0 ? total : count;
3982
3342
  const avg = average != null ? average : reviews.reduce((s, r) => s + (r.rating || 0), 0) / count;
3983
3343
  const shown = showAll ? reviews : reviews.slice(0, 4);
3984
3344
  return (
@@ -3987,17 +3347,23 @@ export const CustomerRatings: React.FunctionComponent<CustomerRatingsProps> = ({
3987
3347
  <h2 className="md-headline-sm" style={{ margin: 0 }}>
3988
3348
  {t('autobahn:reviews.title')}
3989
3349
  </h2>
3990
- <div style={{ display: 'flex', alignItems: 'center', gap: 10, marginLeft: 'auto' }}>
3991
- <span className="num" style={{ fontWeight: 800, fontSize: 26, color: 'var(--md-on-surface)', letterSpacing: '-.5px' }}>
3992
- {avg.toLocaleString('de-DE', { minimumFractionDigits: 1, maximumFractionDigits: 1 })}
3993
- </span>
3994
- <span>
3995
- <Stars value={avg} size={16} />
3996
- <span className="md-label-sm" style={{ display: 'block' }}>
3997
- {t('autobahn:reviews.ratingCount', { count })} · via Google
3998
- </span>
3999
- </span>
4000
- </div>
3350
+ {/* the whole rating (number, stars, count, "ⓘ") opens the sources popup */}
3351
+ <RatingSourcesInfo average={avg} total={headerCount} portals={portals || []} size={16} t={t} style={{ gap: 10, marginLeft: 'auto' }}>
3352
+ {(info) => (
3353
+ <>
3354
+ <span className="num" style={{ fontWeight: 800, fontSize: 26, color: 'var(--md-on-surface)', letterSpacing: '-.5px' }}>
3355
+ {avg.toLocaleString('de-DE', { minimumFractionDigits: 1, maximumFractionDigits: 1 })}
3356
+ </span>
3357
+ <span>
3358
+ <Stars value={avg} size={16} />
3359
+ <span className="md-label-sm" style={{ display: 'flex', alignItems: 'center', gap: 2 }}>
3360
+ {t('autobahn:reviews.ratingCount', { count: headerCount })} · via {sourceLabel || 'Google'}
3361
+ {info}
3362
+ </span>
3363
+ </span>
3364
+ </>
3365
+ )}
3366
+ </RatingSourcesInfo>
4001
3367
  </div>
4002
3368
  <div className="eq-cols">
4003
3369
  {shown.map((r) => (
@@ -4039,15 +3405,21 @@ export const CustomerRatings: React.FunctionComponent<CustomerRatingsProps> = ({
4039
3405
  <Stars value={r.rating} />
4040
3406
  </div>
4041
3407
  </div>
4042
- <p className="md-body-sm review-card-text" style={{ margin: 0, color: 'var(--md-on-surface-variant)' }}>
3408
+ <p className="md-body-sm review-card-text" title={r.review} style={{ margin: 0, color: 'var(--md-on-surface-variant)' }}>
4043
3409
  {r.review}
4044
3410
  </p>
3411
+ <ReviewSourceCaption source={r.source} date={r.date} url={r.url} className="review-card-source md-label-sm" t={t} />
4045
3412
  </div>
4046
3413
  ))}
4047
3414
  </div>
4048
3415
  {reviews.length > 4 && (
4049
3416
  <button className="mbtn mbtn--text" style={{ marginTop: 4 }} onClick={() => setShowAll((a) => !a)}>
4050
- {showAll ? t('autobahn:ratings.showLess') : t('autobahn:ratings.showMore', { count })}
3417
+ {showAll
3418
+ ? t('autobahn:ratings.showLess')
3419
+ // with a site-wide total in the header, "Alle N" would contradict it — only the loaded ones expand
3420
+ : headerCount !== count
3421
+ ? t('autobahn:ratings.showMoreLoaded', { count: count - 4 })
3422
+ : t('autobahn:ratings.showMore', { count })}
4051
3423
  <Icon name={showAll ? 'chevron-up' : 'chevron-down'} size={16} />
4052
3424
  </button>
4053
3425
  )}