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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/campaign/CampaignBand.tsx +26 -26
  2. package/campaign/CampaignBanner.tsx +86 -0
  3. package/campaign/CampaignBar.tsx +37 -0
  4. package/campaign/CampaignHero.tsx +56 -0
  5. package/campaign/CampaignSwitch.tsx +43 -0
  6. package/campaign/campaignVars.ts +12 -12
  7. package/campaign/campaigns.ts +77 -74
  8. package/campaign/index.ts +18 -6
  9. package/campaign/openInApp.ts +8 -0
  10. package/campaign/useCountdown.ts +28 -0
  11. package/cards/CarCard.tsx +407 -393
  12. package/cards/CarCardSkeleton.tsx +103 -0
  13. package/cards/CarRow.tsx +46 -22
  14. package/cards/CarRowSkeleton.tsx +152 -0
  15. package/cards/cardParts.tsx +53 -18
  16. package/cards/dealSignals.ts +36 -36
  17. package/cards/index.ts +6 -0
  18. package/chrome/AccountMenuIcon.tsx +109 -0
  19. package/chrome/Footer.tsx +16 -3
  20. package/chrome/TopBar.tsx +139 -266
  21. package/compat/CookieModal/CookieModal.tsx +20 -6
  22. package/compat/CookieModal/Modal.tsx +6 -3
  23. package/compat/CookieModal/modals/ManageCookieModal/ManageCookieModal.tsx +43 -15
  24. package/compat/CookieModal/modals/PreviewCookieModal/PreviewCookieModal.tsx +4 -3
  25. package/compat/CookieModal/useModal.ts +5 -1
  26. package/compat/Loader/Loader.tsx +1 -7
  27. package/compat/MdField/MdField.tsx +28 -4
  28. package/compat/PriceRating/PriceRating.styl +5 -7
  29. package/compat/PriceRatingDetailed/PriceRatingDetailed.styl +8 -6
  30. package/compat/TimePicker/TimePicker.tsx +12 -2
  31. package/compat/legacy-theme/priceReviewColors.styl +18 -5
  32. package/constants/autobahn.ts +39 -0
  33. package/data/fieldMapping.ts +3 -3
  34. package/data/toAutobahnCar.ts +30 -14
  35. package/iconsvg/IconSVG.tsx +1 -5
  36. package/index.ts +19 -19
  37. package/locales/de/autobahn.json +925 -862
  38. package/locales/en/autobahn.json +925 -862
  39. package/package.json +2 -2
  40. package/theme/md3.css +16518 -11808
  41. package/ui/Dropdown.tsx +29 -10
  42. package/ui/FormCheckbox.tsx +22 -2
  43. package/ui/FormField.tsx +2 -1
  44. package/ui/Icon.tsx +6 -0
  45. package/ui/MfieldCheckIcon.tsx +13 -0
  46. package/ui/Modal.tsx +84 -6
  47. package/ui/Skeleton.tsx +79 -20
  48. package/ui/Stars.tsx +36 -18
  49. package/ui/StatChip.tsx +8 -3
  50. package/ui/index.ts +3 -0
  51. package/ui/ratingLink.ts +36 -0
  52. package/ui/scrollFieldIntoView.ts +41 -0
  53. package/ui/usePortalMenuPosition.ts +27 -15
  54. package/utils/cookieConsent.ts +84 -0
  55. package/utils/index.ts +10 -0
  56. package/vdp/FinanceCalculator.tsx +162 -34
  57. package/vdp/VdpModules.tsx +348 -976
  58. package/vdp/index.ts +6 -3
  59. package/vdp/types.ts +25 -15
  60. package/vehiclesProps/accidentDisclosure.ts +25 -0
  61. package/vehiclesProps/decoratedLightProps.tsx +4 -0
  62. package/vehiclesProps/decoratedProps.tsx +4 -0
