@bytebrand/fe-ui-core-autobahn 1.0.217 → 1.0.219
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 +8 -1
- package/cards/CarRow.tsx +28 -8
- package/cards/cardParts.tsx +47 -17
- package/compat/PriceRating/PriceRating.styl +5 -7
- package/compat/PriceRatingDetailed/PriceRatingDetailed.styl +8 -6
- package/compat/legacy-theme/priceReviewColors.styl +18 -5
- package/constants/autobahn.ts +39 -0
- package/data/fieldMapping.ts +3 -3
- package/data/toAutobahnCar.ts +14 -12
- package/locales/de/autobahn.json +9 -7
- package/locales/en/autobahn.json +9 -7
- package/package.json +30 -30
- package/theme/md3.css +107 -334
- package/ui/StatChip.tsx +8 -3
- package/ui/index.ts +1 -0
- package/ui/ratingLink.ts +36 -0
- package/vdp/FinanceCalculator.tsx +130 -27
- package/vdp/VdpModules.tsx +58 -924
- package/vdp/index.ts +0 -3
- package/vdp/types.ts +2 -12
package/cards/CarCard.tsx
CHANGED
|
@@ -98,6 +98,12 @@ export interface CarCardProps {
|
|
|
98
98
|
* (still onOpenRateAdjust).
|
|
99
99
|
*/
|
|
100
100
|
onShowFinancingDetails?: (car: AutobahnCar, mode: PaymentMode) => void;
|
|
101
|
+
/**
|
|
102
|
+
* the price-rating badge + bar were clicked — open this car's VDP at its "Preis & Marktwert"
|
|
103
|
+
* section (URL fragment PRICE_SECTION_HASH, #vdp-preis). Page-owned like onShowFinancingDetails;
|
|
104
|
+
* when omitted the badge is not a link (a click opens the car via onOpen, as before).
|
|
105
|
+
*/
|
|
106
|
+
onShowPriceRating?: (car: AutobahnCar) => void;
|
|
101
107
|
}
|
|
102
108
|
|
|
103
109
|
const CarCard: React.FunctionComponent<CarCardProps> = ({
|
|
@@ -113,6 +119,7 @@ const CarCard: React.FunctionComponent<CarCardProps> = ({
|
|
|
113
119
|
onCall,
|
|
114
120
|
onOpenRateAdjust,
|
|
115
121
|
onShowFinancingDetails,
|
|
122
|
+
onShowPriceRating,
|
|
116
123
|
}) => {
|
|
117
124
|
const [mode, setMode] = useState<PaymentMode>('financing');
|
|
118
125
|
const [photoIndex, setPhotoIndex] = useState(0);
|
|
@@ -280,7 +287,7 @@ const CarCard: React.FunctionComponent<CarCardProps> = ({
|
|
|
280
287
|
<PriceTabs car={car} mode={mode} onModeChange={setMode} t={t} />
|
|
281
288
|
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 8, marginTop: 10 }}>
|
|
282
289
|
<PriceHero car={car} mode={mode} t={t} alwaysShowUnit />
|
|
283
|
-
<PriceEvalCol car={car} t={t} />
|
|
290
|
+
<PriceEvalCol car={car} t={t} onActivate={onShowPriceRating ? () => onShowPriceRating(car) : undefined} />
|
|
284
291
|
</div>
|
|
285
292
|
{/* same fallback CardCtaRow already uses below: pages that haven't wired a real
|
|
286
293
|
"Rate anpassen" sheet yet still get a working "Details" link (opens the car). */}
|
package/cards/CarRow.tsx
CHANGED
|
@@ -24,6 +24,7 @@ import React, { useState, useEffect, useRef } from 'react';
|
|
|
24
24
|
import { TranslationFunction } from '../types';
|
|
25
25
|
|
|
26
26
|
import { CardCarousel, IconButton, SaveChip, Button, Icon, StatChip } from '../ui';
|
|
27
|
+
import { ratingLinkProps } from '../ui/ratingLink';
|
|
27
28
|
import {
|
|
28
29
|
EcoLine,
|
|
29
30
|
PriceMeter,
|
|
@@ -80,6 +81,8 @@ export interface CarRowProps {
|
|
|
80
81
|
* links render as plain text (see PricePaths' own fallback).
|
|
81
82
|
*/
|
|
82
83
|
onShowFinancingDetails?: (car: AutobahnCar, mode: PaymentMode) => void;
|
|
84
|
+
/** the price-rating chip + bar were clicked — see CarCard's identically-named prop. */
|
|
85
|
+
onShowPriceRating?: (car: AutobahnCar) => void;
|
|
83
86
|
}
|
|
84
87
|
|
|
85
88
|
const CarRow: React.FunctionComponent<CarRowProps> = ({
|
|
@@ -92,10 +95,22 @@ const CarRow: React.FunctionComponent<CarRowProps> = ({
|
|
|
92
95
|
t,
|
|
93
96
|
adminAction,
|
|
94
97
|
onShowFinancingDetails,
|
|
98
|
+
onShowPriceRating,
|
|
95
99
|
}) => {
|
|
96
100
|
const [mode, setMode] = useState<PaymentMode>('financing');
|
|
97
101
|
const [photoIndex, setPhotoIndex] = useState(0);
|
|
98
102
|
const mediaRef = useRef<HTMLDivElement | null>(null);
|
|
103
|
+
// The price-rating chip + bar link to the car's "Preis & Marktwert" section (page-owned
|
|
104
|
+
// onShowPriceRating, ratingLinkProps). Without it they stay plain: a click opens the car, as
|
|
105
|
+
// before. `noTabStop`: clickable, but not a second tab stop next to the chip.
|
|
106
|
+
const ratingLink = (className: string, noTabStop: boolean = false): React.HTMLAttributes<HTMLElement> => {
|
|
107
|
+
if (!onShowPriceRating || !car.rating) return {};
|
|
108
|
+
const props = ratingLinkProps(
|
|
109
|
+
() => onShowPriceRating(car),
|
|
110
|
+
t('autobahn:finance.priceRatingLink', { rating: t('autobahn:tier.' + car.rating) }),
|
|
111
|
+
);
|
|
112
|
+
return noTabStop ? { className, onClick: props.onClick, 'aria-hidden': true } : { className, ...props };
|
|
113
|
+
};
|
|
99
114
|
// always call the LATEST onMediaEnter without re-arming the observer on every render (the
|
|
100
115
|
// page callers construct a fresh closure each render) — the effect itself only needs to run
|
|
101
116
|
// once per mount. Identical pattern to CarCard.tsx — see its own comment for the rationale.
|
|
@@ -275,13 +290,18 @@ const CarRow: React.FunctionComponent<CarRowProps> = ({
|
|
|
275
290
|
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 8 }}>
|
|
276
291
|
<PriceHero car={car} mode={mode} t={t} alwaysShowUnit />
|
|
277
292
|
{car.rating && (
|
|
278
|
-
<
|
|
279
|
-
{
|
|
280
|
-
|
|
281
|
-
|
|
293
|
+
<span {...ratingLink('rating-link')}>
|
|
294
|
+
<StatChip rating={car.rating} icon={ratingTone(car.rating) === 'good' ? 'check' : 'minus'}>
|
|
295
|
+
{t('autobahn:tier.' + car.rating)}
|
|
296
|
+
<sup>4</sup>
|
|
297
|
+
</StatChip>
|
|
298
|
+
</span>
|
|
282
299
|
)}
|
|
283
300
|
</div>
|
|
284
|
-
|
|
301
|
+
{/* the bar is clickable too, but not a second tab stop (the chip above is the link) */}
|
|
302
|
+
<div {...ratingLink('rating-link', true)}>
|
|
303
|
+
<PriceMeter t={t} car={car} />
|
|
304
|
+
</div>
|
|
285
305
|
<div className="pp-cta">
|
|
286
306
|
<Button
|
|
287
307
|
variant="filled"
|
|
@@ -320,11 +340,11 @@ const CarRow: React.FunctionComponent<CarRowProps> = ({
|
|
|
320
340
|
/>
|
|
321
341
|
<div className="pp-purchase hide-mobile">
|
|
322
342
|
<PriceKauf car={car} t={t} />
|
|
323
|
-
<div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
|
|
343
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: 10 }} {...ratingLink('rating-link')}>
|
|
324
344
|
{car.rating && (
|
|
325
|
-
<StatChip
|
|
345
|
+
<StatChip rating={car.rating} icon={ratingTone(car.rating) === 'good' ? 'check' : 'minus'}>
|
|
326
346
|
{t('autobahn:tier.' + car.rating)}
|
|
327
|
-
|
|
347
|
+
<sup>4</sup>
|
|
328
348
|
</StatChip>
|
|
329
349
|
)}
|
|
330
350
|
<div style={{ flex: 1 }}>
|
package/cards/cardParts.tsx
CHANGED
|
@@ -20,8 +20,9 @@ import { defaultConfig } from '@bytebrand/fe-financing';
|
|
|
20
20
|
|
|
21
21
|
import { Icon, Button, CreditCostNotice, CreditKeyFigures, hasCreditKeyFigures } from '../ui';
|
|
22
22
|
import type { CreditKeyFiguresData } from '../ui';
|
|
23
|
-
import { EvalBar } from '../vdp/FinanceCalculator';
|
|
24
|
-
import {
|
|
23
|
+
import { EvalBar, EvalPill } from '../vdp/FinanceCalculator';
|
|
24
|
+
import { ratingLinkProps } from '../ui/ratingLink';
|
|
25
|
+
import { CO2_CLASSES, CO2_COLORS, TIER_KEYS, TIER_COLORS, NO_RATING_KEY, ratingColorsOf } from '../constants';
|
|
25
26
|
import { AutobahnCar } from './types';
|
|
26
27
|
// pure, non-React — shared with the Meta AIA marketing-image renderer (a plain Node service).
|
|
27
28
|
export { ratingTone } from '../data/toAutobahnCar';
|
|
@@ -449,6 +450,8 @@ const TONE_TO_TIER: Record<string, number> = { top: 0, good: 1, fair: 2, raised:
|
|
|
449
450
|
* Renders nothing when there is no rating/band (needs-data: we never draw a fake market position).
|
|
450
451
|
*/
|
|
451
452
|
export const PriceMeter: React.FunctionComponent<{ car: AutobahnCar; t: TranslationFunction }> = ({ car }) => {
|
|
453
|
+
// "Keine Bewertung": the price is outside the bands, so no marker anywhere on the scale
|
|
454
|
+
if (car.rating === NO_RATING_KEY) return <EvalBar tier={null} />;
|
|
452
455
|
const hasMarket =
|
|
453
456
|
car.marketLow != null && car.marketAvg != null && car.marketHigh != null && car.marketHigh > car.marketLow;
|
|
454
457
|
const bar = (tier: number) => {
|
|
@@ -460,7 +463,7 @@ export const PriceMeter: React.FunctionComponent<{ car: AutobahnCar; t: Translat
|
|
|
460
463
|
<span key={i} className="fin-eval-seg" style={{ background: c }} />
|
|
461
464
|
))}
|
|
462
465
|
<div
|
|
463
|
-
className=
|
|
466
|
+
className="fin-eval-thumb"
|
|
464
467
|
style={{ left: `${leftPct}%`, borderColor: TIER_COLORS[tierIndex] }}
|
|
465
468
|
/>
|
|
466
469
|
</div>
|
|
@@ -482,9 +485,38 @@ export const PriceMeter: React.FunctionComponent<{ car: AutobahnCar; t: Translat
|
|
|
482
485
|
* Preisbewertung pill + segmented tier bar, grouped in one column exactly like the VDP
|
|
483
486
|
* finance-calculator's mobile .fin-eval-col (FinanceCalculator.tsx/EvalBar) — the grid card's
|
|
484
487
|
* replacement for the old StatChip pill + full-width gradient .pp-bar pairing. Renders nothing
|
|
485
|
-
* without a rating (needs-data: never invent a tier).
|
|
488
|
+
* without a rating (needs-data: never invent a tier). With `onActivate` the pill + bar are one link
|
|
489
|
+
* (ratingLinkProps): the page opens the car's VDP at its "Preis & Marktwert" section.
|
|
486
490
|
*/
|
|
487
|
-
export const PriceEvalCol: React.FunctionComponent<{ car: AutobahnCar; t: TranslationFunction
|
|
491
|
+
export const PriceEvalCol: React.FunctionComponent<{ car: AutobahnCar; t: TranslationFunction; onActivate?: () => void }> = ({
|
|
492
|
+
car,
|
|
493
|
+
t,
|
|
494
|
+
onActivate,
|
|
495
|
+
}) => {
|
|
496
|
+
const linkProps = (label: string) =>
|
|
497
|
+
onActivate
|
|
498
|
+
? { className: 'fin-eval-col rating-link', ...ratingLinkProps(onActivate, t('autobahn:finance.priceRatingLink', { rating: label })) }
|
|
499
|
+
: { className: 'fin-eval-col' };
|
|
500
|
+
if (car.rating === NO_RATING_KEY) {
|
|
501
|
+
// "Keine Bewertung": grey pill, the usual bar without a marker
|
|
502
|
+
const noRatingLabel = t('autobahn:tier.' + NO_RATING_KEY);
|
|
503
|
+
const noRating = ratingColorsOf(NO_RATING_KEY);
|
|
504
|
+
return (
|
|
505
|
+
<div {...linkProps(noRatingLabel)}>
|
|
506
|
+
<div className="fin-eval-pill-cell">
|
|
507
|
+
<EvalPill
|
|
508
|
+
label={noRatingLabel}
|
|
509
|
+
color={noRating.color}
|
|
510
|
+
background={noRating.background}
|
|
511
|
+
ariaLabel={t('autobahn:finance.priceRatingAria', { rating: noRatingLabel })}
|
|
512
|
+
/>
|
|
513
|
+
</div>
|
|
514
|
+
<div className="fin-eval-bar-cell">
|
|
515
|
+
<EvalBar tier={null} />
|
|
516
|
+
</div>
|
|
517
|
+
</div>
|
|
518
|
+
);
|
|
519
|
+
}
|
|
488
520
|
const tier = car.rating ? TONE_TO_TIER[car.rating] : undefined;
|
|
489
521
|
if (tier == null) return null;
|
|
490
522
|
const hasMarket =
|
|
@@ -497,20 +529,18 @@ export const PriceEvalCol: React.FunctionComponent<{ car: AutobahnCar; t: Transl
|
|
|
497
529
|
// each tier shows its own real label now (Top/Guter/Fairer/Erhöht/Hoher Preis) — no more
|
|
498
530
|
// collapsing 'good' onto the "Top-Preis" claim. Pill styling (colour/class/footnote) unchanged.
|
|
499
531
|
const tierLabel = t('autobahn:tier.' + car.rating);
|
|
500
|
-
//
|
|
501
|
-
|
|
502
|
-
const pillColor = isGood ? TIER_COLORS[0] : TIER_COLORS[tier];
|
|
532
|
+
// the tier's own badge colours (--rating-*), the same as on every other page
|
|
533
|
+
const pill = ratingColorsOf(car.rating);
|
|
503
534
|
return (
|
|
504
|
-
<div
|
|
535
|
+
<div {...linkProps(tierLabel)}>
|
|
505
536
|
<div className="fin-eval-pill-cell">
|
|
506
|
-
<
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
{tierLabel}
|
|
512
|
-
|
|
513
|
-
</span>
|
|
537
|
+
<EvalPill
|
|
538
|
+
label={tierLabel}
|
|
539
|
+
color={pill.color}
|
|
540
|
+
background={pill.background}
|
|
541
|
+
good={isGood}
|
|
542
|
+
ariaLabel={t('autobahn:finance.priceRatingAria', { rating: tierLabel })}
|
|
543
|
+
/>
|
|
514
544
|
</div>
|
|
515
545
|
<div className="fin-eval-bar-cell">
|
|
516
546
|
<EvalBar tier={tier} leftPct={leftPct} />
|
|
@@ -36,12 +36,10 @@
|
|
|
36
36
|
color: $priceReviewColors[darkBackground]
|
|
37
37
|
border: 2px solid $priceReviewColors[darkBackground]
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if $color == $priceReviewColors.noRating
|
|
42
|
-
$color = $priceReviewColors[darkBackground]
|
|
43
|
-
$backgroundColor = $priceReviewColors[colorName]
|
|
39
|
+
// label: the rating's text colour; segment: its scale colour
|
|
40
|
+
for colorName in $priceReviewTextColors
|
|
44
41
|
.{colorName}
|
|
45
|
-
color: $
|
|
42
|
+
color: $priceReviewTextColors[colorName]
|
|
43
|
+
for colorName in $priceReviewColors
|
|
46
44
|
.{colorName}Background
|
|
47
|
-
border: 2px solid $
|
|
45
|
+
border: 2px solid $priceReviewColors[colorName]
|
|
@@ -71,26 +71,28 @@
|
|
|
71
71
|
|
|
72
72
|
.noRatingTooltip
|
|
73
73
|
@extends .baseTooltip
|
|
74
|
-
color:
|
|
75
|
-
border-color:
|
|
74
|
+
color: $priceReviewTextColors[noRating]
|
|
75
|
+
border-color: #C8D1DE
|
|
76
76
|
|
|
77
77
|
.tooltip
|
|
78
78
|
@extends .baseTooltip
|
|
79
79
|
color: white
|
|
80
80
|
|
|
81
|
+
// segment: the rating's scale colour; tooltip (text on white): its text colour
|
|
81
82
|
for colorName in $priceReviewColors
|
|
82
83
|
$color = $priceReviewColors[colorName]
|
|
84
|
+
$textColor = $priceReviewTextColors[colorName] || $color
|
|
83
85
|
.{colorName}
|
|
84
86
|
&.segment
|
|
85
87
|
background-color $color
|
|
86
88
|
.tooltipWrapper
|
|
87
89
|
&:after
|
|
88
|
-
background-color: $
|
|
90
|
+
background-color: $textColor
|
|
89
91
|
.tooltip
|
|
90
|
-
border-color: $
|
|
91
|
-
color: $
|
|
92
|
+
border-color: $textColor
|
|
93
|
+
color: $textColor
|
|
92
94
|
&:after
|
|
93
|
-
background-color: $
|
|
95
|
+
background-color: $textColor
|
|
94
96
|
|
|
95
97
|
.compact
|
|
96
98
|
& .segment
|
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
|
|
2
|
+
// The old Preisbewertung popup (PriceRating, PriceRatingDetailed) in the price-rating colours every
|
|
3
|
+
// other page uses (Figma 474sauvNgCYK2mEq5iks9e 142:3643; the lib's constants/autobahn.ts and md3.css
|
|
4
|
+
// --rating-*). $priceReviewColors: the scale (TIER_COLORS, --rating-*-bar); noRating/darkBackground
|
|
5
|
+
// stay the empty-segment grey.
|
|
2
6
|
$priceReviewColors = {
|
|
3
7
|
noRating: rgba(76, 78, 100, 0.22)
|
|
4
8
|
darkBackground: rgba(76, 78, 100, 0.22)
|
|
5
|
-
highPrice:
|
|
6
|
-
increasedPrice:
|
|
7
|
-
fairPrice:
|
|
8
|
-
goodPrice:
|
|
9
|
-
topPrice:
|
|
9
|
+
highPrice: #E60000
|
|
10
|
+
increasedPrice: #F26B43
|
|
11
|
+
fairPrice: #F7C544
|
|
12
|
+
goodPrice: #66B84D
|
|
13
|
+
topPrice: #168A45
|
|
14
|
+
}
|
|
15
|
+
// the rating labels' text (TIER_TEXT_COLORS / NO_RATING_COLOR, --rating-*-fg)
|
|
16
|
+
$priceReviewTextColors = {
|
|
17
|
+
noRating: #5B6B7F
|
|
18
|
+
highPrice: #E60000
|
|
19
|
+
increasedPrice: #F26B43
|
|
20
|
+
fairPrice: #FFB800
|
|
21
|
+
goodPrice: #66B84D
|
|
22
|
+
topPrice: #168A45
|
|
10
23
|
}
|
|
11
24
|
|
|
12
25
|
|
package/constants/autobahn.ts
CHANGED
|
@@ -22,10 +22,49 @@ export const TIER_LABELS = ['Top Preis', 'Guter Preis', 'Fairer Preis', 'Erhöht
|
|
|
22
22
|
// i18n key suffixes parallel to TIER_LABELS — components render t('autobahn:tier.<key>') so the
|
|
23
23
|
// Preisbewertung label localizes (TIER_LABELS stays the German source-of-truth used for tier→index logic).
|
|
24
24
|
export const TIER_KEYS = ['top', 'good', 'fair', 'raised', 'high'] as const;
|
|
25
|
+
/** the five segments (and the marker ring) of the price-rating bar */
|
|
25
26
|
export const TIER_COLORS: readonly string[] = ['#168A45', '#66B84D', '#F7C544', '#F26B43', '#E60000'];
|
|
27
|
+
/**
|
|
28
|
+
* Price-rating badge colours, the same on every page (Figma 474sauvNgCYK2mEq5iks9e 142:3643
|
|
29
|
+
* "Die auto.de Bewertungskategorien"): the label's text colour on its background, per tier.
|
|
30
|
+
* md3.css repeats them as --rating-<key>-fg / --rating-<key>-bg for the CSS-only badges; fe-main's
|
|
31
|
+
* ratingPalette test keeps the two in step.
|
|
32
|
+
*/
|
|
33
|
+
export const TIER_TEXT_COLORS: readonly string[] = ['#168A45', '#66B84D', '#FFB800', '#F26B43', '#E60000'];
|
|
26
34
|
export const TIER_BACKGROUNDS: readonly string[] = ['#DFF3E5', '#E4F3DF', '#FFF6DB', '#FFEFD5', '#FFD3D3'];
|
|
27
35
|
export type RatingTier = 0 | 1 | 2 | 3 | 4;
|
|
28
36
|
|
|
37
|
+
/**
|
|
38
|
+
* "Keine Bewertung": getPriceRating returned 0 for a real price, because the price is outside the
|
|
39
|
+
* rating bands (more than 25% above the market value). That is no tier, so it is never shown as
|
|
40
|
+
* one. It is a grey "Keine Bewertung" pill; the bar keeps its usual colours but has no marker,
|
|
41
|
+
* since the price has no place on the scale.
|
|
42
|
+
* mapRating emits NO_RATING_KEY as `rating` and NO_RATING_LABEL as `ratingLabel`; the label key is
|
|
43
|
+
* t('autobahn:tier.none').
|
|
44
|
+
*/
|
|
45
|
+
export const NO_RATING_KEY = 'none';
|
|
46
|
+
export const NO_RATING_LABEL = 'Keine Bewertung';
|
|
47
|
+
/** "Keine Bewertung" badge text and background (Figma 142:3643, like TIER_TEXT_COLORS) */
|
|
48
|
+
export const NO_RATING_COLOR = '#5B6B7F';
|
|
49
|
+
export const NO_RATING_BACKGROUND = '#C8D1DE';
|
|
50
|
+
|
|
51
|
+
/** Badge text colour and background of a mapRating() `rating` key ('top' … 'high', or
|
|
52
|
+
* NO_RATING_KEY). An unknown key falls back to 'good', as evalTierOf does. */
|
|
53
|
+
export function ratingColorsOf(rating?: string): { color: string; background: string } {
|
|
54
|
+
if (rating === NO_RATING_KEY) return { color: NO_RATING_COLOR, background: NO_RATING_BACKGROUND };
|
|
55
|
+
const index = TIER_KEYS.indexOf(rating as (typeof TIER_KEYS)[number]);
|
|
56
|
+
const tier = index >= 0 ? index : 1;
|
|
57
|
+
return { color: TIER_TEXT_COLORS[tier], background: TIER_BACKGROUNDS[tier] };
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Tier index (0 Top … 4 Hoch) of a mapRating() `ratingLabel`, or null for "Keine Bewertung".
|
|
61
|
+
* An unknown label falls back to 1, as the components always did. */
|
|
62
|
+
export function evalTierOf(ratingLabel?: string): RatingTier | null {
|
|
63
|
+
if (ratingLabel === NO_RATING_LABEL) return null;
|
|
64
|
+
const index = TIER_LABELS.indexOf(ratingLabel as (typeof TIER_LABELS)[number]);
|
|
65
|
+
return (index >= 0 ? index : 1) as RatingTier;
|
|
66
|
+
}
|
|
67
|
+
|
|
29
68
|
/** SRP sort options (labels match the design; mapped to real sort params by the SRP container). */
|
|
30
69
|
export const SORTS = [
|
|
31
70
|
'Relevanz',
|
package/data/fieldMapping.ts
CHANGED
|
@@ -226,18 +226,18 @@ export const FIELD_MAPPINGS: readonly FieldMapping[] = [
|
|
|
226
226
|
status: 'wired',
|
|
227
227
|
source: 'price.currentSalesPrice + price.mlCurrentSalesPricePredicted',
|
|
228
228
|
transform:
|
|
229
|
-
"getPriceRating(sale, predicted) [0..5] → autobahn tone: 5→'top' 4→'good' 3→'fair' 2→'raised' 1→'high'; 0(noRating)→
|
|
229
|
+
"getPriceRating(sale, predicted) [0..5] → autobahn tone: 5→'top' 4→'good' 3→'fair' 2→'raised' 1→'high'; 0(noRating, price more than 25% above the market value)→'none' (Keine Bewertung)",
|
|
230
230
|
confirmedAt:
|
|
231
231
|
'VehicleInfo.tsx:160 (SRP card renders getPriceRating(currentSalesPrice, mlCurrentSalesPricePredicted)) · CommonUtils.ts:353-373 (getPriceRating) · price.ts:1 (priceRatings order) · DataTransformers.ts:354 (mlCurrentSalesPricePredicted)',
|
|
232
232
|
notes:
|
|
233
|
-
"REAL Preisbewertung. Card only special-cases tone==='fair' → warn pill; every other tone → good/green pill (CarCard.tsx:96-97).
|
|
233
|
+
"REAL Preisbewertung. Card only special-cases tone==='fair' → warn pill; every other tone → good/green pill (CarCard.tsx:96-97). noRating is no tier: 'none', a grey Keine Bewertung pill without a marker (it used to be folded into 'fair'). predicted falls back to sale*1.07814 (PREDICTABLE_PRICE_INDEX) inside getPriceRating, exactly like the live card.",
|
|
234
234
|
},
|
|
235
235
|
{
|
|
236
236
|
field: 'ratingLabel',
|
|
237
237
|
required: true,
|
|
238
238
|
status: 'wired',
|
|
239
239
|
source: 'derived from the rating tier',
|
|
240
|
-
transform: "TIER_LABELS[tier] → 'Top Preis'|'Guter Preis'|'Fairer Preis'|'Erhöht'|'Hoher Preis'",
|
|
240
|
+
transform: "TIER_LABELS[tier] → 'Top Preis'|'Guter Preis'|'Fairer Preis'|'Erhöht'|'Hoher Preis', or NO_RATING_LABEL 'Keine Bewertung'",
|
|
241
241
|
confirmedAt:
|
|
242
242
|
'autobahn/constants.ts:17 (TIER_LABELS) · fe-ui-core locales/priceRating.ts:2-9 (legacy German labels: TOP/GUTER/FAIRER/ERHÖHTER/HOHER PREIS)',
|
|
243
243
|
notes:
|
package/data/toAutobahnCar.ts
CHANGED
|
@@ -29,7 +29,7 @@ import { getPowerLabel } from '../utils/power';
|
|
|
29
29
|
|
|
30
30
|
import { AutobahnCar, AutobahnPhev } from '../cards/types';
|
|
31
31
|
import { leasingKeyFigures } from '../ui/CreditKeyFigures';
|
|
32
|
-
import { TIER_LABELS, RatingTier, CO2_CLASSES, Co2Class } from '../constants/autobahn';
|
|
32
|
+
import { TIER_LABELS, RatingTier, CO2_CLASSES, Co2Class, NO_RATING_KEY, NO_RATING_LABEL } from '../constants/autobahn';
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* Last-resort placeholder shown in the carousel until the real images for a car
|
|
@@ -238,13 +238,13 @@ export function co2ClassLetter(code: any): Co2Class | '' {
|
|
|
238
238
|
* topPrice(5)→0 'Top Preis' · goodPrice(4)→1 'Guter Preis' ·
|
|
239
239
|
* fairPrice(3)→2 'Fairer Preis' · increasedPrice(2)→3 'Erhöht' ·
|
|
240
240
|
* highPrice(1)→4 'Hoher Preis'.
|
|
241
|
-
* noRating(0)
|
|
242
|
-
*
|
|
243
|
-
* the
|
|
241
|
+
* noRating(0) means the price is outside the bands (more than 25% above the market value). It is
|
|
242
|
+
* no tier: it maps to NO_RATING_KEY 'none' / NO_RATING_LABEL 'Keine Bewertung', a grey pill and
|
|
243
|
+
* the usual bar without a marker. It used to be folded into 'Fairer Preis', so a car priced 57%
|
|
244
|
+
* above the market showed "Fairer Preis".
|
|
244
245
|
*
|
|
245
|
-
* AutobahnCar.rating is a free string
|
|
246
|
-
*
|
|
247
|
-
* neutral 'fair' maps to the warn pill exactly like the design intends.
|
|
246
|
+
* AutobahnCar.rating is a free string: the autobahn tier key ('top'|'good'|'fair'|'raised'|'high')
|
|
247
|
+
* or 'none'. Callers only compute it for a real, positive price; without one it stays ''.
|
|
248
248
|
*/
|
|
249
249
|
const LEGACY_TO_TIER: Record<number, RatingTier> = {
|
|
250
250
|
5: 0, // topPrice → Top Preis
|
|
@@ -263,18 +263,20 @@ const TIER_TONE: Record<RatingTier, string> = {
|
|
|
263
263
|
|
|
264
264
|
export function mapRating(currentSalesPrice?: number, predicted?: number): { rating: string; ratingLabel: string } {
|
|
265
265
|
const legacy = getPriceRating(currentSalesPrice as number, predicted as number); // 0..5
|
|
266
|
-
|
|
267
|
-
|
|
266
|
+
const tier: RatingTier | undefined = LEGACY_TO_TIER[legacy];
|
|
267
|
+
if (tier == null) return { rating: NO_RATING_KEY, ratingLabel: NO_RATING_LABEL };
|
|
268
268
|
return { rating: TIER_TONE[tier], ratingLabel: TIER_LABELS[tier] };
|
|
269
269
|
}
|
|
270
270
|
|
|
271
271
|
/**
|
|
272
272
|
* Map the 5-tier rating to a 2-tone signal — only 'top'/'good' read as a genuinely good deal
|
|
273
273
|
* (green); 'fair'/'raised'/'high' all get the warn/peach tone (Figma: "Erhöhter-Preis" is
|
|
274
|
-
* peach, not green). Pure/non-React on purpose
|
|
275
|
-
*
|
|
274
|
+
* peach, not green). "Keine Bewertung" is neither: 'neutral' (grey). Pure/non-React on purpose.
|
|
275
|
+
* The rating chips take their colours per tier now (StatChip's `rating`, the --rating-* palette); this
|
|
276
|
+
* only picks their icon (check for a good deal, minus otherwise).
|
|
276
277
|
*/
|
|
277
|
-
export function ratingTone(rating: string): 'good' | 'warn' {
|
|
278
|
+
export function ratingTone(rating: string): 'good' | 'warn' | 'neutral' {
|
|
279
|
+
if (rating === NO_RATING_KEY) return 'neutral';
|
|
278
280
|
return rating === 'top' || rating === 'good' ? 'good' : 'warn';
|
|
279
281
|
}
|
|
280
282
|
|
package/locales/de/autobahn.json
CHANGED
|
@@ -95,6 +95,7 @@
|
|
|
95
95
|
"uvp": "UVP",
|
|
96
96
|
"priceRating": "Preisbewertung",
|
|
97
97
|
"priceRatingAria": "Preisbewertung: {{rating}}",
|
|
98
|
+
"priceRatingLink": "Preisbewertung: {{rating}} – zu Preis & Marktwert",
|
|
98
99
|
"detailsShow": "Details anzeigen",
|
|
99
100
|
"paymentLabel": "Zahlung",
|
|
100
101
|
"paymentValue": "Überweisung",
|
|
@@ -559,7 +560,8 @@
|
|
|
559
560
|
"good": "Guter Preis",
|
|
560
561
|
"fair": "Fairer-Preis",
|
|
561
562
|
"raised": "Erhöhter Preis",
|
|
562
|
-
"high": "Hoher Preis"
|
|
563
|
+
"high": "Hoher Preis",
|
|
564
|
+
"none": "Keine Bewertung"
|
|
563
565
|
},
|
|
564
566
|
"sort": {
|
|
565
567
|
"relevance": "Relevanz",
|
|
@@ -662,27 +664,27 @@
|
|
|
662
664
|
"categories": {
|
|
663
665
|
"topPrice": {
|
|
664
666
|
"label": "Top-Preis",
|
|
665
|
-
"description": "Der Preis
|
|
667
|
+
"description": "Der Preis liegt deutlich unter dem geschätzten Marktwert."
|
|
666
668
|
},
|
|
667
669
|
"goodPrice": {
|
|
668
670
|
"label": "Guter Preis",
|
|
669
|
-
"description": "Der Preis liegt etwas unter dem
|
|
671
|
+
"description": "Der Preis liegt etwas unter dem geschätzten Marktwert."
|
|
670
672
|
},
|
|
671
673
|
"fairPrice": {
|
|
672
674
|
"label": "Fairer Preis",
|
|
673
|
-
"description": "
|
|
675
|
+
"description": "Der Preis entspricht in etwa dem geschätzten Marktwert."
|
|
674
676
|
},
|
|
675
677
|
"increasedPrice": {
|
|
676
678
|
"label": "Erhöhter Preis",
|
|
677
|
-
"description": "Der Preis liegt etwas
|
|
679
|
+
"description": "Der Preis liegt etwas über dem geschätzten Marktwert."
|
|
678
680
|
},
|
|
679
681
|
"highPrice": {
|
|
680
682
|
"label": "Hoher Preis",
|
|
681
|
-
"description": "Der Preis
|
|
683
|
+
"description": "Der Preis liegt deutlich über dem geschätzten Marktwert vergleichbarer Fahrzeuge. Eine umfangreiche Ausstattung, Umbauten oder ein besonders guter Zustand können einen höheren Preis rechtfertigen. Bitte beachten Sie die Fahrzeugbeschreibung."
|
|
682
684
|
},
|
|
683
685
|
"noRating": {
|
|
684
686
|
"label": "Keine Bewertung",
|
|
685
|
-
"description": "
|
|
687
|
+
"description": "Für dieses Fahrzeug ist keine Preisbewertung möglich, z. B. weil nicht genügend vergleichbare Angebote vorliegen (etwa bei seltenen Modellen) oder Fahrzeugangaben fehlen."
|
|
686
688
|
}
|
|
687
689
|
}
|
|
688
690
|
},
|
package/locales/en/autobahn.json
CHANGED
|
@@ -95,6 +95,7 @@
|
|
|
95
95
|
"uvp": "RRP",
|
|
96
96
|
"priceRating": "Price rating",
|
|
97
97
|
"priceRatingAria": "Price rating: {{rating}}",
|
|
98
|
+
"priceRatingLink": "Price rating: {{rating}} – go to price & market value",
|
|
98
99
|
"detailsShow": "Show details",
|
|
99
100
|
"paymentLabel": "Payment",
|
|
100
101
|
"paymentValue": "Bank transfer",
|
|
@@ -559,7 +560,8 @@
|
|
|
559
560
|
"good": "Good price",
|
|
560
561
|
"fair": "Fair price",
|
|
561
562
|
"raised": "Increased price",
|
|
562
|
-
"high": "High price"
|
|
563
|
+
"high": "High price",
|
|
564
|
+
"none": "No rating"
|
|
563
565
|
},
|
|
564
566
|
"sort": {
|
|
565
567
|
"relevance": "Relevance",
|
|
@@ -662,27 +664,27 @@
|
|
|
662
664
|
"categories": {
|
|
663
665
|
"topPrice": {
|
|
664
666
|
"label": "Top price",
|
|
665
|
-
"description": "The price is
|
|
667
|
+
"description": "The price is well below the estimated market value."
|
|
666
668
|
},
|
|
667
669
|
"goodPrice": {
|
|
668
670
|
"label": "Good price",
|
|
669
|
-
"description": "The price
|
|
671
|
+
"description": "The price is slightly below the estimated market value."
|
|
670
672
|
},
|
|
671
673
|
"fairPrice": {
|
|
672
674
|
"label": "Fair price",
|
|
673
|
-
"description": "The price
|
|
675
|
+
"description": "The price roughly matches the estimated market value."
|
|
674
676
|
},
|
|
675
677
|
"increasedPrice": {
|
|
676
678
|
"label": "Increased price",
|
|
677
|
-
"description": "The price
|
|
679
|
+
"description": "The price is slightly above the estimated market value."
|
|
678
680
|
},
|
|
679
681
|
"highPrice": {
|
|
680
682
|
"label": "High price",
|
|
681
|
-
"description": "The price
|
|
683
|
+
"description": "The price is well above the estimated market value of comparable vehicles. Extensive equipment, conversions or a particularly good condition can justify a higher price. Please note the vehicle description."
|
|
682
684
|
},
|
|
683
685
|
"noRating": {
|
|
684
686
|
"label": "No rating",
|
|
685
|
-
"description": "
|
|
687
|
+
"description": "No price rating is possible for this vehicle, e.g. because there are not enough comparable offers (such as for rare models) or vehicle details are missing."
|
|
686
688
|
}
|
|
687
689
|
}
|
|
688
690
|
},
|
package/package.json
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@bytebrand/fe-ui-core-autobahn",
|
|
3
|
-
"version": "1.0.
|
|
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
|
-
"main": "index.ts",
|
|
6
|
-
"license": "UNLICENSED",
|
|
7
|
-
"peerDependencies": {
|
|
8
|
-
"react": "^18.0.0",
|
|
9
|
-
"react-dom": "^18.0.0"
|
|
10
|
-
},
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"@bytebrand/car-schema-selectors": "^2.0.7",
|
|
13
|
-
"@bytebrand/fe-financing": "^5.14.31",
|
|
14
|
-
"classnames": "2.2.6",
|
|
15
|
-
"clsx": "^2.1.1",
|
|
16
|
-
"d3-format": "1.4.5",
|
|
17
|
-
"js-cookie": "^2.2.0",
|
|
18
|
-
"lodash": "^4.17.21",
|
|
19
|
-
"lucide-react": "^0.288.0",
|
|
20
|
-
"mobx-react": "^7.6.0",
|
|
21
|
-
"moment": "^2.29.1",
|
|
22
|
-
"qs": "^6.6.0",
|
|
23
|
-
"react-device-detect": "^2.1.2",
|
|
24
|
-
"react-grid-system": "^5.0.2",
|
|
25
|
-
"react-lazyload": "^3.2.0",
|
|
26
|
-
"react-scroll": "^1.9.3",
|
|
27
|
-
"react-slick": "^0.29.0",
|
|
28
|
-
"slick-carousel": "1.8.1"
|
|
29
|
-
}
|
|
30
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@bytebrand/fe-ui-core-autobahn",
|
|
3
|
+
"version": "1.0.219",
|
|
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
|
+
"main": "index.ts",
|
|
6
|
+
"license": "UNLICENSED",
|
|
7
|
+
"peerDependencies": {
|
|
8
|
+
"react": "^18.0.0",
|
|
9
|
+
"react-dom": "^18.0.0"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@bytebrand/car-schema-selectors": "^2.0.7",
|
|
13
|
+
"@bytebrand/fe-financing": "^5.14.31",
|
|
14
|
+
"classnames": "2.2.6",
|
|
15
|
+
"clsx": "^2.1.1",
|
|
16
|
+
"d3-format": "1.4.5",
|
|
17
|
+
"js-cookie": "^2.2.0",
|
|
18
|
+
"lodash": "^4.17.21",
|
|
19
|
+
"lucide-react": "^0.288.0",
|
|
20
|
+
"mobx-react": "^7.6.0",
|
|
21
|
+
"moment": "^2.29.1",
|
|
22
|
+
"qs": "^6.6.0",
|
|
23
|
+
"react-device-detect": "^2.1.2",
|
|
24
|
+
"react-grid-system": "^5.0.2",
|
|
25
|
+
"react-lazyload": "^3.2.0",
|
|
26
|
+
"react-scroll": "^1.9.3",
|
|
27
|
+
"react-slick": "^0.29.0",
|
|
28
|
+
"slick-carousel": "1.8.1"
|
|
29
|
+
}
|
|
30
|
+
}
|