@bytebrand/fe-ui-core-autobahn 1.0.188 → 1.0.190
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 +388 -354
- package/cards/cardParts.tsx +10 -2
- package/cards/index.ts +0 -6
- package/chrome/Footer.tsx +3 -16
- package/chrome/TopBar.tsx +266 -139
- package/compat/CookieModal/CookieModal.tsx +6 -20
- package/compat/CookieModal/Modal.tsx +3 -6
- package/compat/CookieModal/modals/ManageCookieModal/ManageCookieModal.tsx +15 -43
- package/compat/CookieModal/modals/PreviewCookieModal/PreviewCookieModal.tsx +3 -4
- package/compat/CookieModal/useModal.ts +1 -5
- package/compat/Loader/Loader.tsx +7 -1
- package/compat/MdField/MdField.tsx +4 -28
- package/compat/TimePicker/TimePicker.tsx +2 -12
- package/constants/app.ts +11 -1
- package/constants/core.ts +12 -1
- package/data/toAutobahnCar.ts +2 -16
- package/iconsvg/IconSVG.tsx +5 -1
- package/locales/de/autobahn.json +848 -879
- package/locales/en/autobahn.json +848 -879
- package/package.json +2 -2
- package/theme/md3.css +11573 -15523
- package/ui/CreditCostNotice.tsx +43 -0
- package/ui/Dropdown.tsx +10 -29
- package/ui/FormCheckbox.tsx +2 -22
- package/ui/FormField.tsx +1 -2
- package/ui/Icon.tsx +0 -6
- package/ui/Modal.tsx +6 -84
- package/ui/Skeleton.tsx +20 -79
- package/ui/index.ts +3 -2
- package/ui/usePortalMenuPosition.ts +15 -27
- package/utils/index.ts +0 -10
- package/vdp/FinanceCalculator.tsx +11 -20
- package/vdp/VdpModules.tsx +15 -37
- package/vdp/types.ts +5 -5
- package/vehiclesProps/decoratedLightProps.tsx +0 -4
- package/vehiclesProps/decoratedProps.tsx +0 -4
- package/cards/CarCardSkeleton.tsx +0 -103
- package/cards/CarRowSkeleton.tsx +0 -152
- package/chrome/AccountMenuIcon.tsx +0 -109
- package/ui/MfieldCheckIcon.tsx +0 -13
- package/ui/scrollFieldIntoView.ts +0 -41
- package/utils/cookieConsent.ts +0 -84
- package/vehiclesProps/accidentDisclosure.ts +0 -25
|
@@ -16,7 +16,6 @@ import * as React from 'react';
|
|
|
16
16
|
import * as ReactDOM from 'react-dom';
|
|
17
17
|
|
|
18
18
|
import ModalsConfig from './ModalsConfig';
|
|
19
|
-
import { TranslationFunction } from '../../types';
|
|
20
19
|
import styles from './Modal.styl';
|
|
21
20
|
|
|
22
21
|
interface IBasicModal {
|
|
@@ -25,7 +24,6 @@ interface IBasicModal {
|
|
|
25
24
|
handleSentryInit?: () => void;
|
|
26
25
|
name: string;
|
|
27
26
|
modalProps?: any;
|
|
28
|
-
t?: TranslationFunction;
|
|
29
27
|
}
|
|
30
28
|
|
|
31
29
|
const OVERLAY: React.CSSProperties = {
|
|
@@ -42,17 +40,16 @@ const SURFACE: React.CSSProperties = {
|
|
|
42
40
|
maxWidth: 640, width: '100%', maxHeight: '92vh', overflowY: 'auto'
|
|
43
41
|
};
|
|
44
42
|
|
|
45
|
-
const BasicModal = ({ isVisible, toggleModal, name, modalProps, handleSentryInit
|
|
43
|
+
const BasicModal = ({ isVisible, toggleModal, name, modalProps, handleSentryInit }: IBasicModal) => {
|
|
46
44
|
if (!isVisible || typeof document === 'undefined') return null;
|
|
47
|
-
const label = t ? t('autobahn:cookieModal.dialogLabel') : '';
|
|
48
45
|
return ReactDOM.createPortal(
|
|
49
46
|
// wrapped in .md3: autobahn.css scopes every token/utility class (incl.
|
|
50
47
|
// .mbtn used by the modal buttons) under `.md3` and intentionally does
|
|
51
48
|
// nothing outside it — a bare document.body portal loses the theme.
|
|
52
49
|
<div className='md3'>
|
|
53
|
-
<div className={styles.overlay} style={OVERLAY} role='dialog' aria-modal='true' aria-label=
|
|
50
|
+
<div className={styles.overlay} style={OVERLAY} role='dialog' aria-modal='true' aria-label='Cookie-Einstellungen'>
|
|
54
51
|
<div className={styles.surface} style={SURFACE}>
|
|
55
|
-
{ModalsConfig[name] && ModalsConfig[name]({ ...modalProps, toggleModal, handleSentryInit
|
|
52
|
+
{ModalsConfig[name] && ModalsConfig[name]({ ...modalProps, toggleModal, handleSentryInit })}
|
|
56
53
|
</div>
|
|
57
54
|
</div>
|
|
58
55
|
</div>,
|
|
@@ -8,43 +8,19 @@ import MaterialAccordionGroup from '../../../MdAccordionGroup/MdAccordionGroup';
|
|
|
8
8
|
import MaterialSwitch from '../../../MdSwitch/MdSwitch';
|
|
9
9
|
import { COOKIE_SCHEMA, COOKIE_SCHEMA_LINKS } from '../../../../constants/common';
|
|
10
10
|
import { updateCookieList } from '../../../../utils/CommonUtils';
|
|
11
|
-
import { saveCookieConfig } from '../../../../utils/cookieConsent';
|
|
12
|
-
import { TranslationFunction } from '../../../../types';
|
|
13
11
|
|
|
14
12
|
import styles from './ManageCookieModal.styl';
|
|
15
13
|
|
|
16
14
|
interface IManageCookieModal {
|
|
17
15
|
toggleModal: () => void;
|
|
18
16
|
handleSentryInit?: () => void;
|
|
19
|
-
/** the host's `t` with the `autobahn` namespace loaded; without it the dialog stays German (fe-landing) */
|
|
20
|
-
t?: TranslationFunction;
|
|
21
17
|
}
|
|
22
18
|
|
|
23
19
|
interface IMarketingSwitches {
|
|
24
20
|
[key: string]: any;
|
|
25
21
|
}
|
|
26
22
|
|
|
27
|
-
|
|
28
|
-
const DE: Record<string, string> = {
|
|
29
|
-
title: 'Nach den Cookies geht die Fahrt weiter.',
|
|
30
|
-
manageText: 'Für ein bestmögliches Nutzererlebnis setzen wir Cookies und andere Technologien ein. Diese können Sie hier verwalten.',
|
|
31
|
-
'necessary.title': 'Notwendig',
|
|
32
|
-
'necessary.text': 'Wir verwenden Browser-Cookies, die notwendig sind, damit die Website wie vorgesehen funktioniert. Beispiel: Wir speichern Ihre Präferenzen bei der Datenerfassung auf der Website, damit wir sie berücksichtigen können, wenn Sie auf unsere Website zurückkehren. Sie können diese Cookies in den Einstellungen Ihres Browsers deaktivieren, aber wenn Sie dies tun, funktioniert die Website möglicherweise nicht wie vorgesehen.',
|
|
33
|
-
'analytics.title': 'Analytisch',
|
|
34
|
-
'analytics.text': 'Um das Nutzerverhalten zu verstehen und Ihnen ein relevanteres Surferlebnis zu bieten oder den Inhalt unserer Website zu personalisieren. Beispiel: Wir sammeln Informationen darüber, welche Seiten Sie besuchen, damit wir Ihnen relevantere Informationen präsentieren können.',
|
|
35
|
-
'marketing.title': 'Marketing',
|
|
36
|
-
'marketing.text': 'Zur Personalisierung und Messung der Effektivität von Werbung auf unserer Website und anderen Websites. Beispiel: Wir können Ihnen eine personalisierte Werbung auf der Grundlage der von Ihnen besuchten Seiten auf unserer Website anzeigen.',
|
|
37
|
-
privacyPolicy: 'Datenschutzbestimmungen',
|
|
38
|
-
saveSelection: 'Auswahl speichern',
|
|
39
|
-
acceptAll: 'Alles akzeptieren'
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const ManageCookieModal = ({ toggleModal, handleSentryInit, t } : IManageCookieModal) => {
|
|
43
|
-
// a key the host can't resolve (namespace not loaded) comes back as the key itself
|
|
44
|
-
const tr = (key: string) => {
|
|
45
|
-
const text = t ? t(`autobahn:cookieModal.${key}`) : '';
|
|
46
|
-
return text && !text.endsWith(`cookieModal.${key}`) ? text : DE[key];
|
|
47
|
-
};
|
|
23
|
+
const ManageCookieModal = ({ toggleModal, handleSentryInit } : IManageCookieModal) => {
|
|
48
24
|
const [analytcisMasterSwitch, setAnalyticsMasterSwitch] = useState(false);
|
|
49
25
|
const [marketingMasterSwitch, setMarketingMasterSwitch] = useState(false);
|
|
50
26
|
const [analyticsSwitches, setAnalyticsSwitches] = useState<IMarketingSwitches>({});
|
|
@@ -68,10 +44,6 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit, t } : IManageCookieM
|
|
|
68
44
|
.reduce((acc, item) => ({ ...acc, [item]: !!savedConfig && !savedDisabledMarketing.includes(item) }), {});
|
|
69
45
|
setAnalyticsSwitches(newAnalyticsSwitches);
|
|
70
46
|
setMarketingSwitches(newMarketingSwitches);
|
|
71
|
-
// ADV-268: reopened from the account page, a category whose cookies are all allowed shows
|
|
72
|
-
// its master switch on (it always started off)
|
|
73
|
-
setAnalyticsMasterSwitch(Object.values(newAnalyticsSwitches).every(Boolean));
|
|
74
|
-
setMarketingMasterSwitch(Object.values(newMarketingSwitches).every(Boolean));
|
|
75
47
|
},
|
|
76
48
|
[]
|
|
77
49
|
);
|
|
@@ -114,7 +86,7 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit, t } : IManageCookieM
|
|
|
114
86
|
marketing: Object.keys(marketingSwitches).filter(i => !marketingSwitches[i]) || [],
|
|
115
87
|
analytics: Object.keys(analyticsSwitches).filter(i => !analyticsSwitches[i]) || []
|
|
116
88
|
};
|
|
117
|
-
|
|
89
|
+
localStorage.setItem('cookieConfig', JSON.stringify(cookieConfig));
|
|
118
90
|
updateCookieList(handleSentryInit);
|
|
119
91
|
toggleModal();
|
|
120
92
|
};
|
|
@@ -138,34 +110,34 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit, t } : IManageCookieM
|
|
|
138
110
|
return (
|
|
139
111
|
<div className={styles.modalWrapper}>
|
|
140
112
|
<IconSVG name='autodeLogo' customDimensions />
|
|
141
|
-
<div className={styles.modalTitle}>
|
|
142
|
-
<div className={styles.modalContent}>
|
|
113
|
+
<div className={styles.modalTitle}>Nach den Cookies geht die Fahrt weiter.</div>
|
|
114
|
+
<div className={styles.modalContent}>Für ein bestmögliches Nutzererlebnis setzen wir Cookies und andere Technologien ein. Diese können Sie hier verwalten.</div>
|
|
143
115
|
<div className={styles.accordions}>
|
|
144
116
|
<MaterialAccordionGroup
|
|
145
|
-
title=
|
|
117
|
+
title='Notwendig'
|
|
146
118
|
// tooltipText='Notwendig'
|
|
147
119
|
withSwitch
|
|
148
120
|
switchProps={necessarySwitchProps}
|
|
149
121
|
>
|
|
150
|
-
<span className={styles.accordionDescription}>
|
|
122
|
+
<span className={styles.accordionDescription}>Wir verwenden Browser-Cookies, die notwendig sind, damit die Website wie vorgesehen funktioniert. Beispiel: Wir speichern Ihre Präferenzen bei der Datenerfassung auf der Website, damit wir sie berücksichtigen können, wenn Sie auf unsere Website zurückkehren. Sie können diese Cookies in den Einstellungen Ihres Browsers deaktivieren, aber wenn Sie dies tun, funktioniert die Website möglicherweise nicht wie vorgesehen.</span>
|
|
151
123
|
{Object.keys(COOKIE_SCHEMA.necessary).map(cookie => {
|
|
152
124
|
const getLinkFromCategory = _get(COOKIE_SCHEMA_LINKS, [cookie], '');
|
|
153
125
|
return (
|
|
154
126
|
<div className={styles.switchBlock} key={cookie} >
|
|
155
127
|
<span className={styles.switchBlockTitle}>{cookie}</span>
|
|
156
|
-
<a className={styles.switchBlockLink} href={getLinkFromCategory} target='_blank'>
|
|
128
|
+
<a className={styles.switchBlockLink} href={getLinkFromCategory} target='_blank'>Datenschutzbestimmungen</a>
|
|
157
129
|
<MaterialSwitch sx={{ marginLeft: 'auto' }} disabled={true} value={true} onChange={() => {}} />
|
|
158
130
|
</div>
|
|
159
131
|
);
|
|
160
132
|
})}
|
|
161
133
|
</MaterialAccordionGroup>
|
|
162
134
|
<MaterialAccordionGroup
|
|
163
|
-
title=
|
|
135
|
+
title='Analytisch'
|
|
164
136
|
withSwitch
|
|
165
137
|
// tooltipText='Analytisch'
|
|
166
138
|
switchProps={analyticsSwitchProps}
|
|
167
139
|
>
|
|
168
|
-
<span className={styles.accordionDescription}>
|
|
140
|
+
<span className={styles.accordionDescription}>Um das Nutzerverhalten zu verstehen und Ihnen ein relevanteres Surferlebnis zu bieten oder den Inhalt unserer Website zu personalisieren. Beispiel: Wir sammeln Informationen darüber, welche Seiten Sie besuchen, damit wir Ihnen relevantere Informationen präsentieren können.</span>
|
|
169
141
|
{Object.keys(COOKIE_SCHEMA.analytics).map(cookie => {
|
|
170
142
|
const getItemsFromCategory = _get(COOKIE_SCHEMA, `analytics['${cookie}']`, null);
|
|
171
143
|
const getLinkFromCategory = _get(COOKIE_SCHEMA_LINKS, [cookie], '');
|
|
@@ -173,7 +145,7 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit, t } : IManageCookieM
|
|
|
173
145
|
return (
|
|
174
146
|
<div className={styles.switchBlock} key={cookie} >
|
|
175
147
|
<span className={styles.switchBlockTitle}>{cookie}</span>
|
|
176
|
-
<a className={styles.switchBlockLink} href={getLinkFromCategory} target='_blank'>
|
|
148
|
+
<a className={styles.switchBlockLink} href={getLinkFromCategory} target='_blank'>Datenschutzbestimmungen</a>
|
|
177
149
|
<MaterialSwitch
|
|
178
150
|
sx={{ marginLeft: 'auto' }}
|
|
179
151
|
value={isChecked}
|
|
@@ -184,12 +156,12 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit, t } : IManageCookieM
|
|
|
184
156
|
})}
|
|
185
157
|
</MaterialAccordionGroup>
|
|
186
158
|
<MaterialAccordionGroup
|
|
187
|
-
title=
|
|
159
|
+
title='Marketing'
|
|
188
160
|
withSwitch
|
|
189
161
|
// tooltipText='Marketing'
|
|
190
162
|
switchProps={marketingSwitchProps}
|
|
191
163
|
>
|
|
192
|
-
<span className={styles.accordionDescription}>
|
|
164
|
+
<span className={styles.accordionDescription}>Zur Personalisierung und Messung der Effektivität von Werbung auf unserer Website und anderen Websites. Beispiel: Wir können Ihnen eine personalisierte Werbung auf der Grundlage der von Ihnen besuchten Seiten auf unserer Website anzeigen.</span>
|
|
193
165
|
{Object.keys(COOKIE_SCHEMA.marketing).map(cookie => {
|
|
194
166
|
const getItemsFromCategory = _get(COOKIE_SCHEMA, `marketing['${cookie}']`, null);
|
|
195
167
|
const getLinkFromCategory = _get(COOKIE_SCHEMA_LINKS, [cookie], '');
|
|
@@ -197,7 +169,7 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit, t } : IManageCookieM
|
|
|
197
169
|
return (
|
|
198
170
|
<div className={styles.switchBlock} key={cookie} >
|
|
199
171
|
<span className={styles.switchBlockTitle}>{cookie}</span>
|
|
200
|
-
<a className={styles.switchBlockLink} href={getLinkFromCategory} target='_blank'>
|
|
172
|
+
<a className={styles.switchBlockLink} href={getLinkFromCategory} target='_blank'>Datenschutzbestimmungen</a>
|
|
201
173
|
<MaterialSwitch
|
|
202
174
|
sx={{ marginLeft: 'auto' }}
|
|
203
175
|
value={isChecked}
|
|
@@ -209,8 +181,8 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit, t } : IManageCookieM
|
|
|
209
181
|
</MaterialAccordionGroup>
|
|
210
182
|
</div>
|
|
211
183
|
<div className={styles.buttonsContainer}>
|
|
212
|
-
<Button onClick={() => onAccept()} className={classNames(styles.modalBtn, styles.outlinedBtn, styles.zustimmenBtn)} >
|
|
213
|
-
<Button onClick={() => onAccept({ marketing: [], analytics: [] })} className={classNames(styles.modalBtn, styles.zustimmenBtn)}>
|
|
184
|
+
<Button onClick={() => onAccept()} className={classNames(styles.modalBtn, styles.outlinedBtn, styles.zustimmenBtn)} >Auswahl speichern</Button>
|
|
185
|
+
<Button onClick={() => onAccept({ marketing: [], analytics: [] })} className={classNames(styles.modalBtn, styles.zustimmenBtn)}>Alles akzeptieren</Button>
|
|
214
186
|
</div>
|
|
215
187
|
</div>
|
|
216
188
|
);
|
|
@@ -3,7 +3,6 @@ import IconSVG from '../../../../iconsvg/IconSVG';
|
|
|
3
3
|
import Button from '../../../Button/Button';
|
|
4
4
|
import styles from './PreviewCookieModal.styl';
|
|
5
5
|
import { updateCookieList } from '../../../../utils/CommonUtils';
|
|
6
|
-
import { saveCookieConfig } from '../../../../utils/cookieConsent';
|
|
7
6
|
import { COOKIE_SCHEMA } from '../../../../constants/common';
|
|
8
7
|
|
|
9
8
|
interface IPreviewCookieModal {
|
|
@@ -15,16 +14,16 @@ interface IPreviewCookieModal {
|
|
|
15
14
|
const PreviewCookieModal = ({ toggleModal, setModal, handleSentryInit } : IPreviewCookieModal) => {
|
|
16
15
|
const environment = window.location.origin;
|
|
17
16
|
const onAcceptAll = () => {
|
|
18
|
-
|
|
17
|
+
localStorage.setItem('cookieConfig', JSON.stringify({ marketing: [], analytics: [] }));
|
|
19
18
|
updateCookieList(handleSentryInit);
|
|
20
19
|
toggleModal();
|
|
21
20
|
};
|
|
22
21
|
|
|
23
22
|
const onDisableAll = () => {
|
|
24
|
-
|
|
23
|
+
localStorage.setItem('cookieConfig', JSON.stringify({
|
|
25
24
|
marketing: Object.values(COOKIE_SCHEMA.marketing).reduce((acc: string[], val: string[]) => acc.concat(val), []),
|
|
26
25
|
analytics: Object.values(COOKIE_SCHEMA.analytics).reduce((acc: string[], val: string[]) => acc.concat(val), [])
|
|
27
|
-
});
|
|
26
|
+
}));
|
|
28
27
|
updateCookieList(handleSentryInit);
|
|
29
28
|
toggleModal();
|
|
30
29
|
};
|
package/compat/Loader/Loader.tsx
CHANGED
|
@@ -10,7 +10,7 @@ export interface ILoaderProps {
|
|
|
10
10
|
fluid?: boolean;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
const Loader: React.FC<ILoaderProps> = ({ className
|
|
13
|
+
const Loader: React.FC<ILoaderProps> = ({ className, size, fluid }) => {
|
|
14
14
|
const classNames = classnames(
|
|
15
15
|
styles.loader,
|
|
16
16
|
{ [styles[size]]: !fluid },
|
|
@@ -23,4 +23,10 @@ const Loader: React.FC<ILoaderProps> = ({ className = '', size = 'medium', fluid
|
|
|
23
23
|
);
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
+
Loader.defaultProps = {
|
|
27
|
+
className: '',
|
|
28
|
+
size: 'medium',
|
|
29
|
+
fluid: false
|
|
30
|
+
};
|
|
31
|
+
|
|
26
32
|
export default Loader;
|
|
@@ -8,7 +8,6 @@ import * as React from 'react';
|
|
|
8
8
|
import classnames from 'classnames';
|
|
9
9
|
|
|
10
10
|
import Icon from '../../ui/Icon';
|
|
11
|
-
import MfieldCheckIcon from '../../ui/MfieldCheckIcon';
|
|
12
11
|
|
|
13
12
|
export interface MdFieldProps {
|
|
14
13
|
className?: string;
|
|
@@ -33,21 +32,12 @@ export interface MdFieldProps {
|
|
|
33
32
|
* when empty and unfocused, then floats up to the normal small-label spot on focus
|
|
34
33
|
* or once a value is typed. Defaults to false — the static above-field label. */
|
|
35
34
|
floatingLabel?: boolean;
|
|
36
|
-
/** opt-in: show a green check + green border when the field is filled and valid (checkout).
|
|
37
|
-
* Same contract/markup as FormField's own showValid (.mfield--valid/.mfield-ok, md3.css). */
|
|
38
|
-
showValid?: boolean;
|
|
39
35
|
onChange: (value: string, name?: string, event?: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
40
|
-
/** fires after the field's own internal blur handling (floating-label state). Callers use
|
|
41
|
-
* this to trigger `field.validate()` (mobx-react-form) on blur — this component only owns
|
|
42
|
-
* the `error` prop's display, not when validation actually runs, so without a caller wiring
|
|
43
|
-
* this in, `field.error` never populates from blur and a required-but-empty field never
|
|
44
|
-
* shows its error text/red border until some other validate() call happens to run. */
|
|
45
|
-
onBlur?: () => void;
|
|
46
36
|
}
|
|
47
37
|
|
|
48
38
|
const MdField: React.FunctionComponent<MdFieldProps> = ({
|
|
49
39
|
className, error, sx, required, disabled, multiline, autoComplete,
|
|
50
|
-
value, type, name, rows, label, placeholder, floatingLabel, maxLength,
|
|
40
|
+
value, type, name, rows, label, placeholder, floatingLabel, maxLength, onChange
|
|
51
41
|
}) => {
|
|
52
42
|
const [reveal, setReveal] = React.useState(false);
|
|
53
43
|
const [focused, setFocused] = React.useState(false);
|
|
@@ -64,7 +54,6 @@ const MdField: React.FunctionComponent<MdFieldProps> = ({
|
|
|
64
54
|
// a value is typed, the real <label> appears in its normal static spot above the
|
|
65
55
|
// field and the native placeholder goes quiet — the two never show at the same time.
|
|
66
56
|
const hasValue = value != null && value !== '';
|
|
67
|
-
const isValid = !!showValid && !disabled && !isPassword && !hasError && hasValue;
|
|
68
57
|
const resting = !!floatingLabel && !focused && !hasValue;
|
|
69
58
|
const effectivePlaceholder = floatingLabel ? (resting ? (label || placeholder || '') : '') : (placeholder || '');
|
|
70
59
|
// The real <label> is skipped entirely while resting (see above), leaving the input with
|
|
@@ -82,9 +71,7 @@ const MdField: React.FunctionComponent<MdFieldProps> = ({
|
|
|
82
71
|
|
|
83
72
|
return (
|
|
84
73
|
<div className={classnames('mfield-group', className)} style={sx as React.CSSProperties}>
|
|
85
|
-
{
|
|
86
|
-
plain label-above-the-box row — unchanged, still a .mfield-group flex child. */}
|
|
87
|
-
{label && !resting && !floatingLabel ? (
|
|
74
|
+
{label && !resting ? (
|
|
88
75
|
<label className='md-label-sm mfield-label' htmlFor={generatedId}>
|
|
89
76
|
{label}{required ? ' *' : ''}
|
|
90
77
|
</label>
|
|
@@ -100,18 +87,8 @@ const MdField: React.FunctionComponent<MdFieldProps> = ({
|
|
|
100
87
|
+ (hasError ? ' mfield--error' : '')
|
|
101
88
|
+ (disabled ? ' mfield--disabled' : '')
|
|
102
89
|
+ (floatingLabel ? ' mfield--floating' : '')
|
|
103
|
-
+ (isValid ? ' mfield--valid' : '')
|
|
104
90
|
}
|
|
105
91
|
>
|
|
106
|
-
{/* floatingLabel + floated (focused or has a value): the Material "notched outline"
|
|
107
|
-
treatment — label sits ON the border line, not stacked above it in its own row.
|
|
108
|
-
Lives INSIDE .mfield (not .mfield-group) so it can position against .mfield's own
|
|
109
|
-
edge (.mfield is position:relative already, md3.css) via .mfield-label--notch. */}
|
|
110
|
-
{label && !resting && floatingLabel ? (
|
|
111
|
-
<label className='md-label-sm mfield-label mfield-label--notch' htmlFor={generatedId}>
|
|
112
|
-
{label}{required ? ' *' : ''}
|
|
113
|
-
</label>
|
|
114
|
-
) : null}
|
|
115
92
|
{multiline ? (
|
|
116
93
|
<textarea
|
|
117
94
|
id={generatedId}
|
|
@@ -119,7 +96,7 @@ const MdField: React.FunctionComponent<MdFieldProps> = ({
|
|
|
119
96
|
value={value == null ? '' : value}
|
|
120
97
|
onChange={handleChange}
|
|
121
98
|
onFocus={() => setFocused(true)}
|
|
122
|
-
onBlur={() =>
|
|
99
|
+
onBlur={() => setFocused(false)}
|
|
123
100
|
disabled={disabled}
|
|
124
101
|
rows={rows || 3}
|
|
125
102
|
maxLength={maxLength}
|
|
@@ -138,7 +115,7 @@ const MdField: React.FunctionComponent<MdFieldProps> = ({
|
|
|
138
115
|
value={value == null ? '' : value}
|
|
139
116
|
onChange={handleChange}
|
|
140
117
|
onFocus={() => setFocused(true)}
|
|
141
|
-
onBlur={() =>
|
|
118
|
+
onBlur={() => setFocused(false)}
|
|
142
119
|
disabled={disabled}
|
|
143
120
|
maxLength={maxLength}
|
|
144
121
|
placeholder={effectivePlaceholder}
|
|
@@ -160,7 +137,6 @@ const MdField: React.FunctionComponent<MdFieldProps> = ({
|
|
|
160
137
|
<Icon name={reveal ? 'eye-off' : 'eye'} size={18} />
|
|
161
138
|
</button>
|
|
162
139
|
) : null}
|
|
163
|
-
{isValid ? <span className="mfield-ok"><MfieldCheckIcon /></span> : null}
|
|
164
140
|
</div>
|
|
165
141
|
{hasError ? (
|
|
166
142
|
// role="alert" announces this to screen readers the moment it enters the DOM (e.g.
|
|
@@ -41,17 +41,9 @@ const TimePicker = ({
|
|
|
41
41
|
|
|
42
42
|
const endOfTheDayTime = currentDay > 5 || currentDay < 1 ? '17:30:00' : '19:30:00';
|
|
43
43
|
const startOfTheDayTime = currentDay > 5 || currentDay < 1 ? '09:00:00' : '08:30:00';
|
|
44
|
+
const setNewDay = new Date(`${date.toDateString()} ${endOfTheDayTime}`) > date ? 0 : 86400000;
|
|
44
45
|
const interval = 30 * 60 * 1000;
|
|
45
46
|
const roundedTime = new Date(Math.ceil(date / interval) * interval);
|
|
46
|
-
// Today is open while a slot is left: the next half hour must not be past the last one (16:30 on
|
|
47
|
-
// weekends, 19:30 on weekdays). Weekends 16:31–17:29 were still before closing but had no slot
|
|
48
|
-
// left, which crashed the picker on an empty list. A closed today is left out of the dates, as
|
|
49
|
-
// after hours. Today's own weekday decides, not the selected day's.
|
|
50
|
-
const isTodayWeekend = date.getDay() > 5 || date.getDay() < 1;
|
|
51
|
-
const todayEnd = new Date(`${date.toDateString()} ${isTodayWeekend ? '17:30:00' : '19:30:00'}`);
|
|
52
|
-
const todayLastSlot = new Date(`${date.toDateString()} ${isTodayWeekend ? '16:30:00' : '19:30:00'}`);
|
|
53
|
-
const isTodayOpen = todayEnd > date && roundedTime <= todayLastSlot;
|
|
54
|
-
const setNewDay = isTodayOpen ? 0 : 86400000;
|
|
55
47
|
const nextWeekDays = [...Array(7).keys()].map((days, index) => (
|
|
56
48
|
{
|
|
57
49
|
value: index,
|
|
@@ -95,9 +87,7 @@ const TimePicker = ({
|
|
|
95
87
|
dayRanges.push({ time, value: dayRanges.length, label: `${time} - ${rangeTime}` });
|
|
96
88
|
} // time ranges for full day
|
|
97
89
|
|
|
98
|
-
|
|
99
|
-
const isTodaySelected = new Date(nextWeekDaysFull[day]).toDateString() === new Date().toDateString();
|
|
100
|
-
return isTodaySelected && isWorkingHours() ? currentDayRanges : dayRanges;
|
|
90
|
+
return currentDay === new Date().getDay() && isWorkingHours() ? currentDayRanges : dayRanges;
|
|
101
91
|
};
|
|
102
92
|
|
|
103
93
|
useEffect(
|
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/data/toAutobahnCar.ts
CHANGED
|
@@ -42,20 +42,6 @@ import { TIER_LABELS, RatingTier, CO2_CLASSES, Co2Class } from '../constants/aut
|
|
|
42
42
|
export const PLACEHOLDER_IMAGE =
|
|
43
43
|
'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
|
|
44
44
|
|
|
45
|
-
/**
|
|
46
|
-
* The app-wide no-image asset, set ONCE at app start (fe-main's index.tsx passes its
|
|
47
|
-
* PLACEHOLDER_IMAGE_LARGE_URL, built from config.imagesAPI.imgUrlBase) — so every card that
|
|
48
|
-
* maps a car without a photo shows the "noimage" picture, not the transparent data URI above,
|
|
49
|
-
* without each page having to remember `deps.placeholder` (most didn't: the home page, /search,
|
|
50
|
-
* favourites and the dashboard all rendered an empty white photo). `deps.placeholder` still
|
|
51
|
-
* wins per call; the data URI stays the last resort (tests, an app that never sets this).
|
|
52
|
-
*/
|
|
53
|
-
let defaultPlaceholder: string = PLACEHOLDER_IMAGE;
|
|
54
|
-
|
|
55
|
-
export function setPlaceholderImage(url: string): void {
|
|
56
|
-
defaultPlaceholder = url || PLACEHOLDER_IMAGE;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
45
|
/**
|
|
60
46
|
* Dependencies the SRP container injects. Everything here is what the mapper
|
|
61
47
|
* needs from the outside world — keeping the function itself pure.
|
|
@@ -81,7 +67,7 @@ export interface ToAutobahnCarDeps {
|
|
|
81
67
|
t?: (key: string, options?: object) => string;
|
|
82
68
|
/** active UI language ('de' | 'en' …). Drives de-DE vs en-IN number grouping for the EnVKV line. */
|
|
83
69
|
language?: string;
|
|
84
|
-
/** placeholder image URL override (defaults to
|
|
70
|
+
/** placeholder image URL override (defaults to PLACEHOLDER_IMAGE). */
|
|
85
71
|
placeholder?: string;
|
|
86
72
|
/**
|
|
87
73
|
* Buyer-activity stats for this car — UserActionsAPI 'stats/viewers' response, loaded async and
|
|
@@ -286,7 +272,7 @@ function isPluginHybrid(fuel: any): boolean {
|
|
|
286
272
|
* `sizeOverride` lets a caller ask for a different size than `deps.imageSize` (e.g. a full-res
|
|
287
273
|
* set for a lightbox, while the card thumbnail itself stays on the smaller default). */
|
|
288
274
|
function buildGallery(storeCar: any, deps: ToAutobahnCarDeps, sizeOverride?: 'small' | 'medium' | 'large'): string[] {
|
|
289
|
-
const placeholder = deps.placeholder ||
|
|
275
|
+
const placeholder = deps.placeholder || PLACEHOLDER_IMAGE;
|
|
290
276
|
// Only 'small' and 'large' variants are pre-generated by image-generator; 'medium' has no cached file.
|
|
291
277
|
const size = sizeOverride || deps.imageSize || 'small';
|
|
292
278
|
|
package/iconsvg/IconSVG.tsx
CHANGED
|
@@ -7,7 +7,7 @@ type TIconSVG = {
|
|
|
7
7
|
customDimensions?: boolean;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
const IconSVG: React.FC<TIconSVG> = ({ name, isWarrantyActive, customDimensions
|
|
10
|
+
const IconSVG: React.FC<TIconSVG> = ({ name, isWarrantyActive, customDimensions, ...props }: TIconSVG) => {
|
|
11
11
|
if (!name) return null;
|
|
12
12
|
|
|
13
13
|
const Component: any = components[name.toString()];
|
|
@@ -23,4 +23,8 @@ const IconSVG: React.FC<TIconSVG> = ({ name, isWarrantyActive, customDimensions
|
|
|
23
23
|
);
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
+
IconSVG.defaultProps = {
|
|
27
|
+
customDimensions: false
|
|
28
|
+
};
|
|
29
|
+
|
|
26
30
|
export default IconSVG;
|