@@ -0,0 +1,103 @@
1
+ // Autobahn (auto.de redesign) — CarCard loading placeholder.
2
+ //
3
+ // The shape of a CarCard while its data is on the way: the same card chrome (.mcard
4
+ // .cc-card — border, 18px radius, shadow) and, inside it, the card's own parts as
5
+ // skeleton bars on the line boxes CarCard's CSS gives them, so a grid of these is as
6
+ // tall as the grid of cards that replaces it and nothing below jumps:
7
+ // - photo: 4:3 plus the carousel's 14px (that's how tall .cc-media really renders), on
8
+ // the lighter --md-sc-low so the big area stays calm and the text bars read as content
9
+ // - title 24/27 (+6), trim 13/17 (+6), spec line 11/15 (+10)
10
+ // - price block on its hairline: tabs (39, +12), rate + price rating (58), terms (2 × 17)
11
+ // - phones (≤600, .show-mobile): the CTA row (9 + 40)
12
+ // - eco line (8 + 3 × 11) pinned to the bottom, like the card's
13
+ // Measured against real cards at 1467 / 768 / 390 px (571 / 541 / 593 tall).
14
+ //
15
+ // Decorative only (aria-hidden): the grid that shows these says what is loading.
16
+ // Renders correctly only inside a `<div className="md3">` subtree.
17
+
18
+ import React from 'react';
19
+
20
+ import Skeleton, { injectStyles } from '../ui/Skeleton';
21
+
22
+ export interface CarCardSkeletonProps {
23
+ className?: string;
24
+ style?: React.CSSProperties;
25
+ }
26
+
27
+ const CARD_SKELETON_CSS = `
28
+ .md3 .cc-skel { display: flex; flex-direction: column; pointer-events: none; }
29
+ .md3 .cc-skel .cc-skel-photo { height: 0; padding-bottom: calc(75% + 14px); border-radius: 0; --mskeleton-base: var(--md-sc-low); }
30
+ .md3 .cc-skel .cc-skel-body { flex: 1; display: flex; flex-direction: column; align-items: flex-start; padding: 0 18px 8px; margin-top: -3px; }
31
+ .md3 .cc-skel .cc-skel-title { width: 62%; height: 20px; margin: 4px 0 9px; border-radius: var(--md-r-xs); }
32
+ .md3 .cc-skel .cc-skel-trim { width: 82%; height: 11px; margin: 3px 0 9px; border-radius: var(--md-r-full); }
33
+ .md3 .cc-skel .cc-skel-spec { width: 92%; height: 9px; margin: 3px 0 13px; border-radius: var(--md-r-full); }
34
+ .md3 .cc-skel .cc-skel-price { align-self: stretch; border-top: 1px solid var(--md-outline-variant); }
35
+ .md3 .cc-skel .cc-skel-tabs { display: grid; grid-template-columns: repeat(3, 1fr); align-items: center; justify-items: center; height: 39px; margin-bottom: 12px; }
36
+ .md3 .cc-skel .cc-skel-tabs .mskeleton { width: 56%; height: 12px; border-radius: var(--md-r-full); }
37
+ .md3 .cc-skel .cc-skel-hero { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 58px; }
38
+ .md3 .cc-skel .cc-skel-rate { width: 46%; height: 42px; border-radius: var(--md-r-xs); }
39
+ .md3 .cc-skel .cc-skel-eval { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; width: 112px; flex: none; }
40
+ .md3 .cc-skel .cc-skel-eval .mskeleton:first-child { width: 72px; height: 12px; border-radius: var(--md-r-full); }
41
+ .md3 .cc-skel .cc-skel-eval .mskeleton:last-child { width: 100%; height: 7px; border-radius: var(--md-r-full); }
42
+ .md3 .cc-skel .cc-skel-terms,
43
+ .md3 .cc-skel .cc-skel-eco { display: flex; flex-direction: column; }
44
+ .md3 .cc-skel .cc-skel-terms .mskeleton { width: 94%; height: 9px; margin: 4px 0; border-radius: var(--md-r-full); }
45
+ .md3 .cc-skel .cc-skel-terms .mskeleton:last-child { width: 60%; }
46
+ .md3 .cc-skel .cc-skel-cta { align-self: stretch; gap: 6px; margin-top: 9px; }
47
+ .md3 .cc-skel .cc-skel-cta .mskeleton { flex: 1.3 1 0; height: 40px; border-radius: var(--md-r-full); }
48
+ .md3 .cc-skel .cc-skel-cta .mskeleton:nth-child(2) { flex: none; width: 40px; }
49
+ .md3 .cc-skel .cc-skel-cta .mskeleton:last-child { flex: 1 1 0; }
50
+ .md3 .cc-skel .cc-skel-eco { align-self: stretch; margin-top: auto; padding-top: 8px; }
51
+ .md3 .cc-skel .cc-skel-eco .mskeleton { height: 7px; margin: 2px 0; border-radius: var(--md-r-full); }
52
+ .md3 .cc-skel .cc-skel-eco .mskeleton:last-child { width: 66%; }
53
+ @media (max-width: 1024px) {
54
+ .md3 .cc-skel .cc-skel-tabs { height: 38px; }
55
+ }`;
56
+
57
+ const CARD_SKELETON_STYLE_ID = 'md3-card-skeleton-styles';
58
+
59
+ injectStyles(CARD_SKELETON_STYLE_ID, CARD_SKELETON_CSS);
60
+
61
+ const CarCardSkeleton: React.FunctionComponent<CarCardSkeletonProps> = ({ className, style }) => {
62
+ React.useEffect(() => { injectStyles(CARD_SKELETON_STYLE_ID, CARD_SKELETON_CSS); }, []);
63
+ return (
64
+ <div className={'mcard cc-card cc-skel' + (className ? ` ${className}` : '')} style={style} aria-hidden="true">
65
+ <Skeleton className="cc-skel-photo" />
66
+ <div className="cc-skel-body">
67
+ <Skeleton className="cc-skel-title" />
68
+ <Skeleton className="cc-skel-trim" />
69
+ <Skeleton className="cc-skel-spec" />
70
+ <div className="cc-skel-price">
71
+ <div className="cc-skel-tabs">
72
+ <Skeleton />
73
+ <Skeleton />
74
+ <Skeleton />
75
+ </div>
76
+ <div className="cc-skel-hero">
77
+ <Skeleton className="cc-skel-rate" />
78
+ <div className="cc-skel-eval">
79
+ <Skeleton />
80
+ <Skeleton />
81
+ </div>
82
+ </div>
83
+ <div className="cc-skel-terms">
84
+ <Skeleton />
85
+ <Skeleton />
86
+ </div>
87
+ </div>
88
+ <div className="cc-skel-cta show-mobile">
89
+ <Skeleton />
90
+ <Skeleton />
91
+ <Skeleton />
92
+ </div>
93
+ <div className="cc-skel-eco">
94
+ <Skeleton />
95
+ <Skeleton />
96
+ <Skeleton />
97
+ </div>
98
+ </div>
99
+ </div>
100
+ );
101
+ };
102
+
103
+ export default CarCardSkeleton;
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,
@@ -41,8 +42,13 @@ import {
41
42
  ZeroDownChip,
42
43
  fmtKm,
43
44
  PaymentMode,
45
+ startPaymentMode,
44
46
  ratingTone,
45
47
  } from './cardParts';
