@bytebrand/fe-ui-core-autobahn 1.0.167 → 1.0.169
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 +10 -47
- package/cards/CarRow.tsx +1 -5
- package/cards/cardParts.tsx +1 -11
- package/chrome/AccountMenuIcon.tsx +91 -0
- package/chrome/TopBar.tsx +104 -266
- package/constants/app.ts +1 -11
- package/constants/core.ts +1 -12
- package/locales/de/autobahn.json +12 -5
- package/locales/en/autobahn.json +12 -5
- package/locales/legacy/data.ts +1 -2
- package/package.json +30 -30
- package/theme/md3.css +124 -27
- package/ui/Dropdown.tsx +8 -16
- package/ui/index.ts +0 -2
- package/ui/usePortalMenuPosition.ts +12 -14
- package/utils/index.ts +0 -2
- package/vdp/VdpModules.tsx +3 -3
- package/vdp/types.ts +5 -5
- package/vehiclesProps/decoratedLightProps.tsx +6 -20
- package/vehiclesProps/decoratedProps.tsx +4 -12
- package/ui/scrollFieldIntoView.ts +0 -41
- package/vehiclesProps/accidentDisclosure.ts +0 -25
package/theme/md3.css
CHANGED
|
@@ -10100,8 +10100,7 @@ line-height: 31px;
|
|
|
10100
10100
|
z-index: 71;
|
|
10101
10101
|
background: var(--md-surface);
|
|
10102
10102
|
border-radius: var(--md-r-xl) var(--md-r-xl) 0 0;
|
|
10103
|
-
|
|
10104
|
-
max-height: 92%;
|
|
10103
|
+
max-height: 92vh;
|
|
10105
10104
|
display: flex;
|
|
10106
10105
|
flex-direction: column;
|
|
10107
10106
|
box-shadow: 0 -8px 30px rgba(16, 22, 42, 0.22);
|
|
@@ -10355,33 +10354,133 @@ line-height: 31px;
|
|
|
10355
10354
|
}
|
|
10356
10355
|
}
|
|
10357
10356
|
|
|
10358
|
-
/*
|
|
10359
|
-
|
|
10360
|
-
|
|
10361
|
-
.md3 .
|
|
10362
|
-
/* NOT full-width — measured against the real Figma export: the panel is anchored to the
|
|
10363
|
-
RIGHT edge, leaving ~22% of the viewport showing the dimmed page on the left (both the
|
|
10364
|
-
logged-out and logged-in mockups measured close to this, not identical px-for-px, so this
|
|
10365
|
-
is the representative middle value rather than either exact reading). */
|
|
10357
|
+
/* Konto menu (TopBar) — Figma "Konto / Kontomenü" (64243:14111): the same 312px dropdown at every
|
|
10358
|
+
width. Figma's strokes are inside and take no layout room (473px tall), so the outer line is an
|
|
10359
|
+
overlay and the head/group lines are inset shadows — a border would add a px per line. */
|
|
10360
|
+
.md3 .acct-menu {
|
|
10366
10361
|
position: absolute;
|
|
10367
|
-
top: 100
|
|
10368
|
-
left: 22%;
|
|
10362
|
+
top: calc(100% + 8px);
|
|
10369
10363
|
right: 0;
|
|
10370
|
-
background: var(--md-surface);
|
|
10371
|
-
box-shadow: var(--md-elev-2);
|
|
10372
10364
|
z-index: 60;
|
|
10373
|
-
|
|
10365
|
+
width: 312px;
|
|
10366
|
+
max-width: calc(100vw - 24px);
|
|
10367
|
+
background: #fff;
|
|
10368
|
+
border-radius: 16px;
|
|
10369
|
+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
|
|
10370
|
+
overflow: hidden;
|
|
10371
|
+
font-family: 'Arimo';
|
|
10372
|
+
color: #0e2238;
|
|
10373
|
+
text-align: left;
|
|
10374
|
+
}
|
|
10375
|
+
.md3 .acct-menu::after {
|
|
10376
|
+
content: '';
|
|
10377
|
+
position: absolute;
|
|
10378
|
+
inset: 0;
|
|
10379
|
+
border: 1px solid #c5c6d2;
|
|
10380
|
+
border-radius: inherit;
|
|
10381
|
+
pointer-events: none;
|
|
10382
|
+
}
|
|
10383
|
+
/* short phones: the menu sits in the sticky header, so scroll inside it instead of past the screen
|
|
10384
|
+
(it starts ~64px down; dvh = the space left by the browser bars) */
|
|
10385
|
+
.md3 .acct-scroll {
|
|
10386
|
+
max-height: calc(100vh - 72px);
|
|
10387
|
+
max-height: calc(100dvh - 72px);
|
|
10374
10388
|
overflow-y: auto;
|
|
10375
|
-
/* only the LEFT corners are visually rounded (top-left, bottom-left) — the right edge sits
|
|
10376
|
-
flush against the viewport's own right edge, so rounding there would be invisible anyway.
|
|
10377
|
-
(This element is already show-mobile-gated, so no extra media query needed here.) */
|
|
10378
|
-
border-radius: 20px 0 0 20px;
|
|
10379
10389
|
}
|
|
10380
|
-
.md3 .
|
|
10381
|
-
|
|
10390
|
+
.md3 .acct-head {
|
|
10391
|
+
display: flex;
|
|
10392
|
+
justify-content: center;
|
|
10393
|
+
padding: 18px 16px;
|
|
10394
|
+
box-shadow: inset 0 -1px 0 #c5c6d2;
|
|
10395
|
+
}
|
|
10396
|
+
.md3 .acct-name {
|
|
10397
|
+
font-size: 16px;
|
|
10398
|
+
font-weight: 700;
|
|
10399
|
+
line-height: 21px;
|
|
10400
|
+
white-space: nowrap;
|
|
10401
|
+
overflow: hidden;
|
|
10402
|
+
text-overflow: ellipsis;
|
|
10403
|
+
}
|
|
10404
|
+
.md3 .acct-list {
|
|
10405
|
+
display: flex;
|
|
10406
|
+
flex-direction: column;
|
|
10407
|
+
padding: 6px 0;
|
|
10408
|
+
}
|
|
10409
|
+
.md3 .acct-list + .acct-list {
|
|
10410
|
+
box-shadow: inset 0 1px 0 #c5c6d2;
|
|
10411
|
+
}
|
|
10412
|
+
.md3 .acct-row {
|
|
10413
|
+
display: flex;
|
|
10414
|
+
align-items: center;
|
|
10415
|
+
gap: 14px;
|
|
10416
|
+
width: 100%;
|
|
10417
|
+
height: 46px;
|
|
10418
|
+
padding: 13px 18px;
|
|
10419
|
+
border: 0;
|
|
10420
|
+
background: transparent;
|
|
10421
|
+
color: inherit;
|
|
10422
|
+
font: inherit;
|
|
10423
|
+
text-align: left;
|
|
10424
|
+
cursor: pointer;
|
|
10425
|
+
}
|
|
10426
|
+
.md3 .acct-row:hover {
|
|
10427
|
+
background: color-mix(in srgb, #0e2238 5%, transparent);
|
|
10428
|
+
}
|
|
10429
|
+
.md3 .acct-icon {
|
|
10430
|
+
flex: none;
|
|
10431
|
+
width: 22px;
|
|
10432
|
+
height: 22px;
|
|
10433
|
+
color: #5b6b7f;
|
|
10434
|
+
}
|
|
10435
|
+
.md3 .acct-label {
|
|
10436
|
+
flex: 1 0 0;
|
|
10437
|
+
min-width: 1px;
|
|
10438
|
+
font-size: 15px;
|
|
10439
|
+
font-weight: 400;
|
|
10440
|
+
line-height: 20px;
|
|
10441
|
+
}
|
|
10442
|
+
.md3 .acct-badge {
|
|
10443
|
+
flex: none;
|
|
10444
|
+
display: flex;
|
|
10445
|
+
align-items: center;
|
|
10446
|
+
justify-content: center;
|
|
10447
|
+
height: 22px;
|
|
10448
|
+
padding: 0 8px;
|
|
10449
|
+
border-radius: 999px;
|
|
10450
|
+
background: #005cff;
|
|
10451
|
+
color: #fff;
|
|
10452
|
+
font-size: 12.5px;
|
|
10453
|
+
font-weight: 700;
|
|
10454
|
+
line-height: 16px;
|
|
10455
|
+
}
|
|
10456
|
+
/* rows Figma doesn't draw: language (phones), dealer list, guest sign-in */
|
|
10457
|
+
.md3 .acct-flag {
|
|
10458
|
+
flex: none;
|
|
10459
|
+
display: flex;
|
|
10460
|
+
align-items: center;
|
|
10461
|
+
justify-content: center;
|
|
10462
|
+
width: 22px;
|
|
10463
|
+
}
|
|
10464
|
+
.md3 .acct-check {
|
|
10465
|
+
flex: none;
|
|
10466
|
+
display: flex;
|
|
10467
|
+
align-items: center;
|
|
10468
|
+
justify-content: center;
|
|
10469
|
+
width: 20px;
|
|
10470
|
+
height: 20px;
|
|
10471
|
+
border-radius: 50%;
|
|
10472
|
+
background: #005cff;
|
|
10473
|
+
}
|
|
10474
|
+
.md3 .acct-sub {
|
|
10475
|
+
padding: 8px 18px 4px;
|
|
10476
|
+
font-size: 12.5px;
|
|
10477
|
+
line-height: 16px;
|
|
10478
|
+
color: #5b6b7f;
|
|
10479
|
+
}
|
|
10480
|
+
.md3 .acct-cta {
|
|
10481
|
+
padding: 6px 18px 4px;
|
|
10382
10482
|
}
|
|
10383
|
-
/* desktop "Konto" pill collapses to a plain icon-only button on mobile
|
|
10384
|
-
replaces the small popover the pill normally opens on wider screens. */
|
|
10483
|
+
/* desktop "Konto" pill collapses to a plain icon-only button on mobile; it opens the same menu. */
|
|
10385
10484
|
@media (max-width: 600px) {
|
|
10386
10485
|
/* "Header-System" spec dimensions (390px reference) — all scoped to the TopBar's own <header>
|
|
10387
10486
|
(or a dedicated class) so none of this touches .icon-btn/.mbtn/.container usage elsewhere in
|
|
@@ -14152,8 +14251,7 @@ color: #005CFF;
|
|
|
14152
14251
|
flex-direction: column;
|
|
14153
14252
|
width: 100%;
|
|
14154
14253
|
max-width: 560px;
|
|
14155
|
-
|
|
14156
|
-
max-height: 100%;
|
|
14254
|
+
max-height: calc(100vh - 32px);
|
|
14157
14255
|
background: var(--md-sc-lowest, #fff);
|
|
14158
14256
|
color: var(--md-on-surface);
|
|
14159
14257
|
border-radius: var(--md-r-lg);
|
|
@@ -14299,8 +14397,7 @@ color: #005CFF;
|
|
|
14299
14397
|
}
|
|
14300
14398
|
.md3 .mmodal {
|
|
14301
14399
|
max-width: 100%;
|
|
14302
|
-
|
|
14303
|
-
max-height: 92%;
|
|
14400
|
+
max-height: 92vh;
|
|
14304
14401
|
border-radius: var(--md-r-lg) var(--md-r-lg) 0 0;
|
|
14305
14402
|
border-bottom: 0;
|
|
14306
14403
|
animation: mmodal-sheet-up 0.25s ease-out;
|
package/ui/Dropdown.tsx
CHANGED
|
@@ -22,7 +22,6 @@ import * as ReactDOM from 'react-dom';
|
|
|
22
22
|
|
|
23
23
|
import Icon from './Icon';
|
|
24
24
|
import { usePortalMenuPosition } from './usePortalMenuPosition';
|
|
25
|
-
import { scrollFieldIntoView } from './scrollFieldIntoView';
|
|
26
25
|
|
|
27
26
|
export interface DropdownOption {
|
|
28
27
|
value: string;
|
|
@@ -190,22 +189,15 @@ const Dropdown: React.FunctionComponent<DropdownProps> = ({
|
|
|
190
189
|
if (allowCustomValue) setQuery(value || '');
|
|
191
190
|
}, [disabled, selectedIndex, allowCustomValue, value]);
|
|
192
191
|
|
|
193
|
-
//
|
|
194
|
-
//
|
|
195
|
-
//
|
|
196
|
-
//
|
|
197
|
-
// problem a searchable trigger has with the keyboard eating the space below it. A plain
|
|
198
|
-
// `scrollIntoView({block:'center'})` used to run here (searchable-only) — "center" only moves
|
|
199
|
-
// the trigger when it's already near a viewport edge, so on a trigger that's roughly mid-page
|
|
200
|
-
// already (the common case) it was a near no-op, leaving a few hundred px of dead space above
|
|
201
|
-
// the trigger that the keyboard (searchable) or the menu's own bottom edge (any dropdown) then
|
|
202
|
-
// ran into.
|
|
192
|
+
// when opened searchable, focus the search input instead of leaving focus on the trigger.
|
|
193
|
+
// scrollIntoView first: on mobile the keyboard is about to eat ~40% of the viewport, so the
|
|
194
|
+
// trigger (and the popover below it) needs to already be scrolled above the fold before focus
|
|
195
|
+
// fires, or the popover can end up hidden behind the keyboard with no way to see it open.
|
|
203
196
|
React.useEffect(() => {
|
|
204
|
-
if (!open) return;
|
|
205
|
-
if (rootRef.current
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
// <button> already has focus from the click/keypress that opened it.
|
|
197
|
+
if (!open || !searchable) return;
|
|
198
|
+
if (rootRef.current && rootRef.current.scrollIntoView) {
|
|
199
|
+
rootRef.current.scrollIntoView({ block: 'center', behavior: 'smooth' });
|
|
200
|
+
}
|
|
209
201
|
if (searchRef.current) {
|
|
210
202
|
searchRef.current.focus();
|
|
211
203
|
// pre-filled custom value (see openMenu) starts selected, so typing immediately
|
package/ui/index.ts
CHANGED
|
@@ -39,8 +39,6 @@ export type { FormFieldProps } from './FormField';
|
|
|
39
39
|
export { default as Dropdown } from './Dropdown';
|
|
40
40
|
export type { DropdownProps, DropdownOption } from './Dropdown';
|
|
41
41
|
|
|
42
|
-
export { scrollFieldIntoView } from './scrollFieldIntoView';
|
|
43
|
-
|
|
44
42
|
export { default as Spec } from './Spec';
|
|
45
43
|
export type { SpecProps } from './Spec';
|
|
46
44
|
|
|
@@ -79,20 +79,6 @@ const ESTIMATED_MENU_HEIGHT = 300;
|
|
|
79
79
|
// a scroll within this window of opening REPOSITIONS instead of closing — see the effect below.
|
|
80
80
|
const SELF_SCROLL_GRACE_MS = 500;
|
|
81
81
|
|
|
82
|
-
// Module-level (not hook-local) so Dropdown.tsx's own searchable-open scroll effect can reuse the
|
|
83
|
-
// exact same measurement — the sticky app header (.topbar, position:sticky/top:0) sits over the
|
|
84
|
-
// top of the viewport on every page that uses it (TopBar's autoHideOnScroll is opt-in, off by
|
|
85
|
-
// default — most pages keep it permanently docked), so anything that scrolls/positions content
|
|
86
|
-
// near the top of the viewport needs to stop at its live bottom edge, not y=0. Reading the
|
|
87
|
-
// header's live bottom edge (0 when absent, e.g. inside a modal, or when autoHideOnScroll has slid
|
|
88
|
-
// it away) gives a correct boundary without hardcoding a pixel height that could drift from the
|
|
89
|
-
// header's own CSS.
|
|
90
|
-
export const getSafeTop = (): number => {
|
|
91
|
-
if (typeof document === 'undefined') return 0;
|
|
92
|
-
const header = document.querySelector('.topbar');
|
|
93
|
-
return header ? Math.max(0, header.getBoundingClientRect().bottom) : 0;
|
|
94
|
-
};
|
|
95
|
-
|
|
96
82
|
export function usePortalMenuPosition<TMenuEl extends HTMLElement = HTMLDivElement>({
|
|
97
83
|
enabled,
|
|
98
84
|
open,
|
|
@@ -135,6 +121,18 @@ export function usePortalMenuPosition<TMenuEl extends HTMLElement = HTMLDivEleme
|
|
|
135
121
|
};
|
|
136
122
|
}, [enabled, open, portalRoot]);
|
|
137
123
|
|
|
124
|
+
// the portal menu's z-index (1400, .mselect-menu--portal) is intentionally higher than every
|
|
125
|
+
// other fixed overlay it must paint over (checkout sheets/modals) — which also means it would
|
|
126
|
+
// paint over the sticky app header (.topbar, position:sticky/top:0/z-index:50) if left
|
|
127
|
+
// unconstrained. Reading the header's live bottom edge (0 when absent, e.g. inside a modal, or
|
|
128
|
+
// when TopBar's autoHideOnScroll has slid it away) gives a correct top boundary without
|
|
129
|
+
// hardcoding a pixel height that could drift from the header's own CSS.
|
|
130
|
+
const getSafeTop = (): number => {
|
|
131
|
+
if (typeof document === 'undefined') return 0;
|
|
132
|
+
const header = document.querySelector('.topbar');
|
|
133
|
+
return header ? Math.max(0, header.getBoundingClientRect().bottom) : 0;
|
|
134
|
+
};
|
|
135
|
+
|
|
138
136
|
const [menuPos, setMenuPos] = React.useState<PortalMenuPos | null>(null);
|
|
139
137
|
|
|
140
138
|
const positionMenu = React.useCallback(() => {
|
package/utils/index.ts
CHANGED
|
@@ -83,5 +83,3 @@ export type { IValues, IFilters, IQuery } from './query';
|
|
|
83
83
|
// Decorated car props (renders React UI; lives in vehiclesProps/ with its
|
|
84
84
|
// IconContainer + Co2Widget dependencies under compat/).
|
|
85
85
|
export { default as getDecoratedProps } from '../vehiclesProps/decoratedProps';
|
|
86
|
-
export { setStrictConditionOwners, isStrictConditionOwner, strictAccidentStatus } from '../vehiclesProps/accidentDisclosure';
|
|
87
|
-
export type { AccidentStatus } from '../vehiclesProps/accidentDisclosure';
|
package/vdp/VdpModules.tsx
CHANGED
|
@@ -92,7 +92,7 @@ export const VdpHeaderSummary: React.FunctionComponent<VdpHeaderCardProps> = ({
|
|
|
92
92
|
['zap', extractPS(vehicle.power)],
|
|
93
93
|
['fuel', stripParen(vehicle.fuel)],
|
|
94
94
|
['cog', vehicle.gear],
|
|
95
|
-
|
|
95
|
+
['user', t('autobahn:header.owners', { owners: vehicle.owners, count: vehicle.owners })],
|
|
96
96
|
];
|
|
97
97
|
return (
|
|
98
98
|
<>
|
|
@@ -142,7 +142,7 @@ export const VdpFactsGrid: React.FunctionComponent<VdpHeaderCardProps> = ({ vehi
|
|
|
142
142
|
['calendar', vehicle.reg],
|
|
143
143
|
['cog', vehicle.gear],
|
|
144
144
|
['fuel', stripParen(vehicle.fuel)],
|
|
145
|
-
|
|
145
|
+
['user', t('autobahn:header.owners', { owners: vehicle.owners, count: vehicle.owners })],
|
|
146
146
|
...(vehicle.body ? ([['car-front', vehicle.body]] as const) : []),
|
|
147
147
|
];
|
|
148
148
|
return (
|
|
@@ -216,7 +216,7 @@ export const VdpHeaderCondition: React.FunctionComponent<VdpHeaderCardProps> = (
|
|
|
216
216
|
// only the Garantie tile has one, linking out to auto.de's warranty policy page.
|
|
217
217
|
const tiles: ReadonlyArray<readonly [string, string, string, string?]> = [
|
|
218
218
|
['wrench', t('autobahn:header.huLabel'), condition.hu === 'Neu' ? t('autobahn:header.huNew') : t('autobahn:header.huUntil', { date: condition.hu })],
|
|
219
|
-
['shield-check', t('autobahn:header.accidentFree'), condition.unfallfrei
|
|
219
|
+
['shield-check', t('autobahn:header.accidentFree'), condition.unfallfrei ? t('autobahn:header.yes') : t('autobahn:header.no')],
|
|
220
220
|
['clipboard-check', t('autobahn:header.serviceHistory'), condition.scheckheft ? t('autobahn:header.yes') : t('autobahn:header.no')],
|
|
221
221
|
['award', t('autobahn:header.warranty'), condition.garantie, 'https://www.auto.de/garantie/'],
|
|
222
222
|
];
|
package/vdp/types.ts
CHANGED
|
@@ -111,8 +111,8 @@ export interface Co2CostsSummary {
|
|
|
111
111
|
export interface VehicleCondition {
|
|
112
112
|
/** TÜV/HU validity, e.g. '03/2027' — or 'Neu' for a new HU. */
|
|
113
113
|
hu: string;
|
|
114
|
-
/** accident-free flag (Unfallfrei)
|
|
115
|
-
unfallfrei: boolean
|
|
114
|
+
/** accident-free flag (Unfallfrei). */
|
|
115
|
+
unfallfrei: boolean;
|
|
116
116
|
/** full service history (Scheckheftgepflegt). */
|
|
117
117
|
scheckheft: boolean;
|
|
118
118
|
/** warranty label, e.g. '12 Monate inkl.'. */
|
|
@@ -191,8 +191,8 @@ export interface VehicleDetail {
|
|
|
191
191
|
fuel: string;
|
|
192
192
|
/** gearbox label, e.g. 'Automatik' / 'Schaltgetriebe'. */
|
|
193
193
|
gear: string;
|
|
194
|
-
/** number of previous owners (rendered as 'N. Hand')
|
|
195
|
-
owners: number
|
|
194
|
+
/** number of previous owners (rendered as 'N. Hand'). */
|
|
195
|
+
owners: number;
|
|
196
196
|
/** number of seats. */
|
|
197
197
|
seats: number;
|
|
198
198
|
/** number of doors. */
|
|
@@ -302,7 +302,7 @@ export function defaultVdpSpecs(v: VehicleDetail): VdpSpec[] {
|
|
|
302
302
|
[['cog', 'Getriebe', v.gear], true],
|
|
303
303
|
[['users', 'Sitze', `${v.seats} Sitze`], false],
|
|
304
304
|
[['door-open', 'Türen', `${v.doors} Türen`], false],
|
|
305
|
-
|
|
305
|
+
[['user', 'Halter', `${v.owners}. Hand`], true], // 0 Vorbesitzer is valid
|
|
306
306
|
[['palette', 'Außenfarbe', v.color], true],
|
|
307
307
|
[['car-front', 'Karosserie', v.body], true],
|
|
308
308
|
[['droplet', 'Verbrauch komb.', v.cons], true], // Pkw-EnVKV — exempt from this rule
|
|
@@ -6,7 +6,6 @@ import { formatTimestamp } from '../utils/DateUtils';
|
|
|
6
6
|
import { DELIVERY_PERIODS_EXTRA } from '../constants/core';
|
|
7
7
|
import moment from 'moment';
|
|
8
8
|
import { IDecoratedProp } from '../types/types';
|
|
9
|
-
import { strictAccidentStatus } from './accidentDisclosure';
|
|
10
9
|
|
|
11
10
|
interface IDecoratedProps {
|
|
12
11
|
[key: string]: IDecoratedProp;
|
|
@@ -166,10 +165,7 @@ const getDecoratedLightProps = (
|
|
|
166
165
|
if (hybridPlugin) {
|
|
167
166
|
if (wltpWeightedPowerCombinedContent && wltpWeightedCombinedContent) {
|
|
168
167
|
const dischargedCombined = Number.isFinite(wltpConsumptionCombined) ? wltpConsumptionCombined : 19.9;
|
|
169
|
-
|
|
170
|
-
// backend could not derive it the field is selector_unknown — hide the segment, never
|
|
171
|
-
// fall back to a hard-coded class here.
|
|
172
|
-
const dischargedClass = car.environmentEmissions.wltpDischargedEnergyEfficiencyClass;
|
|
168
|
+
const dischargedClass = car.environmentEmissions.wltpDischargedEnergyEfficiencyClass || 'selector_energyEfficiencyClass_g';
|
|
173
169
|
const weightedCombinedLabeled = t('vehicleProps:value.wltpWeightedCombinedLabel', { consumption: wltpWeightedCombined.toLocaleString(language), unit: translatedUnit });
|
|
174
170
|
const dischargedCombinedLabeled = t('vehicleProps:value.wltpDischargedCombinedLabel', { consumption: dischargedCombined.toLocaleString(language), unit: translatedUnit });
|
|
175
171
|
const co2WeightedContent = Number.isFinite(wltpCo2)
|
|
@@ -178,16 +174,14 @@ const getDecoratedLightProps = (
|
|
|
178
174
|
const co2ClassWeighted = isPropDefined(wltpEnergyEfficiencyClass)
|
|
179
175
|
? t('vehicleProps:value.co2ClassWeighted', { class: t(`cbd:${wltpEnergyEfficiencyClass}`) })
|
|
180
176
|
: null;
|
|
181
|
-
const co2ClassDischarged =
|
|
182
|
-
? t('vehicleProps:value.co2ClassDischarged', { class: t(`cbd:${dischargedClass}`) })
|
|
183
|
-
: null;
|
|
177
|
+
const co2ClassDischarged = t('vehicleProps:value.co2ClassDischarged', { class: t(`cbd:${dischargedClass}`) });
|
|
184
178
|
return <React.Fragment>
|
|
185
179
|
{`${wltpWeightedPowerCombinedContent} + `}
|
|
186
180
|
{`${weightedCombinedLabeled}, `}
|
|
187
181
|
{`${dischargedCombinedLabeled}`}
|
|
188
182
|
{co2WeightedContent && <>, {co2WeightedContent}</>}
|
|
189
183
|
{co2ClassWeighted && <>, {co2ClassWeighted}</>}
|
|
190
|
-
{
|
|
184
|
+
{<>, {co2ClassDischarged}</>}
|
|
191
185
|
</React.Fragment>
|
|
192
186
|
}
|
|
193
187
|
|
|
@@ -322,10 +316,7 @@ const getDecoratedLightProps = (
|
|
|
322
316
|
if (hybridPlugin) {
|
|
323
317
|
if (wltpWeightedPowerCombinedContent && wltpWeightedCombinedContent) {
|
|
324
318
|
const dischargedCombined = Number.isFinite(wltpConsumptionCombined) ? wltpConsumptionCombined : 19.9;
|
|
325
|
-
|
|
326
|
-
// backend could not derive it the field is selector_unknown — hide the segment, never
|
|
327
|
-
// fall back to a hard-coded class here.
|
|
328
|
-
const dischargedClass = car.environmentEmissions.wltpDischargedEnergyEfficiencyClass;
|
|
319
|
+
const dischargedClass = car.environmentEmissions.wltpDischargedEnergyEfficiencyClass || 'selector_energyEfficiencyClass_g';
|
|
329
320
|
const weightedCombinedLabeled = t('vehicleProps:value.wltpWeightedCombinedLabel', { consumption: wltpWeightedCombined.toLocaleString(language), unit: translatedUnit });
|
|
330
321
|
const dischargedCombinedLabeled = t('vehicleProps:value.wltpDischargedCombinedLabel', { consumption: dischargedCombined.toLocaleString(language), unit: translatedUnit });
|
|
331
322
|
const co2WeightedContent = Number.isFinite(wltpCo2)
|
|
@@ -334,16 +325,14 @@ const getDecoratedLightProps = (
|
|
|
334
325
|
const co2ClassWeighted = isPropDefined(wltpEnergyEfficiencyClass)
|
|
335
326
|
? t('vehicleProps:value.co2ClassWeighted', { class: t(`cbd:${wltpEnergyEfficiencyClass}`) })
|
|
336
327
|
: null;
|
|
337
|
-
const co2ClassDischarged =
|
|
338
|
-
? t('vehicleProps:value.co2ClassDischarged', { class: t(`cbd:${dischargedClass}`) })
|
|
339
|
-
: null;
|
|
328
|
+
const co2ClassDischarged = t('vehicleProps:value.co2ClassDischarged', { class: t(`cbd:${dischargedClass}`) });
|
|
340
329
|
return <React.Fragment>
|
|
341
330
|
{`${wltpWeightedPowerCombinedContent} + `}
|
|
342
331
|
{`${weightedCombinedLabeled}, `}
|
|
343
332
|
{`${dischargedCombinedLabeled}`}
|
|
344
333
|
{co2WeightedContent && <>, {co2WeightedContent}</>}
|
|
345
334
|
{co2ClassWeighted && <>, {co2ClassWeighted}</>}
|
|
346
|
-
{
|
|
335
|
+
{<>, {co2ClassDischarged}</>}
|
|
347
336
|
</React.Fragment>
|
|
348
337
|
}
|
|
349
338
|
|
|
@@ -520,9 +509,6 @@ const getDecoratedLightProps = (
|
|
|
520
509
|
title: t('cbd:mainData_accidentDamaged'),
|
|
521
510
|
icon: 'wrench',
|
|
522
511
|
get value() {
|
|
523
|
-
const strict = strictAccidentStatus(car);
|
|
524
|
-
if (strict === 'notSpecified') return t('vehicleProps:value.na');
|
|
525
|
-
if (strict) return strict === 'accident' ? t('vehicleProps:value.damaged') : t('vehicleProps:value.accidentFree');
|
|
526
512
|
return damaged ? t('vehicleProps:value.damaged') : t('vehicleProps:value.accidentFree');
|
|
527
513
|
}
|
|
528
514
|
},
|
|
@@ -9,7 +9,6 @@ import { EMISSION_STICKERS_ICONS, WP_EMISSION_STICKERS_ICONS } from '../constant
|
|
|
9
9
|
import { DELIVERY_PERIODS_EXTRA } from '../constants';
|
|
10
10
|
import { IDecoratedProp, ICar, IFinancingUtils } from '../types/types';
|
|
11
11
|
import { getFormattedPrice } from '../utils/CommonUtils';
|
|
12
|
-
import { strictAccidentStatus } from './accidentDisclosure';
|
|
13
12
|
|
|
14
13
|
const formatDeliveryPeriod = (t: (key: string, options?: object) => string, deliveryPeriod: string) => {
|
|
15
14
|
const count: number = +DELIVERY_PERIODS_EXTRA.find((period: any) => period.value === deliveryPeriod).label;
|
|
@@ -196,9 +195,6 @@ const getDecoratedProps = (
|
|
|
196
195
|
title: t('cbd:mainData_accidentDamaged'),
|
|
197
196
|
icon: 'wrench',
|
|
198
197
|
get value() {
|
|
199
|
-
const strict = strictAccidentStatus(car);
|
|
200
|
-
if (strict === 'notSpecified') return t('vehicleProps:value.na');
|
|
201
|
-
if (strict) return strict === 'accident' ? t('vehicleProps:value.damaged') : t('vehicleProps:value.accidentFree');
|
|
202
198
|
return damaged ? t('vehicleProps:value.damaged') : t('vehicleProps:value.accidentFree');
|
|
203
199
|
}
|
|
204
200
|
},
|
|
@@ -884,12 +880,10 @@ const getDecoratedProps = (
|
|
|
884
880
|
// (entladen, komb) fuel consumption + a discharged CO2 class.
|
|
885
881
|
if (hybridPlugin && wltpConsumptionWeightedPowerCombinedContent && wltpConsumptionWeightedCombinedContent) {
|
|
886
882
|
const ADV88_DEFAULT_DISCHARGED_COMBINED = 19.9;
|
|
883
|
+
const ADV88_DEFAULT_DISCHARGED_CO2_CLASS = 'selector_energyEfficiencyClass_g';
|
|
887
884
|
|
|
888
885
|
const dischargedCombined = Number.isFinite(wltpCombined) ? wltpCombined : ADV88_DEFAULT_DISCHARGED_COMBINED;
|
|
889
|
-
|
|
890
|
-
// backend could not derive it the field is selector_unknown — hide the segment, never
|
|
891
|
-
// fall back to a hard-coded class here.
|
|
892
|
-
const dischargedClass = car.environmentEmissions.wltpDischargedEnergyEfficiencyClass;
|
|
886
|
+
const dischargedClass = car.environmentEmissions.wltpDischargedEnergyEfficiencyClass || ADV88_DEFAULT_DISCHARGED_CO2_CLASS;
|
|
893
887
|
|
|
894
888
|
const weightedCombinedLabeled = t('vehicleProps:value.wltpWeightedCombinedLabel', { consumption: wltpWeightedCombined.toLocaleString(language), unit: translatedUnit });
|
|
895
889
|
const dischargedCombinedLabeled = t('vehicleProps:value.wltpDischargedCombinedLabel', { consumption: dischargedCombined.toLocaleString(language), unit: translatedUnit });
|
|
@@ -899,9 +893,7 @@ const getDecoratedProps = (
|
|
|
899
893
|
const co2ClassWeighted = isPropDefined(wltpEnergyEfficiencyClass)
|
|
900
894
|
? t('vehicleProps:value.co2ClassWeighted', { class: t(`cbd:${wltpEnergyEfficiencyClass}`) })
|
|
901
895
|
: null;
|
|
902
|
-
const co2ClassDischarged =
|
|
903
|
-
? t('vehicleProps:value.co2ClassDischarged', { class: t(`cbd:${dischargedClass}`) })
|
|
904
|
-
: null;
|
|
896
|
+
const co2ClassDischarged = t('vehicleProps:value.co2ClassDischarged', { class: t(`cbd:${dischargedClass}`) });
|
|
905
897
|
|
|
906
898
|
return <React.Fragment>
|
|
907
899
|
{wrapValue(wltpConsumptionWeightedPowerCombinedContent)}{' + '}
|
|
@@ -909,7 +901,7 @@ const getDecoratedProps = (
|
|
|
909
901
|
{wrapValue(dischargedCombinedLabeled)}
|
|
910
902
|
{co2WeightedContent && <>{', '}{wrapValue(co2WeightedContent)}</>}
|
|
911
903
|
{co2ClassWeighted && <>{', '}{co2ClassWeighted}</>}
|
|
912
|
-
{
|
|
904
|
+
{', '}{co2ClassDischarged}
|
|
913
905
|
</React.Fragment>
|
|
914
906
|
}
|
|
915
907
|
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
// Autobahn (auto.de redesign) — shared "scroll a just-opened/just-focused field to the top of the
|
|
2
|
-
// page" behaviour, used by Dropdown.tsx and by fe-main's DualRange/RateSlider (FilterContent.tsx)
|
|
3
|
-
// text fields on /search/detailed. On mobile, opening a dropdown's menu or focusing a text field
|
|
4
|
-
// brings the on-screen keyboard up and/or needs room for a popover below the field — if the field
|
|
5
|
-
// is sitting mid-page, there may not be enough space left below it once the keyboard/menu takes
|
|
6
|
-
// its share. Scrolling the field to the very top of the page first maximizes what's available.
|
|
7
|
-
//
|
|
8
|
-
// Extracted out of Dropdown.tsx so it can be shared verbatim with fe-main's non-Dropdown form
|
|
9
|
-
// fields (DualRange/RateSlider's text inputs) — same problem, same fix, one place to keep them
|
|
10
|
-
// from drifting apart. See Dropdown.tsx's own call site for the original reasoning this was
|
|
11
|
-
// pulled from.
|
|
12
|
-
export function scrollFieldIntoView(field: HTMLElement): void {
|
|
13
|
-
if (typeof window === 'undefined') return;
|
|
14
|
-
// Mobile-only: the on-screen-keyboard/popover space problem this fixes doesn't exist on
|
|
15
|
-
// desktop, where there's no keyboard pushing the viewport around. Same breakpoint + matchMedia
|
|
16
|
-
// pattern as Modal.tsx/CardCarousel.tsx elsewhere in this lib.
|
|
17
|
-
if (window.matchMedia('(min-width: 601px)').matches) return;
|
|
18
|
-
// Anchor on whichever is higher up: the field itself, or a short field label/caption sitting
|
|
19
|
-
// directly above it (own previous sibling, or — the common "label above a row of controls"
|
|
20
|
-
// shape, e.g. "Marke & Modell" above the Make/Model row on /search/detailed — the wrapping
|
|
21
|
-
// row's previous sibling). Checked by height, not by class name, so this works for ANY
|
|
22
|
-
// caller's label without this needing to know that call site's specific markup.
|
|
23
|
-
const MAX_LABEL_HEIGHT = 30;
|
|
24
|
-
const asLabel = (el: Element | null): HTMLElement | null => {
|
|
25
|
-
if (!(el instanceof HTMLElement)) return null;
|
|
26
|
-
const h = el.getBoundingClientRect().height;
|
|
27
|
-
return h > 0 && h <= MAX_LABEL_HEIGHT ? el : null;
|
|
28
|
-
};
|
|
29
|
-
const anchor =
|
|
30
|
-
asLabel(field.previousElementSibling) ||
|
|
31
|
-
asLabel(field.parentElement && field.parentElement.previousElementSibling) ||
|
|
32
|
-
field;
|
|
33
|
-
// No sticky-header reservation here: every current caller (NewMainPage '/', FilterContent on
|
|
34
|
-
// '/search*') sits on a page where TopBar's own autoHideOnScroll is on (App.tsx: isHomePage ||
|
|
35
|
-
// isSearchPage) — the header slides itself out of the way the instant this scroll starts,
|
|
36
|
-
// independently of this call, so reserving space for it here would double-count.
|
|
37
|
-
const GAP = 8;
|
|
38
|
-
const rect = anchor.getBoundingClientRect();
|
|
39
|
-
const targetY = window.scrollY + rect.top - GAP;
|
|
40
|
-
window.scrollTo({ top: Math.max(0, targetY), behavior: 'smooth' });
|
|
41
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// FINN handover v0.6 (Daniel, 15.10.2026): for the owners set here, accident and owner facts follow
|
|
2
|
-
// only what the source states — mainData.accidentDamaged false → accident-free, true → accident,
|
|
3
|
-
// empty → not specified; an empty owner count is not shown as "0. Hand". Every other dealer keeps
|
|
4
|
-
// the old display (accident-free unless `damaged`). The app sets the owners once at start.
|
|
5
|
-
let strictOwners: ReadonlyArray<string> = [];
|
|
6
|
-
|
|
7
|
-
export function setStrictConditionOwners(ownerIds: ReadonlyArray<string>): void {
|
|
8
|
-
strictOwners = (ownerIds || []).filter(Boolean);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function isStrictConditionOwner(car: any): boolean {
|
|
12
|
-
const ownerId = car?.metaData?.ownerId;
|
|
13
|
-
return !!ownerId && strictOwners.includes(ownerId);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export type AccidentStatus = 'accidentFree' | 'accident' | 'notSpecified';
|
|
17
|
-
|
|
18
|
-
// The strict status, or undefined when the car's owner keeps the old display.
|
|
19
|
-
export function strictAccidentStatus(car: any): AccidentStatus | undefined {
|
|
20
|
-
if (!isStrictConditionOwner(car)) return undefined;
|
|
21
|
-
const value = car?.mainData?.accidentDamaged;
|
|
22
|
-
if (value === true) return 'accident';
|
|
23
|
-
if (value === false) return 'accidentFree';
|
|
24
|
-
return 'notSpecified';
|
|
25
|
-
}
|