@bytebrand/fe-ui-core-autobahn 1.0.219 → 1.0.220
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/package.json +2 -2
- package/theme/md3.css +51 -7
- package/vdp/VdpModules.tsx +57 -30
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/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.220",
|
|
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
|
@@ -10087,7 +10087,8 @@ line-height: 31px;
|
|
|
10087
10087
|
z-index: 71;
|
|
10088
10088
|
background: var(--md-surface);
|
|
10089
10089
|
border-radius: var(--md-r-xl) var(--md-r-xl) 0 0;
|
|
10090
|
-
|
|
10090
|
+
/* % 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. */
|
|
10091
|
+
max-height: 92%;
|
|
10091
10092
|
display: flex;
|
|
10092
10093
|
flex-direction: column;
|
|
10093
10094
|
box-shadow: 0 -8px 30px rgba(16, 22, 42, 0.22);
|
|
@@ -12243,11 +12244,13 @@ color: #005CFF;
|
|
|
12243
12244
|
line-height: 28px;
|
|
12244
12245
|
color: #1d2a38;
|
|
12245
12246
|
}
|
|
12246
|
-
.md3 #vdp-bewertungen > div:first-child > div
|
|
12247
|
+
.md3 #vdp-bewertungen > div:first-child > div,
|
|
12248
|
+
.md3 #vdp-bewertungen > div:first-child > .rating-info-area {
|
|
12247
12249
|
margin-left: 30px !important;
|
|
12248
12250
|
gap: 50px !important;
|
|
12249
12251
|
}
|
|
12250
|
-
.md3 #vdp-bewertungen > div:first-child > div .num
|
|
12252
|
+
.md3 #vdp-bewertungen > div:first-child > div .num,
|
|
12253
|
+
.md3 #vdp-bewertungen > div:first-child > .rating-info-area .num {
|
|
12251
12254
|
font-family: Arial, Helvetica, Arimo, sans-serif;
|
|
12252
12255
|
font-style: normal;
|
|
12253
12256
|
font-weight: 700 !important;
|
|
@@ -12255,11 +12258,13 @@ color: #005CFF;
|
|
|
12255
12258
|
line-height: 42px;
|
|
12256
12259
|
color: #1d2a38 !important;
|
|
12257
12260
|
}
|
|
12258
|
-
.md3 #vdp-bewertungen > div:first-child > div .lucide
|
|
12261
|
+
.md3 #vdp-bewertungen > div:first-child > div .lucide,
|
|
12262
|
+
.md3 #vdp-bewertungen > div:first-child > .rating-info-area .lucide {
|
|
12259
12263
|
width: 19px;
|
|
12260
12264
|
height: 19px;
|
|
12261
12265
|
}
|
|
12262
|
-
.md3 #vdp-bewertungen > div:first-child > div .md-label-sm
|
|
12266
|
+
.md3 #vdp-bewertungen > div:first-child > div .md-label-sm,
|
|
12267
|
+
.md3 #vdp-bewertungen > div:first-child > .rating-info-area .md-label-sm {
|
|
12263
12268
|
font-family: Arial, Helvetica, Arimo, sans-serif;
|
|
12264
12269
|
font-style: normal;
|
|
12265
12270
|
font-weight: 400;
|
|
@@ -14060,7 +14065,8 @@ color: #005CFF;
|
|
|
14060
14065
|
flex-direction: column;
|
|
14061
14066
|
width: 100%;
|
|
14062
14067
|
max-width: 560px;
|
|
14063
|
-
|
|
14068
|
+
/* % of the scrim (fixed, inset 0, 16px padding) instead of calc(100vh - 32px): see the iOS note on the mobile .mmodal below */
|
|
14069
|
+
max-height: 100%;
|
|
14064
14070
|
background: var(--md-sc-lowest, #fff);
|
|
14065
14071
|
color: var(--md-on-surface);
|
|
14066
14072
|
border-radius: var(--md-r-lg);
|
|
@@ -14206,7 +14212,8 @@ color: #005CFF;
|
|
|
14206
14212
|
}
|
|
14207
14213
|
.md3 .mmodal {
|
|
14208
14214
|
max-width: 100%;
|
|
14209
|
-
|
|
14215
|
+
/* % 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. */
|
|
14216
|
+
max-height: 92%;
|
|
14210
14217
|
border-radius: var(--md-r-lg) var(--md-r-lg) 0 0;
|
|
14211
14218
|
border-bottom: 0;
|
|
14212
14219
|
animation: mmodal-sheet-up 0.25s ease-out;
|
|
@@ -15655,6 +15662,43 @@ color: #005CFF;
|
|
|
15655
15662
|
outline: 2px solid var(--md-primary);
|
|
15656
15663
|
outline-offset: 1px;
|
|
15657
15664
|
}
|
|
15665
|
+
/* the whole rating as one button (RatingSourcesInfo with children): looks exactly like the plain
|
|
15666
|
+
content, hovering anywhere lights up the "ⓘ" circle as hovering the circle alone did */
|
|
15667
|
+
.md3 .rating-info-area {
|
|
15668
|
+
position: relative;
|
|
15669
|
+
display: inline-flex;
|
|
15670
|
+
align-items: center;
|
|
15671
|
+
margin: 0;
|
|
15672
|
+
padding: 0;
|
|
15673
|
+
border: 0;
|
|
15674
|
+
border-radius: var(--md-r-sm);
|
|
15675
|
+
background: none;
|
|
15676
|
+
color: inherit;
|
|
15677
|
+
font: inherit;
|
|
15678
|
+
text-align: inherit;
|
|
15679
|
+
cursor: pointer;
|
|
15680
|
+
}
|
|
15681
|
+
.md3 .rating-info-area--static {
|
|
15682
|
+
cursor: auto;
|
|
15683
|
+
}
|
|
15684
|
+
.md3 .rating-info-area:hover .rating-info-btn {
|
|
15685
|
+
background: var(--md-sc-high);
|
|
15686
|
+
}
|
|
15687
|
+
.md3 .rating-info-area:focus-visible {
|
|
15688
|
+
outline: 2px solid var(--md-primary);
|
|
15689
|
+
outline-offset: 4px;
|
|
15690
|
+
}
|
|
15691
|
+
.md3 .rating-info-sr {
|
|
15692
|
+
position: absolute;
|
|
15693
|
+
width: 1px;
|
|
15694
|
+
height: 1px;
|
|
15695
|
+
margin: -1px;
|
|
15696
|
+
padding: 0;
|
|
15697
|
+
overflow: hidden;
|
|
15698
|
+
clip: rect(0 0 0 0);
|
|
15699
|
+
white-space: nowrap;
|
|
15700
|
+
border: 0;
|
|
15701
|
+
}
|
|
15658
15702
|
.md3 .review-source {
|
|
15659
15703
|
color: inherit;
|
|
15660
15704
|
text-decoration: none;
|
package/vdp/VdpModules.tsx
CHANGED
|
@@ -3179,35 +3179,59 @@ export interface RatingSourcesInfoProps {
|
|
|
3179
3179
|
size?: number;
|
|
3180
3180
|
/** icon colour (default on-surface-variant). */
|
|
3181
3181
|
color?: string;
|
|
3182
|
+
/**
|
|
3183
|
+
* The rating the popup explains (stars, "4,5 / 5", "876 Bewertungen" …). Given, that whole area
|
|
3184
|
+
* plus the "ⓘ" is ONE button that opens the popup, not just the circle. Called with the "ⓘ"
|
|
3185
|
+
* (null without portals) so the caller places it in its own layout. Without portals the area is
|
|
3186
|
+
* rendered as plain content, no button.
|
|
3187
|
+
*/
|
|
3188
|
+
children?: (info: React.ReactElement | null) => React.ReactNode;
|
|
3189
|
+
/** layout of the area (children mode only), e.g. its gap. */
|
|
3190
|
+
style?: React.CSSProperties;
|
|
3182
3191
|
t: TranslationFunction;
|
|
3183
3192
|
}
|
|
3184
3193
|
|
|
3185
3194
|
/**
|
|
3186
3195
|
* "ⓘ" next to the site rating → a popup that explains it: the rating of each portal (Google,
|
|
3187
3196
|
* 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.
|
|
3197
|
+
* combined, count-weighted average that the page shows. With `children`, the rating next to the
|
|
3198
|
+
* "ⓘ" opens it too (PM 2026-11-24: "link the entire area, not just the circle").
|
|
3189
3199
|
*/
|
|
3190
|
-
export const RatingSourcesInfo: React.FunctionComponent<RatingSourcesInfoProps> = ({ average, total, portals, size = 18, color, t }) => {
|
|
3200
|
+
export const RatingSourcesInfo: React.FunctionComponent<RatingSourcesInfoProps> = ({ average, total, portals, size = 18, color, children, style, t }) => {
|
|
3191
3201
|
const [open, setOpen] = useState(false);
|
|
3192
3202
|
const list = (portals || []).filter((p) => p && p.name && p.total > 0);
|
|
3193
|
-
if (!list.length)
|
|
3203
|
+
if (!list.length) {
|
|
3204
|
+
return children ? (
|
|
3205
|
+
<span className="rating-info-area rating-info-area--static" style={style}>
|
|
3206
|
+
{children(null)}
|
|
3207
|
+
</span>
|
|
3208
|
+
) : null;
|
|
3209
|
+
}
|
|
3194
3210
|
const names = list.map((p) => p.name).join(` ${t('autobahn:reviews.sources.and')} `);
|
|
3195
3211
|
const avg = average.toLocaleString('de-DE', { minimumFractionDigits: 1, maximumFractionDigits: 1 });
|
|
3212
|
+
const label = t('autobahn:reviews.sources.open');
|
|
3213
|
+
const openPopup = (e: React.MouseEvent) => {
|
|
3214
|
+
e.stopPropagation();
|
|
3215
|
+
setOpen(true);
|
|
3216
|
+
};
|
|
3217
|
+
const icon = <Icon name="info" size={size} color={color || 'var(--md-on-surface-variant)'} style={{ width: size, height: size }} />;
|
|
3196
3218
|
return (
|
|
3197
3219
|
<>
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
className="rating-info-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
<
|
|
3210
|
-
|
|
3220
|
+
{children ? (
|
|
3221
|
+
// the visible rating names the button; the hidden text says what it opens
|
|
3222
|
+
<button type="button" className="rating-info-area" aria-haspopup="dialog" title={label} style={style} onClick={openPopup}>
|
|
3223
|
+
{children(
|
|
3224
|
+
<span className="rating-info-btn" aria-hidden="true">
|
|
3225
|
+
{icon}
|
|
3226
|
+
</span>,
|
|
3227
|
+
)}
|
|
3228
|
+
<span className="rating-info-sr">{label}</span>
|
|
3229
|
+
</button>
|
|
3230
|
+
) : (
|
|
3231
|
+
<button type="button" className="rating-info-btn" aria-label={label} aria-haspopup="dialog" title={label} onClick={openPopup}>
|
|
3232
|
+
{icon}
|
|
3233
|
+
</button>
|
|
3234
|
+
)}
|
|
3211
3235
|
<Modal open={open} onClose={() => setOpen(false)} size="sm" title={t('autobahn:reviews.sources.title')} className="rating-sources">
|
|
3212
3236
|
<p className="md-body" style={{ margin: '0 0 16px', color: 'var(--md-on-surface-variant)' }}>
|
|
3213
3237
|
{t('autobahn:reviews.sources.intro', { portals: names })}
|
|
@@ -3289,20 +3313,23 @@ export const CustomerRatings: React.FunctionComponent<CustomerRatingsProps> = ({
|
|
|
3289
3313
|
<h2 className="md-headline-sm" style={{ margin: 0 }}>
|
|
3290
3314
|
{t('autobahn:reviews.title')}
|
|
3291
3315
|
</h2>
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
<
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3316
|
+
{/* the whole rating (number, stars, count, "ⓘ") opens the sources popup */}
|
|
3317
|
+
<RatingSourcesInfo average={avg} total={headerCount} portals={portals || []} size={16} t={t} style={{ gap: 10, marginLeft: 'auto' }}>
|
|
3318
|
+
{(info) => (
|
|
3319
|
+
<>
|
|
3320
|
+
<span className="num" style={{ fontWeight: 800, fontSize: 26, color: 'var(--md-on-surface)', letterSpacing: '-.5px' }}>
|
|
3321
|
+
{avg.toLocaleString('de-DE', { minimumFractionDigits: 1, maximumFractionDigits: 1 })}
|
|
3322
|
+
</span>
|
|
3323
|
+
<span>
|
|
3324
|
+
<Stars value={avg} size={16} />
|
|
3325
|
+
<span className="md-label-sm" style={{ display: 'flex', alignItems: 'center', gap: 2 }}>
|
|
3326
|
+
{t('autobahn:reviews.ratingCount', { count: headerCount })} · via {sourceLabel || 'Google'}
|
|
3327
|
+
{info}
|
|
3328
|
+
</span>
|
|
3329
|
+
</span>
|
|
3330
|
+
</>
|
|
3331
|
+
)}
|
|
3332
|
+
</RatingSourcesInfo>
|
|
3306
3333
|
</div>
|
|
3307
3334
|
<div className="eq-cols">
|
|
3308
3335
|
{shown.map((r) => (
|