48
+ import CampaignBand from '../campaign/CampaignBand';
49
+ import { Campaign, campaignFor } from '../campaign/campaigns';
50
+ import { campaignVars } from '../campaign/campaignVars';
51
+ import { dealSignals } from './dealSignals';
46
52
  import { AutobahnCar } from './types';
47
53
 
48
54
  export interface CarRowProps {
@@ -80,6 +86,12 @@ export interface CarRowProps {
80
86
  * links render as plain text (see PricePaths' own fallback).
81
87
  */
82
88
  onShowFinancingDetails?: (car: AutobahnCar, mode: PaymentMode) => void;
89
+ /** the price-rating chip + bar were clicked — see CarCard's identically-named prop. */
90
+ onShowPriceRating?: (car: AutobahnCar) => void;
91
+ /** Tab the mobile price tabs open on — see CarCard's identically-named prop. */
92
+ initialMode?: PaymentMode;
93
+ /** The running campaign, its band spans the whole row — see CarCard's identically-named prop. */
94
+ campaign?: Campaign | null;
83
95
  }
84
96
 
85
97
  const CarRow: React.FunctionComponent<CarRowProps> = ({
@@ -92,10 +104,24 @@ const CarRow: React.FunctionComponent<CarRowProps> = ({
92
104
  t,
93
105
  adminAction,
94
106
  onShowFinancingDetails,
107
+ onShowPriceRating,
108
+ initialMode,
109
+ campaign,
95
110
  }) => {
96
- const [mode, setMode] = useState<PaymentMode>('financing');
111
+ const [mode, setMode] = useState<PaymentMode>(() => startPaymentMode(car, initialMode));
97
112
  const [photoIndex, setPhotoIndex] = useState(0);
98
113
  const mediaRef = useRef<HTMLDivElement | null>(null);
114
+ // The price-rating chip + bar link to the car's "Preis & Marktwert" section (page-owned
115
+ // onShowPriceRating, ratingLinkProps). Without it they stay plain: a click opens the car, as
116
+ // before. `noTabStop`: clickable, but not a second tab stop next to the chip.
117
+ const ratingLink = (className: string, noTabStop: boolean = false): React.HTMLAttributes<HTMLElement> => {
118
+ if (!onShowPriceRating || !car.rating) return {};
119
+ const props = ratingLinkProps(
120
+ () => onShowPriceRating(car),
121
+ t('autobahn:finance.priceRatingLink', { rating: t('autobahn:tier.' + car.rating) }),
122
+ );
123
+ return noTabStop ? { className, onClick: props.onClick, 'aria-hidden': true } : { className, ...props };
124
+ };
99
125
  // always call the LATEST onMediaEnter without re-arming the observer on every render (the
100
126
  // page callers construct a fresh closure each render) — the effect itself only needs to run
101
127
  // once per mount. Identical pattern to CarCard.tsx — see its own comment for the rationale.
@@ -121,16 +147,8 @@ const CarRow: React.FunctionComponent<CarRowProps> = ({
121
147
  observer.observe(el);
122
148
  return () => observer.disconnect();
123
149
  }, [eagerMedia]);
124
- // as-good-as-new gate (mileage < 1,000 km AND first registration unknown or < 12 months) —
125
- // undefined (older AutobahnCar producer not yet updated) fails OPEN, keeping prior behaviour.
126
- const asGoodAsNew = car.asGoodAsNew !== false;
127
- const showDrop = asGoodAsNew && car.drop != null;
128
- const showSave = asGoodAsNew && !showDrop && car.savings != null && car.savings > 600;
129
- const showPct = asGoodAsNew && car.dropPct != null && car.dropPct > 0;
130
- const showOfferBadge = !!(car.isNew || showDrop || showSave || showPct || car.zeroDown);
131
- // same overflow rule as CarCard: the row only fits 3 pills, so NEU drops when the other 3 are all active.
132
- const activeDealChips = [showDrop || showSave, showPct, !!car.zeroDown].filter(Boolean).length;
133
- const showNeu = asGoodAsNew && car.isNew && activeDealChips < 3;
150
+ const { drop: showDrop, save: showSave, percent: showPct, offer: showOfferBadge, neu: showNeu } = dealSignals(car);
151
+ const activeCampaign = campaignFor(car, campaign);
134
152
  const facts: Array<[icon: string, value: string]> = [
135
153
  ['gauge', fmtKm(car.km)],
136
154
  ['calendar', t('autobahn:card.specs.firstRegistration', { reg: car.reg })],
@@ -145,16 +163,17 @@ const CarRow: React.FunctionComponent<CarRowProps> = ({
145
163
  if (car.availability) facts.push(['circle-check', car.availability]);
146
164
  return (
147
165
  <article
148
- className="mcard mcard--interactive listcard"
166
+ className={'mcard mcard--interactive listcard' + (activeCampaign ? ' mcard--campaign' : '')}
149
167
  onClick={() => onOpen(car)}
150
- style={{ background: 'var(--md-sc-lowest)' }}
168
+ style={activeCampaign ? campaignVars(activeCampaign) : { background: 'var(--md-sc-lowest)' }}
151
169
  >
170
+ {activeCampaign && <CampaignBand campaign={activeCampaign} t={t} />}
152
171
  <div className="listcard-media" ref={mediaRef} style={{ position: 'relative' }} onMouseEnter={onMediaEnter} onTouchStart={onMediaEnter}>
153
172
  {/* 'auto': desktop picks cover/contain per photo (crops only when it wouldn't lose too
154
173
  much of the shot); below 601px this is identical to 'contain', so mobile is unchanged. */}
155
174
  <CardCarousel images={car.gallery} height="100%" fit="auto" onChange={setPhotoIndex} />
156
175
  {/* deal badges — ONE compact line, Figma order: −€ (drop/save) · −% · 0 € Anz. · NEU
157
- (NEU always last, dropped first on overflow — see activeDealChips below), plus the
176
+ (NEU always last, dropped first on overflow — see dealSignals.ts), plus the
158
177
  "⚡ Angebot" badge (Figma) on its own line below. The price RATING ('Guter Preis') is
159
178
  NOT here — it lives in the price column (PriceMeter). */}
160
179
  <div
@@ -275,13 +294,18 @@ const CarRow: React.FunctionComponent<CarRowProps> = ({
275
294
  <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 8 }}>
276
295
  <PriceHero car={car} mode={mode} t={t} alwaysShowUnit />
277
296
  {car.rating && (
278
- <StatChip tone={ratingTone(car.rating)} icon={ratingTone(car.rating) === 'good' ? 'check' : 'minus'}>
279
- {t('autobahn:tier.' + car.rating)}
280
- {ratingTone(car.rating) === 'good' && <sup>4</sup>}
281
- </StatChip>
297
+ <span {...ratingLink('rating-link')}>
298
+ <StatChip rating={car.rating} icon={ratingTone(car.rating) === 'good' ? 'check' : 'minus'}>
299
+ {t('autobahn:tier.' + car.rating)}
300
+ <sup>4</sup>
301
+ </StatChip>
302
+ </span>
282
303
  )}
283
304
  </div>
284
- <PriceMeter t={t} car={car} />
305
+ {/* the bar is clickable too, but not a second tab stop (the chip above is the link) */}
306
+ <div {...ratingLink('rating-link', true)}>
307
+ <PriceMeter t={t} car={car} />
308
+ </div>
285
309
  <div className="pp-cta">
286
310
  <Button
287
311
  variant="filled"
@@ -320,11 +344,11 @@ const CarRow: React.FunctionComponent<CarRowProps> = ({
320
344
  />
321
345
  <div className="pp-purchase hide-mobile">
322
346
  <PriceKauf car={car} t={t} />
323
- <div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
347
+ <div style={{ display: 'flex', alignItems: 'center', gap: 10 }} {...ratingLink('rating-link')}>
324
348
  {car.rating && (
325
- <StatChip tone={ratingTone(car.rating)} icon={ratingTone(car.rating) === 'good' ? 'check' : 'minus'}>
349
+ <StatChip rating={car.rating} icon={ratingTone(car.rating) === 'good' ? 'check' : 'minus'}>
326
350
  {t('autobahn:tier.' + car.rating)}
327
- {ratingTone(car.rating) === 'good' && <sup>4</sup>}
351
+ <sup>4</sup>
328
352
  </StatChip>
329
353
  )}
330
354
  <div style={{ flex: 1 }}>
@@ -0,0 +1,152 @@
1
+ // Autobahn (auto.de redesign) — CarRow (SRP list row) loading placeholder.
2
+ //
3
+ // Built on CarRow's own classes (.mcard .listcard / .listcard-info / .specstrip /
4
+ // .listcard-price), so the 320 | 1fr | 240 grid, the column paddings and gaps, the grey
5
+ // price column and the tablet re-flow (≤980: photo + info, price full width below) all
6
+ // come from the same CSS as the real row. Inside, the row's parts as skeleton bars on their
7
+ // line boxes (measured against real rows at 1467 px, 299 / 348 tall):
8
+ // - info: title 22 + trim 18 · spec panel (2 × 3 facts, 85) · feature chips (2 rows, 54)
9
+ // · eco line (3 × 14) at the bottom
10
+ // - price: "Finanzierung ab" + rate + terms (87) · Leasing (66, optional) · Kaufen,
11
+ // rating + meter, CTA (129) at the bottom
12
+ // `withLeasing` toggles the Leasing block, the one thing that changes a real row's height
13
+ // (348 with it, 299 without), so a list can mix both like real results do.
14
+ //
15
+ // Bars on the grey panels (spec strip, price column) use a darker base so they read on
16
+ // --md-sc-low. Decorative only (aria-hidden): the list showing these says what is loading.
17
+ // Renders correctly only inside a `<div className="md3">` subtree.
18
+
19
+ import React from 'react';
20
+
21
+ import Skeleton, { injectStyles } from '../ui/Skeleton';
22
+
23
+ export interface CarRowSkeletonProps {
24
+ /** show the Leasing block in the price column (a real row has it when the car can be leased). */
25
+ withLeasing?: boolean;
26
+ className?: string;
27
+ style?: React.CSSProperties;
28
+ }
29
+
30
+ const ROW_SKELETON_CSS = `
31
+ .md3 .lc-skel { pointer-events: none; background: var(--md-sc-lowest); }
32
+ .md3 .lc-skel .lc-skel-photo { position: absolute; inset: 0; border-radius: 0; --mskeleton-base: var(--md-sc-low); }
33
+ .md3 .lc-skel .specstrip .mskeleton,
34
+ .md3 .lc-skel .listcard-price .mskeleton { --mskeleton-base: var(--md-sc-highest); }
35
+ .md3 .lc-skel .lc-skel-head { display: flex; flex-direction: column; }
36
+ .md3 .lc-skel .lc-skel-title { width: 44%; height: 16px; margin: 3px 0; border-radius: var(--md-r-xs); }
37
+ .md3 .lc-skel .lc-skel-trim { width: 68%; height: 10px; margin: 4px 0; border-radius: var(--md-r-full); }
38
+ .md3 .lc-skel .lc-skel-fact { display: flex; align-items: center; gap: 7px; height: 15px; }
39
+ .md3 .lc-skel .lc-skel-fact .mskeleton:first-child { flex: none; width: 15px; height: 15px; border-radius: 50%; }
40
+ .md3 .lc-skel .lc-skel-fact .mskeleton:last-child { width: 62%; height: 8px; border-radius: var(--md-r-full); }
41
+ .md3 .lc-skel .lc-skel-fact:nth-child(3n + 2) .mskeleton:last-child { width: 48%; }
42
+ .md3 .lc-skel .lc-skel-chips { display: flex; flex-wrap: wrap; gap: 6px; }
43
+ .md3 .lc-skel .lc-skel-chips .mskeleton { height: 24px; border-radius: 8px; }
44
+ .md3 .lc-skel .lc-skel-chips .mskeleton:nth-child(1) { width: 118px; }
45
+ .md3 .lc-skel .lc-skel-chips .mskeleton:nth-child(2) { width: 112px; }
46
+ .md3 .lc-skel .lc-skel-chips .mskeleton:nth-child(3) { width: 80px; }
47
+ .md3 .lc-skel .lc-skel-chips .mskeleton:nth-child(4) { width: 86px; }
48
+ .md3 .lc-skel .lc-skel-spacer { flex: 1; }
49
+ .md3 .lc-skel .lc-skel-eco { display: flex; flex-direction: column; }
50
+ .md3 .lc-skel .lc-skel-eco .mskeleton { height: 7px; margin: 4px 0 3px; border-radius: var(--md-r-full); }
51
+ .md3 .lc-skel .lc-skel-eco .mskeleton:last-child { width: 55%; }
52
+ .md3 .lc-skel .lc-skel-paths { display: flex; flex-direction: column; align-items: flex-start; }
53
+ .md3 .lc-skel .lc-skel-eyebrow { width: 96px; height: 9px; margin: 2px 0; border-radius: var(--md-r-full); }
54
+ .md3 .lc-skel .lc-skel-rate { display: flex; align-items: center; gap: 8px; height: 49px; margin-top: 4px; }
55
+ .md3 .lc-skel .lc-skel-rate .mskeleton:first-child { width: 120px; height: 38px; border-radius: var(--md-r-xs); }
56
+ .md3 .lc-skel .lc-skel-rate .mskeleton:last-child { width: 28px; height: 9px; border-radius: var(--md-r-full); }
57
+ .md3 .lc-skel .lc-skel-terms { width: 170px; max-width: 100%; height: 8px; margin: 11px 0 2px; border-radius: var(--md-r-full); }
58
+ .md3 .lc-skel .lc-skel-lease,
59
+ .md3 .lc-skel .lc-skel-buy { display: flex; flex-direction: column; border-top: 1px solid var(--md-outline-variant); }
60
+ .md3 .lc-skel .lc-skel-lease { padding-top: 14px; }
61
+ .md3 .lc-skel .lc-skel-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 21px; }
62
+ .md3 .lc-skel .lc-skel-line .mskeleton:first-child { width: 56px; height: 9px; border-radius: var(--md-r-full); }
63
+ .md3 .lc-skel .lc-skel-line .mskeleton:last-child { width: 72px; height: 15px; border-radius: var(--md-r-xs); }
64
+ .md3 .lc-skel .lc-skel-lease-terms { display: flex; flex-direction: column; margin-top: 6px; }
65
+ .md3 .lc-skel .lc-skel-lease-terms .mskeleton { height: 7px; margin: 2px 0 3px; border-radius: var(--md-r-full); }
66
+ .md3 .lc-skel .lc-skel-lease-terms .mskeleton:last-child { width: 62%; }
67
+ .md3 .lc-skel .lc-skel-buy { margin-top: auto; padding-top: 9px; }
68
+ .md3 .lc-skel .lc-skel-buy .lc-skel-line { height: 22px; }
69
+ .md3 .lc-skel .lc-skel-eval { display: flex; align-items: center; gap: 10px; height: 24px; margin-top: 15px; }
70
+ .md3 .lc-skel .lc-skel-eval .mskeleton:first-child { flex: none; width: 84px; height: 24px; border-radius: 12px; }
71
+ .md3 .lc-skel .lc-skel-eval .mskeleton:last-child { flex: 1; height: 8px; border-radius: var(--md-r-full); }
72
+ .md3 .lc-skel .lc-skel-cta { height: 40px; margin-top: 18px; border-radius: var(--md-r-full); }`;
73
+
74
+ const ROW_SKELETON_STYLE_ID = 'md3-row-skeleton-styles';
75
+
76
+ injectStyles(ROW_SKELETON_STYLE_ID, ROW_SKELETON_CSS);
77
+
78
+ const FACTS = [0, 1, 2, 3, 4, 5];
79
+
80
+ const CarRowSkeleton: React.FunctionComponent<CarRowSkeletonProps> = ({ withLeasing = true, className, style }) => {
81
+ React.useEffect(() => { injectStyles(ROW_SKELETON_STYLE_ID, ROW_SKELETON_CSS); }, []);
82
+ return (
83
+ <div className={'mcard listcard lc-skel' + (className ? ` ${className}` : '')} style={style} aria-hidden="true">
84
+ <div className="listcard-media">
85
+ <Skeleton className="lc-skel-photo" />
86
+ </div>
87
+
88
+ <div className="listcard-info">
89
+ <div className="lc-skel-head">
90
+ <Skeleton className="lc-skel-title" />
91
+ <Skeleton className="lc-skel-trim" />
92
+ </div>
93
+ <div className="specstrip">
94
+ {FACTS.map((fact) => (
95
+ <div key={fact} className="lc-skel-fact">
96
+ <Skeleton />
97
+ <Skeleton />
98
+ </div>
99
+ ))}
100
+ </div>
101
+ <div className="lc-skel-chips">
102
+ <Skeleton />
103
+ <Skeleton />
104
+ <Skeleton />
105
+ <Skeleton />
106
+ </div>
107
+ <div className="lc-skel-spacer" />
108
+ <div className="lc-skel-eco">
109
+ <Skeleton />
110
+ <Skeleton />
111
+ <Skeleton />
112
+ </div>
113
+ </div>
114
+
115
+ <div className="listcard-price">
116
+ <div className="lc-skel-paths">
117
+ <Skeleton className="lc-skel-eyebrow" />
118
+ <div className="lc-skel-rate">
119
+ <Skeleton />
120
+ <Skeleton />
121
+ </div>
122
+ <Skeleton className="lc-skel-terms" />
123
+ </div>
124
+ {withLeasing && (
125
+ <div className="lc-skel-lease">
126
+ <div className="lc-skel-line">
127
+ <Skeleton />
128
+ <Skeleton />
129
+ </div>
130
+ <div className="lc-skel-lease-terms">
131
+ <Skeleton />
132
+ <Skeleton />
133
+ </div>
134
+ </div>
135
+ )}
136
+ <div className="lc-skel-buy">
137
+ <div className="lc-skel-line">
138
+ <Skeleton />
139
+ <Skeleton />
140
+ </div>
141
+ <div className="lc-skel-eval">
142
+ <Skeleton />
143
+ <Skeleton />
144
+ </div>
145
+ <Skeleton className="lc-skel-cta" />
146
+ </div>
147
+ </div>
148
+ </div>
149
+ );
150
+ };
151
+
152
+ export default CarRowSkeleton;
@@ -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 { CO2_CLASSES, CO2_COLORS, TIER_KEYS, TIER_COLORS } from '../constants';
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={`fin-eval-thumb${TIER_KEYS[tierIndex] === 'good' ? ' fin-eval-thumb--good' : ''}`}
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 }> = ({ car, t }) => {
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
- // 'good' collapses onto the 'top' tier's own color too (#168a45), matching the fixed
501
- // "Top-Preis" text above rather than tier 1's lighter TIER_COLORS[1] green.
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 className="fin-eval-col">
535
+ <div {...linkProps(tierLabel)}>
505
536
  <div className="fin-eval-pill-cell">
506
- <span
507
- className={`fin-eval-pill${isGood ? ' fin-eval-pill--good' : ''}`}
508
- style={{ color: pillColor, background: `color-mix(in srgb, ${pillColor} 16%, transparent)` }}
509
- aria-label={t('autobahn:finance.priceRatingAria', { rating: tierLabel })}
510
- >
511
- {tierLabel}
512
- {isGood && <sup>4</sup>}
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} />
@@ -521,6 +551,11 @@ export const PriceEvalCol: React.FunctionComponent<{ car: AutobahnCar; t: Transl
521
551
 
522
552
  export type PaymentMode = 'financing' | 'leasing' | 'buy';
523
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
+
524
559
  export interface PriceTabsProps {
525
560
  car: AutobahnCar;
526
561
  mode: PaymentMode;
@@ -749,7 +784,7 @@ export const PriceTerms: React.FunctionComponent<{
749
784
  mode: PaymentMode;
750
785
  onOpenRateAdjust?: (mode: PaymentMode) => void;
751
786
  /** takes over the "Finanzierungsdetails"/"Details" link's click (e.g. navigate to the VDP and
752
- * open the finance modal already expanded, scrolled to the breakdown) — when given, it wins
787
+ * open the finance modal already expanded, at its top) — when given, it wins
753
788
  * over onOpenRateAdjust for THIS link only; the mobile CTA row's own "Rate anpassen" button
754
789
  * keeps using onOpenRateAdjust regardless. */
755
790
  onShowDetails?: () => void;
@@ -1,36 +1,36 @@
1
- // Autobahn (auto.de redesign) — which deal signals a card shows for a car.
2
- //
3
- // One rule for CarCard, CarRow, the vehicle page's gallery and the campaigns (campaign/campaigns.ts), so "this card shows the green −X € and the
4
- // red −X % chip" means the same everywhere.
5
-
6
- import { AutobahnCar } from './types';
7
-
8
- export type DealSource = Pick<AutobahnCar, 'asGoodAsNew' | 'drop' | 'dropPct' | 'savings' | 'isNew' | 'zeroDown'>;
9
-
10
- export interface DealSignals {
11
- /** DropChip, "−X € zum UVP". */
12
- drop: boolean;
13
- /** SaveChip (only without a drop). */
14
- save: boolean;
15
- /** PercentChip, "−X %". */
16
- percent: boolean;
17
- /** OfferBadge, "Angebot". */
18
- offer: boolean;
19
- /** NEU badge. */
20
- neu: boolean;
21
- }
22
-
23
- export const dealSignals = (car: DealSource): DealSignals => {
24
- // as-good-as-new gate (mileage < 1,000 km AND first registration unknown or < 12 months) —
25
- // undefined (older AutobahnCar producer not yet updated) fails OPEN, keeping prior behaviour.
26
- const asGoodAsNew = car.asGoodAsNew !== false;
27
- const drop = asGoodAsNew && car.drop != null;
28
- const save = asGoodAsNew && !drop && car.savings != null && car.savings > 600;
29
- const percent = asGoodAsNew && car.dropPct != null && car.dropPct > 0;
30
- const offer = !!(car.isNew || drop || save || percent || car.zeroDown);
31
- // PM call: the badge row only fits 3 pills — when Drop/Save + Percent + ZeroDown are all
32
- // active that's already 3, so NEU is dropped rather than causing a 4th to overflow.
33
- const activeChips = [drop || save, percent, !!car.zeroDown].filter(Boolean).length;
34
- const neu = asGoodAsNew && !!car.isNew && activeChips < 3;
35
- return { drop, save, percent, offer, neu };
36
- };
1
+ // Autobahn (auto.de redesign) — which deal signals a card shows for a car.
2
+ //
3
+ // One rule for CarCard, CarRow, the vehicle page's gallery and the campaigns (campaign/campaigns.ts), so "this card shows the green −X € and the
4
+ // red −X % chip" means the same everywhere.
5
+
6
+ import { AutobahnCar } from './types';
7
+
8
+ export type DealSource = Pick<AutobahnCar, 'asGoodAsNew' | 'drop' | 'dropPct' | 'savings' | 'isNew' | 'zeroDown'>;
9
+
10
+ export interface DealSignals {
11
+ /** DropChip, "−X € zum UVP". */
12
+ drop: boolean;
13
+ /** SaveChip (only without a drop). */
14
+ save: boolean;
15
+ /** PercentChip, "−X %". */
16
+ percent: boolean;
17
+ /** OfferBadge, "Angebot". */
18
+ offer: boolean;
19
+ /** NEU badge. */
20
+ neu: boolean;
21
+ }
22
+
23
+ export const dealSignals = (car: DealSource): DealSignals => {
24
+ // as-good-as-new gate (mileage < 1,000 km AND first registration unknown or < 12 months) —
25
+ // undefined (older AutobahnCar producer not yet updated) fails OPEN, keeping prior behaviour.
26
+ const asGoodAsNew = car.asGoodAsNew !== false;
27
+ const drop = asGoodAsNew && car.drop != null;
28
+ const save = asGoodAsNew && !drop && car.savings != null && car.savings > 600;
29
+ const percent = asGoodAsNew && car.dropPct != null && car.dropPct > 0;
30
+ const offer = !!(car.isNew || drop || save || percent || car.zeroDown);
31
+ // PM call: the badge row only fits 3 pills — when Drop/Save + Percent + ZeroDown are all
32
+ // active that's already 3, so NEU is dropped rather than causing a 4th to overflow.
33
+ const activeChips = [drop || save, percent, !!car.zeroDown].filter(Boolean).length;
34
+ const neu = asGoodAsNew && !!car.isNew && activeChips < 3;
35
+ return { drop, save, percent, offer, neu };
36
+ };
package/cards/index.ts CHANGED
@@ -11,6 +11,12 @@ export type { CarCardProps } from './CarCard';
11
11
  export { default as CarRow } from './CarRow';
12
12
  export type { CarRowProps } from './CarRow';
13
13
 
14
+ export { default as CarCardSkeleton } from './CarCardSkeleton';
15
+ export type { CarCardSkeletonProps } from './CarCardSkeleton';
16
+
17
+ export { default as CarRowSkeleton } from './CarRowSkeleton';
18
+ export type { CarRowSkeletonProps } from './CarRowSkeleton';
19
+
14
20
  export {
15
21
  fmtKm,
16
22
  cardSpec,