@bytebrand/fe-ui-core-autobahn 1.0.223 → 1.0.224
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 +52 -14
- package/cards/CarRow.tsx +5 -1
- package/cards/cardParts.tsx +12 -2
- package/constants/app.ts +11 -1
- package/constants/core.ts +12 -1
- package/package.json +30 -30
- package/theme/md3.css +6 -3
- package/vdp/VdpModules.tsx +9 -23
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';
|
|
@@ -91,7 +92,7 @@ export interface CarCardProps {
|
|
|
91
92
|
onOpenRateAdjust?: (mode: PaymentMode) => void;
|
|
92
93
|
/**
|
|
93
94
|
* takes over the "Finanzierungsdetails"/"Details" link under the price row — e.g. navigate to
|
|
94
|
-
* this car's own VDP and open its finance modal already expanded
|
|
95
|
+
* this car's own VDP and open its finance modal already expanded (at its top, no auto-scroll),
|
|
95
96
|
* instead of the default plain onOpen(car) navigation. Receives the tab the card was showing
|
|
96
97
|
* (Finanzierung/Leasing/Kaufen) so the destination modal opens on the same one. Optional/
|
|
97
98
|
* page-owned like onOpenRateAdjust; the mobile CTA row's "Rate anpassen" button is untouched
|
|
@@ -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;
|
|
@@ -779,13 +784,18 @@ export const PriceTerms: React.FunctionComponent<{
|
|
|
779
784
|
mode: PaymentMode;
|
|
780
785
|
onOpenRateAdjust?: (mode: PaymentMode) => void;
|
|
781
786
|
/** takes over the "Finanzierungsdetails"/"Details" link's click (e.g. navigate to the VDP and
|
|
782
|
-
* open the finance modal already expanded,
|
|
787
|
+
* open the finance modal already expanded, at its top) — when given, it wins
|
|
783
788
|
* over onOpenRateAdjust for THIS link only; the mobile CTA row's own "Rate anpassen" button
|
|
784
789
|
* keeps using onOpenRateAdjust regardless. */
|
|
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,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.
|
|
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.224",
|
|
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.30",
|
|
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
|
+
}
|
package/theme/md3.css
CHANGED
|
@@ -10124,7 +10124,8 @@ line-height: 31px;
|
|
|
10124
10124
|
z-index: 71;
|
|
10125
10125
|
background: var(--md-surface);
|
|
10126
10126
|
border-radius: var(--md-r-xl) var(--md-r-xl) 0 0;
|
|
10127
|
-
|
|
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%;
|
|
10128
10129
|
display: flex;
|
|
10129
10130
|
flex-direction: column;
|
|
10130
10131
|
box-shadow: 0 -8px 30px rgba(16, 22, 42, 0.22);
|
|
@@ -14112,7 +14113,8 @@ color: #005CFF;
|
|
|
14112
14113
|
flex-direction: column;
|
|
14113
14114
|
width: 100%;
|
|
14114
14115
|
max-width: 560px;
|
|
14115
|
-
|
|
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%;
|
|
14116
14118
|
background: var(--md-sc-lowest, #fff);
|
|
14117
14119
|
color: var(--md-on-surface);
|
|
14118
14120
|
border-radius: var(--md-r-lg);
|
|
@@ -14258,7 +14260,8 @@ color: #005CFF;
|
|
|
14258
14260
|
}
|
|
14259
14261
|
.md3 .mmodal {
|
|
14260
14262
|
max-width: 100%;
|
|
14261
|
-
|
|
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%;
|
|
14262
14265
|
border-radius: var(--md-r-lg) var(--md-r-lg) 0 0;
|
|
14263
14266
|
border-bottom: 0;
|
|
14264
14267
|
animation: mmodal-sheet-up 0.25s ease-out;
|
package/vdp/VdpModules.tsx
CHANGED
|
@@ -1328,15 +1328,11 @@ export interface FinanceDetailsModalProps {
|
|
|
1328
1328
|
/** the price-rating badge + bar were clicked: the page closes the modal and scrolls to its
|
|
1329
1329
|
* "Preis & Marktwert" section (#vdp-preis). Omit and they are not a link. */
|
|
1330
1330
|
onShowPriceRating?: () => void;
|
|
1331
|
-
/** opened directly via the page's Finanzierungs-/Leasingdetails link — the sheet
|
|
1332
|
-
*
|
|
1331
|
+
/** opened directly via the page's Finanzierungs-/Leasingdetails link — on mobile the sheet
|
|
1332
|
+
* opens expanded (full height) instead of sized to the "Rate anpassen" controls. It always
|
|
1333
|
+
* opens at its top: no automatic scroll down to the "Repräsentatives Beispiel" (auto.de
|
|
1334
|
+
* feedback 25.11), neither in the mobile sheet nor in the desktop popup. */
|
|
1333
1335
|
initialShowBreakdown?: boolean;
|
|
1334
|
-
/** skips the smooth scrollIntoView/scrollSheetToBreakdown animation initialShowBreakdown
|
|
1335
|
-
* otherwise triggers on open (still sets showBreakdown itself) — for a consumer whose sheet
|
|
1336
|
-
* has nothing ABOVE the breakdown to scroll past (e.g. checkout's stripped-down instance,
|
|
1337
|
-
* with the rate hero/sliders/toggles above it hidden), that animation has nowhere real to go
|
|
1338
|
-
* and only reads as a stray jump. */
|
|
1339
|
-
skipInitialScroll?: boolean;
|
|
1340
1336
|
/** mobile only — price-rating label, drives the eval pill/bar (same as the collapsed card). */
|
|
1341
1337
|
ratingLabel?: string;
|
|
1342
1338
|
/** Kaufen tab only — real carStore.isAvailable (same source as VdpTrustRow's "Sofort
|
|
@@ -1413,7 +1409,6 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
|
|
|
1413
1409
|
onClose,
|
|
1414
1410
|
onShowPriceRating,
|
|
1415
1411
|
initialShowBreakdown,
|
|
1416
|
-
skipInitialScroll,
|
|
1417
1412
|
ratingLabel,
|
|
1418
1413
|
available,
|
|
1419
1414
|
onModeChange,
|
|
@@ -1438,10 +1433,7 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
|
|
|
1438
1433
|
// anpassen") or expanded (opened directly via the page's details link) — reset on every open,
|
|
1439
1434
|
// since this component stays mounted (the page always renders it, gated by `open`).
|
|
1440
1435
|
const [showBreakdown, setShowBreakdown] = React.useState(!!initialShowBreakdown);
|
|
1441
|
-
//
|
|
1442
|
-
// own scroll area too — whichever of the two refs is actually visible (show-mobile/hide-mobile
|
|
1443
|
-
// via CSS) is the one scrolled to.
|
|
1444
|
-
const desktopBreakdownRef = React.useRef<HTMLDivElement | null>(null);
|
|
1436
|
+
// the mobile sheet's breakdown — the in-sheet details link scrolls to it.
|
|
1445
1437
|
const mobileBreakdownRef = React.useRef<HTMLDivElement | null>(null);
|
|
1446
1438
|
// mobile (ADV-276): the sheet opens sized to its rate controls — its bottom edge sits right
|
|
1447
1439
|
// under the "Finanzierungs-/Leasing-Details" link (the [data-sheet-fold] element; on Kaufen its
|
|
@@ -1528,18 +1520,12 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
|
|
|
1528
1520
|
React.useEffect(() => {
|
|
1529
1521
|
if (!open) setSheetAnimated(false);
|
|
1530
1522
|
}, [open]);
|
|
1531
|
-
// opened directly via the page's details link:
|
|
1523
|
+
// opened directly via the page's details link: the mobile sheet opens expanded, but at its top —
|
|
1524
|
+
// no auto-scroll to the "Repräsentatives Beispiel" (auto.de feedback 25.11).
|
|
1532
1525
|
React.useEffect(() => {
|
|
1533
1526
|
if (!open) return;
|
|
1534
1527
|
setShowBreakdown(!!initialShowBreakdown);
|
|
1535
|
-
|
|
1536
|
-
const timer = window.setTimeout(() => {
|
|
1537
|
-
if (mobileBreakdownRef.current?.offsetParent) scrollSheetToBreakdown();
|
|
1538
|
-
else desktopBreakdownRef.current?.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
1539
|
-
}, 50);
|
|
1540
|
-
return () => window.clearTimeout(timer);
|
|
1541
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1542
|
-
}, [open, initialShowBreakdown, skipInitialScroll]);
|
|
1528
|
+
}, [open, initialShowBreakdown]);
|
|
1543
1529
|
// in-sheet details link: expanding scrolls down to the breakdown, collapsing back to the top.
|
|
1544
1530
|
const revealBreakdownRef = React.useRef(false);
|
|
1545
1531
|
React.useEffect(() => {
|
|
@@ -2099,7 +2085,7 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
|
|
|
2099
2085
|
t={t}
|
|
2100
2086
|
/>
|
|
2101
2087
|
)}
|
|
2102
|
-
<div
|
|
2088
|
+
<div style={!isCash ? { marginTop: 18 } : undefined}>
|
|
2103
2089
|
{!isCash && (
|
|
2104
2090
|
<>
|
|
2105
2091
|
<p
|