@bytebrand/fe-ui-core-autobahn 1.0.219 → 1.0.221
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 +2 -1
- package/locales/en/autobahn.json +2 -1
- package/package.json +2 -2
- package/theme/md3.css +138 -29
- package/vdp/FinanceCalculator.tsx +14 -3
- package/vdp/VdpModules.tsx +117 -42
package/cards/CarCard.tsx
CHANGED
|
@@ -38,6 +38,7 @@ import {
|
|
|
38
38
|
GalleryActivityPill,
|
|
39
39
|
cardSpec,
|
|
40
40
|
PaymentMode,
|
|
41
|
+
startPaymentMode,
|
|
41
42
|
callDealerSalesPhone,
|
|
42
43
|
DEALER_SALES_PHONE,
|
|
43
44
|
} from './cardParts';
|
|
@@ -104,6 +105,11 @@ export interface CarCardProps {
|
|
|
104
105
|
* when omitted the badge is not a link (a click opens the car via onOpen, as before).
|
|
105
106
|
*/
|
|
106
107
|
onShowPriceRating?: (car: AutobahnCar) => void;
|
|
108
|
+
/**
|
|
109
|
+
* Tab the price block opens on (default Finanzierung) — e.g. the SRP's leasing-only results
|
|
110
|
+
* open every card on Leasing. Ignored for a car without a lease rate (it has no Leasing tab).
|
|
111
|
+
*/
|
|
112
|
+
initialMode?: PaymentMode;
|
|
107
113
|
}
|
|
108
114
|
|
|
109
115
|
const CarCard: React.FunctionComponent<CarCardProps> = ({
|
|
@@ -120,8 +126,9 @@ const CarCard: React.FunctionComponent<CarCardProps> = ({
|
|
|
120
126
|
onOpenRateAdjust,
|
|
121
127
|
onShowFinancingDetails,
|
|
122
128
|
onShowPriceRating,
|
|
129
|
+
initialMode,
|
|
123
130
|
}) => {
|
|
124
|
-
const [mode, setMode] = useState<PaymentMode>(
|
|
131
|
+
const [mode, setMode] = useState<PaymentMode>(() => startPaymentMode(car, initialMode));
|
|
125
132
|
const [photoIndex, setPhotoIndex] = useState(0);
|
|
126
133
|
const [viewerOpen, setViewerOpen] = useState(false);
|
|
127
134
|
const mediaRef = useRef<HTMLDivElement | null>(null);
|
|
@@ -164,6 +171,8 @@ const CarCard: React.FunctionComponent<CarCardProps> = ({
|
|
|
164
171
|
// active that's already 3, so NEU is dropped rather than causing a 4th to overflow.
|
|
165
172
|
const activeDealChips = [showDrop || showSave, showPct, !!car.zeroDown].filter(Boolean).length;
|
|
166
173
|
const showNeu = asGoodAsNew && car.isNew && activeDealChips < 3;
|
|
174
|
+
// tabs the price block can switch to (PriceTabs shows Leasing only when the car has a lease rate)
|
|
175
|
+
const paymentModes: PaymentMode[] = car.lease != null ? ['financing', 'leasing', 'buy'] : ['financing', 'buy'];
|
|
167
176
|
return (
|
|
168
177
|
<article
|
|
169
178
|
className="mcard mcard--interactive cc-card"
|
|
@@ -286,21 +295,50 @@ const CarCard: React.FunctionComponent<CarCardProps> = ({
|
|
|
286
295
|
<div className="cc-price" style={{ marginTop: 0, borderTop: '1px solid var(--md-outline-variant)' }}>
|
|
287
296
|
<PriceTabs car={car} mode={mode} onModeChange={setMode} t={t} />
|
|
288
297
|
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 8, marginTop: 10 }}>
|
|
289
|
-
|
|
298
|
+
{/* every tab's hero stacked in one grid cell (.cc-hero-stack), only the active one
|
|
299
|
+
visible, bottom-aligned — Kaufen's struck list price sits on its own line above
|
|
300
|
+
the price, so without this the row (and the card) grew/shrank by that line on
|
|
301
|
+
every tab switch. Same trick as .cc-terms-stack below. */}
|
|
302
|
+
<div className="cc-hero-stack">
|
|
303
|
+
{paymentModes.map((m) => (
|
|
304
|
+
<div
|
|
305
|
+
key={m}
|
|
306
|
+
className={'cc-hero-slot' + (m === mode ? '' : ' cc-hero-slot--hidden')}
|
|
307
|
+
aria-hidden={m === mode ? undefined : true}
|
|
308
|
+
>
|
|
309
|
+
<PriceHero car={car} mode={m} t={t} alwaysShowUnit />
|
|
310
|
+
</div>
|
|
311
|
+
))}
|
|
312
|
+
</div>
|
|
290
313
|
<PriceEvalCol car={car} t={t} onActivate={onShowPriceRating ? () => onShowPriceRating(car) : undefined} />
|
|
291
314
|
</div>
|
|
292
315
|
{/* same fallback CardCtaRow already uses below: pages that haven't wired a real
|
|
293
|
-
"Rate anpassen" sheet yet still get a working "Details" link (opens the car).
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
316
|
+
"Rate anpassen" sheet yet still get a working "Details" link (opens the car).
|
|
317
|
+
Every tab's terms line is rendered into the same grid cell (.cc-terms-stack) and
|
|
318
|
+
only the active one is visible — the cell is as tall as the tallest line, so the
|
|
319
|
+
card keeps one height across Finanzierung/Leasing/Kaufen (Leasing's longer line
|
|
320
|
+
wraps to 2 lines on narrow phones). No change to the visible line itself. */}
|
|
321
|
+
<div className="cc-terms-stack">
|
|
322
|
+
{paymentModes.map((m) => (
|
|
323
|
+
<div
|
|
324
|
+
key={m}
|
|
325
|
+
className={'cc-terms-slot' + (m === mode ? '' : ' cc-terms-slot--hidden')}
|
|
326
|
+
aria-hidden={m === mode ? undefined : true}
|
|
327
|
+
>
|
|
328
|
+
<PriceTerms
|
|
329
|
+
car={car}
|
|
330
|
+
mode={m}
|
|
331
|
+
onOpenRateAdjust={onOpenRateAdjust || (() => onOpen(car))}
|
|
332
|
+
onShowDetails={onShowFinancingDetails ? () => onShowFinancingDetails(car, m) : undefined}
|
|
333
|
+
t={t}
|
|
334
|
+
/>
|
|
335
|
+
{/* ADV-405/407 Kreditkosten-Hinweis under the financing/leasing conditions line. Inside the
|
|
336
|
+
slot, so the stack keeps one height across the tabs (no jump on Kaufen); hidden slots
|
|
337
|
+
are visibility:hidden + aria-hidden like their terms line. */}
|
|
338
|
+
{m !== 'buy' && <CreditCostNotice t={t} size="small" cls="cc-ccn" />}
|
|
339
|
+
</div>
|
|
340
|
+
))}
|
|
341
|
+
</div>
|
|
304
342
|
</div>
|
|
305
343
|
{/* Mobile-only row (CardCtaRow itself carries the show-mobile class) — always
|
|
306
344
|
rendered, with real fallbacks the page can override once it wires its own
|
package/cards/CarRow.tsx
CHANGED
|
@@ -42,6 +42,7 @@ import {
|
|
|
42
42
|
ZeroDownChip,
|
|
43
43
|
fmtKm,
|
|
44
44
|
PaymentMode,
|
|
45
|
+
startPaymentMode,
|
|
45
46
|
ratingTone,
|
|
46
47
|
} from './cardParts';
|
|
47
48
|
import { AutobahnCar } from './types';
|
|
@@ -83,6 +84,8 @@ export interface CarRowProps {
|
|
|
83
84
|
onShowFinancingDetails?: (car: AutobahnCar, mode: PaymentMode) => void;
|
|
84
85
|
/** the price-rating chip + bar were clicked — see CarCard's identically-named prop. */
|
|
85
86
|
onShowPriceRating?: (car: AutobahnCar) => void;
|
|
87
|
+
/** Tab the mobile price tabs open on — see CarCard's identically-named prop. */
|
|
88
|
+
initialMode?: PaymentMode;
|
|
86
89
|
}
|
|
87
90
|
|
|
88
91
|
const CarRow: React.FunctionComponent<CarRowProps> = ({
|
|
@@ -96,8 +99,9 @@ const CarRow: React.FunctionComponent<CarRowProps> = ({
|
|
|
96
99
|
adminAction,
|
|
97
100
|
onShowFinancingDetails,
|
|
98
101
|
onShowPriceRating,
|
|
102
|
+
initialMode,
|
|
99
103
|
}) => {
|
|
100
|
-
const [mode, setMode] = useState<PaymentMode>(
|
|
104
|
+
const [mode, setMode] = useState<PaymentMode>(() => startPaymentMode(car, initialMode));
|
|
101
105
|
const [photoIndex, setPhotoIndex] = useState(0);
|
|
102
106
|
const mediaRef = useRef<HTMLDivElement | null>(null);
|
|
103
107
|
// The price-rating chip + bar link to the car's "Preis & Marktwert" section (page-owned
|
package/cards/cardParts.tsx
CHANGED
|
@@ -551,6 +551,11 @@ export const PriceEvalCol: React.FunctionComponent<{ car: AutobahnCar; t: Transl
|
|
|
551
551
|
|
|
552
552
|
export type PaymentMode = 'financing' | 'leasing' | 'buy';
|
|
553
553
|
|
|
554
|
+
/** The tab a card opens on: the requested one (default Finanzierung), but never Leasing for a car
|
|
555
|
+
* without a lease rate — PriceTabs has no Leasing tab for it. */
|
|
556
|
+
export const startPaymentMode = (car: AutobahnCar, requested?: PaymentMode): PaymentMode =>
|
|
557
|
+
requested === 'leasing' && car.lease == null ? 'financing' : requested || 'financing';
|
|
558
|
+
|
|
554
559
|
export interface PriceTabsProps {
|
|
555
560
|
car: AutobahnCar;
|
|
556
561
|
mode: PaymentMode;
|
|
@@ -785,7 +790,12 @@ export const PriceTerms: React.FunctionComponent<{
|
|
|
785
790
|
onShowDetails?: () => void;
|
|
786
791
|
t: TranslationFunction;
|
|
787
792
|
}> = ({ car, mode, onOpenRateAdjust, onShowDetails, t }) => {
|
|
788
|
-
|
|
793
|
+
// Kaufen (buy): a cash purchase has no financing terms/details link — used to `return null`
|
|
794
|
+
// here, which collapsed .cc-terms to 0 height on that tab while Financing/Leasing rendered a
|
|
795
|
+
// real line, jumping the price row (and everything below it: rating pill, CTA row) up/down on
|
|
796
|
+
// every tab switch. Render an empty, still-present .cc-terms div instead — same fix as the VDP
|
|
797
|
+
// FinanceCalculator's .fin-cond (md3.css), which reserves its line's height the same way.
|
|
798
|
+
if (mode === 'buy') return <div className="cc-terms" />;
|
|
789
799
|
const finFirstInstallment =
|
|
790
800
|
car.finFirstInstallment != null ? car.finFirstInstallment.toLocaleString('de-DE') : _finFirstInstallment;
|
|
791
801
|
const finMonths = car.finMonths ?? _finMonths;
|
package/constants/app.ts
CHANGED
|
@@ -40,7 +40,17 @@ export const LOCAL_STORAGE_KEY = {
|
|
|
40
40
|
i18n_KEY: 'i18nLanguage'
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
// ADV-284: evaluated at import time — with site storage blocked, reading localStorage throws a
|
|
44
|
+
// SecurityError that took down the whole bundle. Blocked storage behaves like "nothing saved".
|
|
45
|
+
const readStoredLang = (): string | null => {
|
|
46
|
+
try {
|
|
47
|
+
return localStorage.getItem(LOCAL_STORAGE_KEY.i18n_KEY);
|
|
48
|
+
} catch (e) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const DEFAULT_LANG: string = typeof window !== 'undefined' ? readStoredLang() : 'de';
|
|
44
54
|
|
|
45
55
|
// Default support contact phone
|
|
46
56
|
export const CONTACT_PHONE: string = '+498004030182';
|
package/constants/core.ts
CHANGED
|
@@ -35,7 +35,18 @@ export const LOCAL_STORAGE_KEY = {
|
|
|
35
35
|
i18n_KEY: 'i18nLanguage'
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
// ADV-284: evaluated at import time — with site storage blocked, merely reading
|
|
39
|
+
// window.localStorage throws a SecurityError, which took down the whole bundle (landing
|
|
40
|
+
// page never rendered). Treat blocked storage like "no language saved".
|
|
41
|
+
const readStoredLang = (): string | null => {
|
|
42
|
+
try {
|
|
43
|
+
return typeof window !== 'undefined' ? window.localStorage.getItem(LOCAL_STORAGE_KEY.i18n_KEY) : null;
|
|
44
|
+
} catch (e) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const DEFAULT_LANG: string = readStoredLang() ?? 'de';
|
|
39
50
|
|
|
40
51
|
export const ROW_STYLES = {
|
|
41
52
|
marginBottom: 10
|
package/locales/de/autobahn.json
CHANGED
|
@@ -152,7 +152,8 @@
|
|
|
152
152
|
"and": "und",
|
|
153
153
|
"allOn": "Alle Bewertungen auf {{portal}}",
|
|
154
154
|
"total": "Gesamtbewertung",
|
|
155
|
-
"weighted": "gewichteter Durchschnitt"
|
|
155
|
+
"weighted": "gewichteter Durchschnitt",
|
|
156
|
+
"info": "Wir berücksichtigen alle von {{portals}} ausgewiesenen Bewertungen seit der jeweils ersten Bewertung bis zum letzten Datenabruf. Eine eigene Prüfung, ob tatsächlich ein Kauf oder eine Nutzung erfolgt ist, findet nicht statt."
|
|
156
157
|
}
|
|
157
158
|
},
|
|
158
159
|
"enquiry": {
|
package/locales/en/autobahn.json
CHANGED
|
@@ -152,7 +152,8 @@
|
|
|
152
152
|
"and": "and",
|
|
153
153
|
"allOn": "All reviews on {{portal}}",
|
|
154
154
|
"total": "Overall rating",
|
|
155
|
-
"weighted": "weighted average"
|
|
155
|
+
"weighted": "weighted average",
|
|
156
|
+
"info": "We take into account all reviews shown by {{portals}}, from the first review on each platform up to the latest data retrieval. We do not check ourselves whether a purchase or use actually took place."
|
|
156
157
|
}
|
|
157
158
|
},
|
|
158
159
|
"enquiry": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bytebrand/fe-ui-core-autobahn",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.221",
|
|
4
4
|
"description": "auto.de md3 (Autobahn) design system — UI primitives, cards, chrome, VDP modules, theme CSS and locales. Ships raw TypeScript source (like fe-ui-core before it); each consumer's bundler compiles it.",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@bytebrand/car-schema-selectors": "^2.0.7",
|
|
13
|
-
"@bytebrand/fe-financing": "^5.14.
|
|
13
|
+
"@bytebrand/fe-financing": "^5.14.30",
|
|
14
14
|
"classnames": "2.2.6",
|
|
15
15
|
"clsx": "^2.1.1",
|
|
16
16
|
"d3-format": "1.4.5",
|
package/theme/md3.css
CHANGED
|
@@ -7456,6 +7456,43 @@ line-height: 31px;
|
|
|
7456
7456
|
.md3 .vdp-stickytop--on {
|
|
7457
7457
|
transform: translateY(0);
|
|
7458
7458
|
}
|
|
7459
|
+
/* its price block (ADV-438): the rate and the purchase price share their right edge, the "ⓘ" has its
|
|
7460
|
+
own column after "/mtl." */
|
|
7461
|
+
.md3 .vdp-sticky-price {
|
|
7462
|
+
flex: none;
|
|
7463
|
+
display: grid;
|
|
7464
|
+
grid-template-columns: auto auto;
|
|
7465
|
+
column-gap: 8px;
|
|
7466
|
+
row-gap: 3px;
|
|
7467
|
+
align-items: center;
|
|
7468
|
+
justify-items: end;
|
|
7469
|
+
margin-right: 6px;
|
|
7470
|
+
font-size: 12px;
|
|
7471
|
+
font-weight: 500;
|
|
7472
|
+
line-height: 14px;
|
|
7473
|
+
color: var(--md-on-surface-variant);
|
|
7474
|
+
white-space: nowrap;
|
|
7475
|
+
}
|
|
7476
|
+
.md3 .vdp-sticky-rate,
|
|
7477
|
+
.md3 .vdp-sticky-buy {
|
|
7478
|
+
grid-column: 1;
|
|
7479
|
+
}
|
|
7480
|
+
.md3 .vdp-sticky-rate {
|
|
7481
|
+
display: flex;
|
|
7482
|
+
align-items: baseline;
|
|
7483
|
+
gap: 4px;
|
|
7484
|
+
}
|
|
7485
|
+
.md3 .vdp-sticky-rate .num {
|
|
7486
|
+
font-size: 20px;
|
|
7487
|
+
font-weight: 700;
|
|
7488
|
+
line-height: 23px;
|
|
7489
|
+
letter-spacing: -0.4px;
|
|
7490
|
+
color: var(--md-primary);
|
|
7491
|
+
}
|
|
7492
|
+
.md3 .vdp-sticky-price > button {
|
|
7493
|
+
grid-column: 2;
|
|
7494
|
+
grid-row: 1;
|
|
7495
|
+
}
|
|
7459
7496
|
/* VDP: header row — title left, rating chip right */
|
|
7460
7497
|
.md3 .vdp-headrow {
|
|
7461
7498
|
display: flex;
|
|
@@ -10087,7 +10124,8 @@ line-height: 31px;
|
|
|
10087
10124
|
z-index: 71;
|
|
10088
10125
|
background: var(--md-surface);
|
|
10089
10126
|
border-radius: var(--md-r-xl) var(--md-r-xl) 0 0;
|
|
10090
|
-
|
|
10127
|
+
/* % of the fixed containing block, not vh/dvh: on iOS vh is the toolbars-collapsed height, and Chrome on iOS does not shrink dvh while its toolbars are shown either, so a 92vh/92dvh bottom sheet grew under the address bar and hid its own header (title, download, close). The fixed box itself always matches the visible area. */
|
|
10128
|
+
max-height: 92%;
|
|
10091
10129
|
display: flex;
|
|
10092
10130
|
flex-direction: column;
|
|
10093
10131
|
box-shadow: 0 -8px 30px rgba(16, 22, 42, 0.22);
|
|
@@ -10198,6 +10236,28 @@ line-height: 31px;
|
|
|
10198
10236
|
padding: 18px 20px 22px;
|
|
10199
10237
|
overflow-y: auto;
|
|
10200
10238
|
}
|
|
10239
|
+
/* the page behind the open popup is locked, without its scrollbar (set by FinanceDetailsModal, desktop) */
|
|
10240
|
+
html.fin-modal-open {
|
|
10241
|
+
overflow: hidden;
|
|
10242
|
+
padding-right: var(--fin-modal-scrollbar, 0px);
|
|
10243
|
+
}
|
|
10244
|
+
html.fin-modal-open .fin-modal-scrim {
|
|
10245
|
+
/* where the scrollbar was: the page tint under the dimming, so no strip shows at the edge */
|
|
10246
|
+
background:
|
|
10247
|
+
linear-gradient(rgba(8, 12, 24, 0.5), rgba(8, 12, 24, 0.5)),
|
|
10248
|
+
linear-gradient(to left, var(--md-sc-low) var(--fin-modal-scrollbar, 0px), transparent 0);
|
|
10249
|
+
}
|
|
10250
|
+
/* takes the focus on open so the keyboard scrolls it (FinanceDetailsModal); not a control */
|
|
10251
|
+
.md3 .fin-modal-body:focus {
|
|
10252
|
+
outline: none;
|
|
10253
|
+
box-shadow: none !important; /* the .md3 :focus-visible ring */
|
|
10254
|
+
}
|
|
10255
|
+
@media (min-width: 601px) {
|
|
10256
|
+
/* at its ends it does not scroll the page behind */
|
|
10257
|
+
.md3 .fin-modal-body {
|
|
10258
|
+
overscroll-behavior: contain;
|
|
10259
|
+
}
|
|
10260
|
+
}
|
|
10201
10261
|
/* Checkout's Finanzierungsdetails/Leasingdetails modal (CheckoutFinancePanelNext's cf-details
|
|
10202
10262
|
button) reuses this SAME FinanceDetailsModal as the VDP page, but the rate hero + price-rating
|
|
10203
10263
|
pill/bar (.fin-price-grid) would just repeat the SAME figures the cf-panel already shows above
|
|
@@ -11957,19 +12017,6 @@ color: #005CFF;
|
|
|
11957
12017
|
background: #d4dde7;
|
|
11958
12018
|
border-radius: 1px;
|
|
11959
12019
|
}
|
|
11960
|
-
/* Pricing Card / Tabs / Base Line — .cc-price only, fixed 326px inset 18px from the left
|
|
11961
|
-
rather than the shared rule's fluid left:0/right:0 span. Scoped instead of edited in
|
|
11962
|
-
place: .vdp-bottom-bar's own left:10px/right:10px override below (higher specificity, so
|
|
11963
|
-
it already wins over the shared rule's left/right) doesn't set `width` — a fixed width in
|
|
11964
|
-
the shared rule would still leak through there, and into .fin-modal-body's tabs which
|
|
11965
|
-
have no override at all. `right: auto` makes the drop explicit rather than relying on
|
|
11966
|
-
the left+right+width overconstraint rule (right is silently ignored once both left and
|
|
11967
|
-
width are set) to do the right thing unremarked. */
|
|
11968
|
-
.md3 .cc-price .fin-tabs::after {
|
|
11969
|
-
left: 18px;
|
|
11970
|
-
right: auto;
|
|
11971
|
-
width: 326px;
|
|
11972
|
-
}
|
|
11973
12020
|
.md3 .fin-tab {
|
|
11974
12021
|
position: relative;
|
|
11975
12022
|
padding: 0;
|
|
@@ -11993,11 +12040,13 @@ color: #005CFF;
|
|
|
11993
12040
|
}
|
|
11994
12041
|
/* Pricing Card / Tabs / active-tab underline — .cc-price only. The shared rule above (also
|
|
11995
12042
|
used by .vdp-bottom-bar's / .fin-modal-body's own tab bars) keeps its 115×4; only the
|
|
11996
|
-
card's own underline
|
|
12043
|
+
card's own underline gets the slightly slimmer 110×3. content/
|
|
11997
12044
|
position/left/bottom/transform/background/border-radius/z-index still come from the base
|
|
11998
|
-
rule above — both match the same ::after, so only width/height need repeating here.
|
|
12045
|
+
rule above — both match the same ::after, so only width/height need repeating here.
|
|
12046
|
+
Never wider than its tab: with three tabs on a phone a tab is narrower than 110px, and the
|
|
12047
|
+
underline stuck out past the divider. */
|
|
11999
12048
|
.md3 .cc-price .fin-tab.on::after {
|
|
12000
|
-
width: 110px;
|
|
12049
|
+
width: min(110px, 100%);
|
|
12001
12050
|
height: 3px;
|
|
12002
12051
|
}
|
|
12003
12052
|
/* no divider above the Persönliche-Beratung row on phone (Figma: the only divider in this
|
|
@@ -12243,11 +12292,13 @@ color: #005CFF;
|
|
|
12243
12292
|
line-height: 28px;
|
|
12244
12293
|
color: #1d2a38;
|
|
12245
12294
|
}
|
|
12246
|
-
.md3 #vdp-bewertungen > div:first-child > div
|
|
12295
|
+
.md3 #vdp-bewertungen > div:first-child > div,
|
|
12296
|
+
.md3 #vdp-bewertungen > div:first-child > .rating-info-area {
|
|
12247
12297
|
margin-left: 30px !important;
|
|
12248
12298
|
gap: 50px !important;
|
|
12249
12299
|
}
|
|
12250
|
-
.md3 #vdp-bewertungen > div:first-child > div .num
|
|
12300
|
+
.md3 #vdp-bewertungen > div:first-child > div .num,
|
|
12301
|
+
.md3 #vdp-bewertungen > div:first-child > .rating-info-area .num {
|
|
12251
12302
|
font-family: Arial, Helvetica, Arimo, sans-serif;
|
|
12252
12303
|
font-style: normal;
|
|
12253
12304
|
font-weight: 700 !important;
|
|
@@ -12255,11 +12306,13 @@ color: #005CFF;
|
|
|
12255
12306
|
line-height: 42px;
|
|
12256
12307
|
color: #1d2a38 !important;
|
|
12257
12308
|
}
|
|
12258
|
-
.md3 #vdp-bewertungen > div:first-child > div .lucide
|
|
12309
|
+
.md3 #vdp-bewertungen > div:first-child > div .lucide,
|
|
12310
|
+
.md3 #vdp-bewertungen > div:first-child > .rating-info-area .lucide {
|
|
12259
12311
|
width: 19px;
|
|
12260
12312
|
height: 19px;
|
|
12261
12313
|
}
|
|
12262
|
-
.md3 #vdp-bewertungen > div:first-child > div .md-label-sm
|
|
12314
|
+
.md3 #vdp-bewertungen > div:first-child > div .md-label-sm,
|
|
12315
|
+
.md3 #vdp-bewertungen > div:first-child > .rating-info-area .md-label-sm {
|
|
12263
12316
|
font-family: Arial, Helvetica, Arimo, sans-serif;
|
|
12264
12317
|
font-style: normal;
|
|
12265
12318
|
font-weight: 400;
|
|
@@ -14060,7 +14113,8 @@ color: #005CFF;
|
|
|
14060
14113
|
flex-direction: column;
|
|
14061
14114
|
width: 100%;
|
|
14062
14115
|
max-width: 560px;
|
|
14063
|
-
|
|
14116
|
+
/* % of the scrim (fixed, inset 0, 16px padding) instead of calc(100vh - 32px): see the iOS note on the mobile .mmodal below */
|
|
14117
|
+
max-height: 100%;
|
|
14064
14118
|
background: var(--md-sc-lowest, #fff);
|
|
14065
14119
|
color: var(--md-on-surface);
|
|
14066
14120
|
border-radius: var(--md-r-lg);
|
|
@@ -14206,7 +14260,8 @@ color: #005CFF;
|
|
|
14206
14260
|
}
|
|
14207
14261
|
.md3 .mmodal {
|
|
14208
14262
|
max-width: 100%;
|
|
14209
|
-
|
|
14263
|
+
/* % of the fixed containing block, not vh/dvh: on iOS vh is the toolbars-collapsed height, and Chrome on iOS does not shrink dvh while its toolbars are shown either, so a 92vh/92dvh bottom sheet grew under the address bar and hid its own header (title, download, close). The fixed box itself always matches the visible area. */
|
|
14264
|
+
max-height: 92%;
|
|
14210
14265
|
border-radius: var(--md-r-lg) var(--md-r-lg) 0 0;
|
|
14211
14266
|
border-bottom: 0;
|
|
14212
14267
|
animation: mmodal-sheet-up 0.25s ease-out;
|
|
@@ -15327,7 +15382,8 @@ color: #005CFF;
|
|
|
15327
15382
|
/* ==========================================================================================
|
|
15328
15383
|
ADV-405 Kreditkosten-Hinweis „Achtung! Kreditaufnahme kostet Geld.“ (ui/CreditCostNotice.tsx)
|
|
15329
15384
|
Verbraucherkreditreform 2026. Figma master „auto.de / Kreditkosten-Hinweis“ (Ton=Hell /
|
|
15330
|
-
Ton=Dunkel).
|
|
15385
|
+
Ton=Dunkel). ADV-439: white panel with the grey border of the CDP sections (.mcard) everywhere,
|
|
15386
|
+
instead of the master's #EEF4FF + #CCDEFF. Radius 12px, Lucide info 16px #005CFF before the
|
|
15331
15387
|
text. Font size/colour follow the host block's conditions line (set per host below via
|
|
15332
15388
|
--ccn-fs / --ccn-color); min. 10px. Never clipped (no nowrap/ellipsis) — legal text.
|
|
15333
15389
|
========================================================================================== */
|
|
@@ -15338,8 +15394,8 @@ color: #005CFF;
|
|
|
15338
15394
|
box-sizing: border-box;
|
|
15339
15395
|
margin: 0;
|
|
15340
15396
|
padding: 8px 10px;
|
|
15341
|
-
background:
|
|
15342
|
-
border: 1px solid
|
|
15397
|
+
background: var(--md-sc-lowest);
|
|
15398
|
+
border: 1px solid var(--md-outline-variant);
|
|
15343
15399
|
border-radius: 12px;
|
|
15344
15400
|
font-family: Arial, Helvetica, Arimo, sans-serif;
|
|
15345
15401
|
font-style: normal;
|
|
@@ -15655,6 +15711,43 @@ color: #005CFF;
|
|
|
15655
15711
|
outline: 2px solid var(--md-primary);
|
|
15656
15712
|
outline-offset: 1px;
|
|
15657
15713
|
}
|
|
15714
|
+
/* the whole rating as one button (RatingSourcesInfo with children): looks exactly like the plain
|
|
15715
|
+
content, hovering anywhere lights up the "ⓘ" circle as hovering the circle alone did */
|
|
15716
|
+
.md3 .rating-info-area {
|
|
15717
|
+
position: relative;
|
|
15718
|
+
display: inline-flex;
|
|
15719
|
+
align-items: center;
|
|
15720
|
+
margin: 0;
|
|
15721
|
+
padding: 0;
|
|
15722
|
+
border: 0;
|
|
15723
|
+
border-radius: var(--md-r-sm);
|
|
15724
|
+
background: none;
|
|
15725
|
+
color: inherit;
|
|
15726
|
+
font: inherit;
|
|
15727
|
+
text-align: inherit;
|
|
15728
|
+
cursor: pointer;
|
|
15729
|
+
}
|
|
15730
|
+
.md3 .rating-info-area--static {
|
|
15731
|
+
cursor: auto;
|
|
15732
|
+
}
|
|
15733
|
+
.md3 .rating-info-area:hover .rating-info-btn {
|
|
15734
|
+
background: var(--md-sc-high);
|
|
15735
|
+
}
|
|
15736
|
+
.md3 .rating-info-area:focus-visible {
|
|
15737
|
+
outline: 2px solid var(--md-primary);
|
|
15738
|
+
outline-offset: 4px;
|
|
15739
|
+
}
|
|
15740
|
+
.md3 .rating-info-sr {
|
|
15741
|
+
position: absolute;
|
|
15742
|
+
width: 1px;
|
|
15743
|
+
height: 1px;
|
|
15744
|
+
margin: -1px;
|
|
15745
|
+
padding: 0;
|
|
15746
|
+
overflow: hidden;
|
|
15747
|
+
clip: rect(0 0 0 0);
|
|
15748
|
+
white-space: nowrap;
|
|
15749
|
+
border: 0;
|
|
15750
|
+
}
|
|
15658
15751
|
.md3 .review-source {
|
|
15659
15752
|
color: inherit;
|
|
15660
15753
|
text-decoration: none;
|
|
@@ -15707,13 +15800,29 @@ color: #005CFF;
|
|
|
15707
15800
|
gap: 8px;
|
|
15708
15801
|
font-size: 16px;
|
|
15709
15802
|
}
|
|
15710
|
-
.md3 .rating-sources-count
|
|
15711
|
-
|
|
15712
|
-
white-space: nowrap;
|
|
15803
|
+
.md3 .rating-sources-count,
|
|
15804
|
+
.md3 .rating-sources-info > p {
|
|
15713
15805
|
font-size: 13px;
|
|
15714
15806
|
line-height: 18px;
|
|
15715
15807
|
opacity: 0.85;
|
|
15716
15808
|
}
|
|
15809
|
+
.md3 .rating-sources-count {
|
|
15810
|
+
grid-area: count;
|
|
15811
|
+
white-space: nowrap;
|
|
15812
|
+
}
|
|
15813
|
+
/* which reviews count and that auto.de does not verify them (ADV-440): a white box with a thin blue
|
|
15814
|
+
border under the total; the border takes 1px of the rows' padding, so the text lines up with them */
|
|
15815
|
+
.md3 .rating-sources-info {
|
|
15816
|
+
margin-top: 10px;
|
|
15817
|
+
padding: 13px 15px;
|
|
15818
|
+
border: 1px solid #4084d8;
|
|
15819
|
+
border-radius: var(--md-r-md);
|
|
15820
|
+
background: var(--md-sc-lowest);
|
|
15821
|
+
color: var(--md-on-surface);
|
|
15822
|
+
}
|
|
15823
|
+
.md3 .rating-sources-info > p {
|
|
15824
|
+
margin: 0;
|
|
15825
|
+
}
|
|
15717
15826
|
.md3 .rating-sources-link,
|
|
15718
15827
|
.md3 .rating-sources-note {
|
|
15719
15828
|
grid-area: link;
|
|
@@ -557,18 +557,29 @@ const range = (min: number, max: number, step: number): number[] => {
|
|
|
557
557
|
return out.length ? out : [min];
|
|
558
558
|
};
|
|
559
559
|
|
|
560
|
+
export interface DetailsLinkProps {
|
|
561
|
+
label: string;
|
|
562
|
+
onClick: () => void;
|
|
563
|
+
/** only the "ⓘ": the label becomes its name and tooltip (VdpStickyBar, ADV-438). */
|
|
564
|
+
iconOnly?: boolean;
|
|
565
|
+
tabIndex?: number;
|
|
566
|
+
}
|
|
567
|
+
|
|
560
568
|
/** quiet primary-colored text link (Finanzierungsdetails / Details anzeigen). */
|
|
561
|
-
const DetailsLink: React.FunctionComponent<
|
|
569
|
+
export const DetailsLink: React.FunctionComponent<DetailsLinkProps> = ({ label, onClick, iconOnly, tabIndex }) => (
|
|
562
570
|
<button
|
|
563
571
|
type="button"
|
|
564
572
|
onClick={onClick}
|
|
573
|
+
tabIndex={tabIndex}
|
|
574
|
+
{...(iconOnly ? { 'aria-label': label, title: label } : {})}
|
|
565
575
|
style={{
|
|
566
576
|
display: 'inline-flex',
|
|
567
577
|
alignItems: 'center',
|
|
568
578
|
gap: 5,
|
|
569
579
|
background: 'none',
|
|
570
580
|
border: 0,
|
|
571
|
-
|
|
581
|
+
// icon only: a 25px click area around the 15px icon that takes no space of its own
|
|
582
|
+
...(iconOnly ? { padding: 5, margin: -5 } : { padding: 0 }),
|
|
572
583
|
cursor: 'pointer',
|
|
573
584
|
color: 'var(--md-primary)',
|
|
574
585
|
font: 'inherit',
|
|
@@ -577,7 +588,7 @@ const DetailsLink: React.FunctionComponent<{ label: string; onClick: () => void
|
|
|
577
588
|
}}
|
|
578
589
|
>
|
|
579
590
|
<Icon name="info" size={15} color="var(--md-primary)" />
|
|
580
|
-
{label}
|
|
591
|
+
{!iconOnly && label}
|
|
581
592
|
</button>
|
|
582
593
|
);
|
|
583
594
|
|
package/vdp/VdpModules.tsx
CHANGED
|
@@ -30,7 +30,7 @@ import { CO2_CLASSES, CO2_COLORS } from '../constants';
|
|
|
30
30
|
import { ratingTone } from '../data/toAutobahnCar';
|
|
31
31
|
import { ratingLinkProps } from '../ui/ratingLink';
|
|
32
32
|
import { defaultVdpSpecs, EquipmentGroups, VehicleDetail, VdpSpec, VdpReview, RatingPortal, RunningCostRow, EnergyTaxSummary } from './types';
|
|
33
|
-
import { AddServicesTooltipBody, CalcRow, DocCheckIcon, EvalBar, EvalPill, evalPillOf, expanderBtnStyle, FinanceMode, Slider, TermChips, ToggleRow } from './FinanceCalculator';
|
|
33
|
+
import { AddServicesTooltipBody, CalcRow, DetailsLink, DocCheckIcon, EvalBar, EvalPill, evalPillOf, expanderBtnStyle, FinanceMode, Slider, TermChips, ToggleRow } from './FinanceCalculator';
|
|
34
34
|
import { formatEur as eur, formatEurCents as eurCents, formatPct as pct } from '../utils/financeFormat';
|
|
35
35
|
|
|
36
36
|
/** mileage → 'X.XXX km' (de-DE grouping). */
|
|
@@ -1010,12 +1010,19 @@ export interface VdpStickyBarProps {
|
|
|
1010
1010
|
show: boolean;
|
|
1011
1011
|
/** primary CTA click. */
|
|
1012
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;
|
|
1013
1020
|
/** i18n function (drilled from the page). */
|
|
1014
1021
|
t: TranslationFunction;
|
|
1015
1022
|
}
|
|
1016
1023
|
|
|
1017
1024
|
/** Desktop sticky summary bar (AS24 pattern) — docks to top, driven by `show`. */
|
|
1018
|
-
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 }) => (
|
|
1019
1026
|
<div className={'vdp-stickytop hide-mobile' + (show ? ' vdp-stickytop--on' : '')}>
|
|
1020
1027
|
<div className="container" style={{ display: 'flex', alignItems: 'center', gap: 18, padding: '10px 24px' }}>
|
|
1021
1028
|
<img
|
|
@@ -1039,15 +1046,21 @@ export const VdpStickyBar: React.FunctionComponent<VdpStickyBarProps> = ({ vehic
|
|
|
1039
1046
|
{fmtKm(vehicle.km)} · {vehicle.reg} · {vehicle.gear}
|
|
1040
1047
|
</div>
|
|
1041
1048
|
</div>
|
|
1042
|
-
<div
|
|
1043
|
-
<div
|
|
1044
|
-
<span
|
|
1045
|
-
<span className="num"
|
|
1046
|
-
|
|
1047
|
-
</span>
|
|
1048
|
-
<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>
|
|
1049
1054
|
</div>
|
|
1050
|
-
|
|
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>
|
|
1051
1064
|
</div>
|
|
1052
1065
|
<Button variant="filled" icon="shield-check" style={{ flex: 'none' }} onClick={onSecure}>
|
|
1053
1066
|
{t('autobahn:sticky.secureOffer')}
|
|
@@ -1536,6 +1549,36 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
|
|
|
1536
1549
|
else animateSheetScroll(() => 0);
|
|
1537
1550
|
}, [showBreakdown, scrollSheetToBreakdown, animateSheetScroll]);
|
|
1538
1551
|
|
|
1552
|
+
// desktop: the popup scrolls wherever the pointer is (it opens under the click, e.g. from the VDP's
|
|
1553
|
+
// sticky header), and by keyboard, so it takes the focus. The page behind is locked: a class on <html>
|
|
1554
|
+
// (md3.css), because other dialogs opened above this one set and clear the inline overflow.
|
|
1555
|
+
const bodyRef = React.useRef<HTMLDivElement | null>(null);
|
|
1556
|
+
React.useLayoutEffect(() => {
|
|
1557
|
+
const body = bodyRef.current;
|
|
1558
|
+
const scrim = sheetRef.current?.parentElement;
|
|
1559
|
+
if (!open || !body || !scrim || !window.matchMedia('(min-width: 601px)').matches) return;
|
|
1560
|
+
const html = document.documentElement;
|
|
1561
|
+
// the scrollbar's width stays reserved, so the page behind does not move
|
|
1562
|
+
html.style.setProperty('--fin-modal-scrollbar', `${window.innerWidth - html.clientWidth}px`);
|
|
1563
|
+
html.classList.add('fin-modal-open');
|
|
1564
|
+
const prevFocus = document.activeElement as HTMLElement | null;
|
|
1565
|
+
body.tabIndex = -1;
|
|
1566
|
+
body.focus({ preventScroll: true });
|
|
1567
|
+
const onWheel = (e: WheelEvent): void => {
|
|
1568
|
+
if (e.ctrlKey) return; // zoom
|
|
1569
|
+
if (body.contains(e.target as Node) && body.scrollHeight > body.clientHeight) return; // scrolls natively
|
|
1570
|
+
e.preventDefault();
|
|
1571
|
+
body.scrollTop += e.deltaMode === 1 ? e.deltaY * 16 : e.deltaY;
|
|
1572
|
+
};
|
|
1573
|
+
scrim.addEventListener('wheel', onWheel, { passive: false });
|
|
1574
|
+
return () => {
|
|
1575
|
+
scrim.removeEventListener('wheel', onWheel);
|
|
1576
|
+
html.classList.remove('fin-modal-open');
|
|
1577
|
+
html.style.removeProperty('--fin-modal-scrollbar');
|
|
1578
|
+
if (prevFocus && document.contains(prevFocus)) prevFocus.focus({ preventScroll: true });
|
|
1579
|
+
};
|
|
1580
|
+
}, [open]);
|
|
1581
|
+
|
|
1539
1582
|
// iOS Safari (26+, "Allow Website Tinting") paints its bottom toolbar area with the page's
|
|
1540
1583
|
// <meta name="theme-color"> (site-wide blue #005CCB) — under the open white sheet that showed
|
|
1541
1584
|
// as a solid blue band right below the CTA. While the sheet is open, theme-color is white;
|
|
@@ -1776,7 +1819,8 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
|
|
|
1776
1819
|
));
|
|
1777
1820
|
|
|
1778
1821
|
return (
|
|
1779
|
-
|
|
1822
|
+
// the second click of a double click on what opened it must not close it again
|
|
1823
|
+
<div className="fin-modal-scrim" onClick={(e) => e.detail < 2 && onClose()}>
|
|
1780
1824
|
<div
|
|
1781
1825
|
className={
|
|
1782
1826
|
'fin-modal' +
|
|
@@ -1811,7 +1855,7 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
|
|
|
1811
1855
|
<Icon name="x" size={20} />
|
|
1812
1856
|
</button>
|
|
1813
1857
|
</div>
|
|
1814
|
-
<div className="fin-modal-body">
|
|
1858
|
+
<div className="fin-modal-body" ref={bodyRef}>
|
|
1815
1859
|
{/* ============================== DESKTOP (≥601px) — always-expanded breakdown, no tabs
|
|
1816
1860
|
(the desktop .fin-calc-card owns its own tabs outside this modal) ============================== */}
|
|
1817
1861
|
<div className="hide-mobile">
|
|
@@ -3179,35 +3223,60 @@ export interface RatingSourcesInfoProps {
|
|
|
3179
3223
|
size?: number;
|
|
3180
3224
|
/** icon colour (default on-surface-variant). */
|
|
3181
3225
|
color?: string;
|
|
3226
|
+
/**
|
|
3227
|
+
* The rating the popup explains (stars, "4,5 / 5", "876 Bewertungen" …). Given, that whole area
|
|
3228
|
+
* plus the "ⓘ" is ONE button that opens the popup, not just the circle. Called with the "ⓘ"
|
|
3229
|
+
* (null without portals) so the caller places it in its own layout. Without portals the area is
|
|
3230
|
+
* rendered as plain content, no button.
|
|
3231
|
+
*/
|
|
3232
|
+
children?: (info: React.ReactElement | null) => React.ReactNode;
|
|
3233
|
+
/** layout of the area (children mode only), e.g. its gap. */
|
|
3234
|
+
style?: React.CSSProperties;
|
|
3182
3235
|
t: TranslationFunction;
|
|
3183
3236
|
}
|
|
3184
3237
|
|
|
3185
3238
|
/**
|
|
3186
3239
|
* "ⓘ" next to the site rating → a popup that explains it: the rating of each portal (Google,
|
|
3187
3240
|
* Trustpilot) with its review count and a nofollow link to all auto.de reviews there, then the
|
|
3188
|
-
* combined, count-weighted average that the page shows
|
|
3241
|
+
* combined, count-weighted average that the page shows, and a note on which reviews count and that
|
|
3242
|
+
* auto.de does not verify them (ADV-440). With `children`, the rating next to the
|
|
3243
|
+
* "ⓘ" opens it too (PM 2026-11-24: "link the entire area, not just the circle").
|
|
3189
3244
|
*/
|
|
3190
|
-
export const RatingSourcesInfo: React.FunctionComponent<RatingSourcesInfoProps> = ({ average, total, portals, size = 18, color, t }) => {
|
|
3245
|
+
export const RatingSourcesInfo: React.FunctionComponent<RatingSourcesInfoProps> = ({ average, total, portals, size = 18, color, children, style, t }) => {
|
|
3191
3246
|
const [open, setOpen] = useState(false);
|
|
3192
3247
|
const list = (portals || []).filter((p) => p && p.name && p.total > 0);
|
|
3193
|
-
if (!list.length)
|
|
3248
|
+
if (!list.length) {
|
|
3249
|
+
return children ? (
|
|
3250
|
+
<span className="rating-info-area rating-info-area--static" style={style}>
|
|
3251
|
+
{children(null)}
|
|
3252
|
+
</span>
|
|
3253
|
+
) : null;
|
|
3254
|
+
}
|
|
3194
3255
|
const names = list.map((p) => p.name).join(` ${t('autobahn:reviews.sources.and')} `);
|
|
3195
3256
|
const avg = average.toLocaleString('de-DE', { minimumFractionDigits: 1, maximumFractionDigits: 1 });
|
|
3257
|
+
const label = t('autobahn:reviews.sources.open');
|
|
3258
|
+
const openPopup = (e: React.MouseEvent) => {
|
|
3259
|
+
e.stopPropagation();
|
|
3260
|
+
setOpen(true);
|
|
3261
|
+
};
|
|
3262
|
+
const icon = <Icon name="info" size={size} color={color || 'var(--md-on-surface-variant)'} style={{ width: size, height: size }} />;
|
|
3196
3263
|
return (
|
|
3197
3264
|
<>
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
className="rating-info-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
<
|
|
3210
|
-
|
|
3265
|
+
{children ? (
|
|
3266
|
+
// the visible rating names the button; the hidden text says what it opens
|
|
3267
|
+
<button type="button" className="rating-info-area" aria-haspopup="dialog" title={label} style={style} onClick={openPopup}>
|
|
3268
|
+
{children(
|
|
3269
|
+
<span className="rating-info-btn" aria-hidden="true">
|
|
3270
|
+
{icon}
|
|
3271
|
+
</span>,
|
|
3272
|
+
)}
|
|
3273
|
+
<span className="rating-info-sr">{label}</span>
|
|
3274
|
+
</button>
|
|
3275
|
+
) : (
|
|
3276
|
+
<button type="button" className="rating-info-btn" aria-label={label} aria-haspopup="dialog" title={label} onClick={openPopup}>
|
|
3277
|
+
{icon}
|
|
3278
|
+
</button>
|
|
3279
|
+
)}
|
|
3211
3280
|
<Modal open={open} onClose={() => setOpen(false)} size="sm" title={t('autobahn:reviews.sources.title')} className="rating-sources">
|
|
3212
3281
|
<p className="md-body" style={{ margin: '0 0 16px', color: 'var(--md-on-surface-variant)' }}>
|
|
3213
3282
|
{t('autobahn:reviews.sources.intro', { portals: names })}
|
|
@@ -3241,6 +3310,9 @@ export const RatingSourcesInfo: React.FunctionComponent<RatingSourcesInfoProps>
|
|
|
3241
3310
|
<span className="rating-sources-note">{t('autobahn:reviews.sources.weighted')}</span>
|
|
3242
3311
|
</li>
|
|
3243
3312
|
</ul>
|
|
3313
|
+
<div className="rating-sources-info">
|
|
3314
|
+
<p>{t('autobahn:reviews.sources.info', { portals: names })}</p>
|
|
3315
|
+
</div>
|
|
3244
3316
|
</Modal>
|
|
3245
3317
|
</>
|
|
3246
3318
|
);
|
|
@@ -3289,20 +3361,23 @@ export const CustomerRatings: React.FunctionComponent<CustomerRatingsProps> = ({
|
|
|
3289
3361
|
<h2 className="md-headline-sm" style={{ margin: 0 }}>
|
|
3290
3362
|
{t('autobahn:reviews.title')}
|
|
3291
3363
|
</h2>
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
<
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3364
|
+
{/* the whole rating (number, stars, count, "ⓘ") opens the sources popup */}
|
|
3365
|
+
<RatingSourcesInfo average={avg} total={headerCount} portals={portals || []} size={16} t={t} style={{ gap: 10, marginLeft: 'auto' }}>
|
|
3366
|
+
{(info) => (
|
|
3367
|
+
<>
|
|
3368
|
+
<span className="num" style={{ fontWeight: 800, fontSize: 26, color: 'var(--md-on-surface)', letterSpacing: '-.5px' }}>
|
|
3369
|
+
{avg.toLocaleString('de-DE', { minimumFractionDigits: 1, maximumFractionDigits: 1 })}
|
|
3370
|
+
</span>
|
|
3371
|
+
<span>
|
|
3372
|
+
<Stars value={avg} size={16} />
|
|
3373
|
+
<span className="md-label-sm" style={{ display: 'flex', alignItems: 'center', gap: 2 }}>
|
|
3374
|
+
{t('autobahn:reviews.ratingCount', { count: headerCount })} · via {sourceLabel || 'Google'}
|
|
3375
|
+
{info}
|
|
3376
|
+
</span>
|
|
3377
|
+
</span>
|
|
3378
|
+
</>
|
|
3379
|
+
)}
|
|
3380
|
+
</RatingSourcesInfo>
|
|
3306
3381
|
</div>
|
|
3307
3382
|
<div className="eq-cols">
|
|
3308
3383
|
{shown.map((r) => (
|