@bytebrand/fe-ui-core 4.3.1 → 4.4.1

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 (125) hide show
  1. package/__tests__/components/UserDasboardPage/sections/CheckoutSection/CheckoutSection.test.tsx +613 -0
  2. package/__tests__/components/UserDasboardPage/sections/FavoriteSection/FavoriteSection.test.tsx +335 -0
  3. package/__tests__/utils/CommonUtils/getOfferSliders.test.ts +4 -2
  4. package/common.ts +6 -2
  5. package/package.json +19 -28
  6. package/source/components/AccordionWidget/AccordionWidget.tsx +1 -3
  7. package/source/components/Breadcrumbs/Breadcrumbs.tsx +3 -3
  8. package/source/components/Checkout/CheckoutStepper/CheckoutStepper.styl +2 -190
  9. package/source/components/Checkout/CheckoutStepper/CheckoutStepper.tsx +15 -16
  10. package/source/components/Checkout/OrderOverviewItem/OrderOverviewItem.styl +2 -2
  11. package/source/components/Checkout/OrderOverviewItem/OrderOverviewItem.tsx +3 -3
  12. package/source/components/FormattedNumber/FormattedNumber.tsx +2 -3
  13. package/source/components/InfoBlocks/FirstInfoBlock/FirstInfoBlockItem/FirstInfoBlockItem.styl +4 -6
  14. package/source/components/OfferDetailedSection/partials/PanelConfig.tsx +0 -3
  15. package/source/components/OfferPanel/MuiOfferPeriod/{MuiOfferPeriod.theme.js → MuiOfferPeriod.theme.tsx} +8 -13
  16. package/source/components/OfferPanel/MuiOfferPeriod/MuiOfferPeriod.tsx +28 -4
  17. package/source/components/OfferPanel/OfferCheckboxGroup/CheckboxContainer.tsx +6 -12
  18. package/source/components/OfferPanel/OfferCheckboxGroup/OfferCheckboxGroup.tsx +1 -1
  19. package/source/components/OfferPanel/OfferPanel.tsx +1 -1
  20. package/source/components/OfferPanel/OfferPeriod/OfferPeriod.tsx +0 -4
  21. package/source/components/OfferPanel/RangeGroup/RangeGroup.tsx +6 -4
  22. package/source/components/PriceRatingDetailed/PriceRatingDetailed.tsx +6 -2
  23. package/source/components/SearchFilters/filters/AlternativeID.tsx +42 -53
  24. package/source/components/SearchFilters/filters/DriveType.tsx +1 -1
  25. package/source/components/SearchFilters/filters/EmissionSticker.tsx +1 -1
  26. package/source/components/SearchFilters/filters/FirstRegistration.tsx +0 -1
  27. package/source/components/SearchFilters/filters/InteriorColor.tsx +1 -1
  28. package/source/components/SearchFilters/filters/InteriorMaterial.tsx +2 -1
  29. package/source/components/SearchFilters/filters/Mileage.tsx +1 -1
  30. package/source/components/SearchFilters/filters/Power.tsx +36 -17
  31. package/source/components/SearchFilters/filters/StateOptions.tsx +0 -1
  32. package/source/components/SearchFilters/filters/Transmission.tsx +1 -1
  33. package/source/components/SearchPage/SearchChips/SearchChips.tsx +1 -1
  34. package/source/components/SearchPageMobile/FiltersDetailed/BodyType.tsx +3 -3
  35. package/source/components/SearchPageMobile/FiltersDetailed/Consumption.tsx +2 -2
  36. package/source/components/SearchPageMobile/FiltersDetailed/Doors.tsx +1 -1
  37. package/source/components/SearchPageMobile/FiltersDetailed/MakeModel.tsx +1 -1
  38. package/source/components/SearchWidget/ColorWidget/BodyColorWidget.tsx +3 -3
  39. package/source/components/SearchWidget/EnvironmentWidget/EnvironmentWidget.tsx +3 -3
  40. package/source/components/SearchWidget/HighlightsWidget/HighlightsWidget.tsx +2 -2
  41. package/source/components/SearchWidget/StateWidget/StateWidget.tsx +1 -2
  42. package/source/components/SearchWidgetsMobile/BasicDataWidgetMobile/BasicDataWidgetMobile.tsx +4 -4
  43. package/source/components/SearchWidgetsMobile/EquipmentsWidget/EquipmentsWidget.tsx +16 -16
  44. package/source/components/SearchWidgetsMobile/HighlightsWidgetMobile/HighlightsWidgetMobile.tsx +1 -1
  45. package/source/components/SearchWidgetsMobile/InteriorWidget/InteriorWidget.tsx +1 -1
  46. package/source/components/SearchWidgetsMobile/SafetyWidget/SafetyWidget.tsx +6 -6
  47. package/source/components/Stepper/Stepper.tsx +4 -3
  48. package/source/components/UserDashboardPage/sections/CheckoutSection/CheckoutSection.styl +38 -0
  49. package/source/components/UserDashboardPage/sections/CheckoutSection/CheckoutSection.tsx +120 -0
  50. package/source/components/UserDashboardPage/sections/FavoriteSection/FavoriteSection.styl +22 -0
  51. package/source/components/UserDashboardPage/sections/FavoriteSection/FavoriteSection.tsx +84 -0
  52. package/source/components/UserDashboardPage/sections/OrderStatusSection/AdditionalOrderInfo.styl +11 -2
  53. package/source/components/UserDashboardPage/sections/OrderStatusSection/AdditionalOrderInfo.tsx +5 -5
  54. package/source/components/UserDashboardPage/sections/OrderStatusSection/OrderStatusCar.tsx +57 -38
  55. package/source/components/UserDashboardPage/sections/OrderStatusSection/OrderStatusCard.tsx +2 -2
  56. package/source/components/UserDashboardPage/sections/OrderStatusSection/OrderStatusSection.tsx +183 -101
  57. package/source/components/UserDashboardPage/sections/RequestedCarsSection/RequestedCarsSection.tsx +5 -7
  58. package/source/components/Vehicle/VehicleFormattedPrice/VehicleFormattedPrice.tsx +33 -7
  59. package/source/components/VehicleDetailedSidebar/VehicleDetailedSidebar.styl +10 -2
  60. package/source/components/VehicleDetailedSidebar/VehicleDetailedSidebar.tsx +21 -14
  61. package/source/components/VehicleDetailedSidebar/partials/Price.styl +5 -1
  62. package/source/components/VehicleDetailedSidebar/partials/Price.tsx +2 -1
  63. package/source/components/VehicleDetailedSidebar/partials/PriceContent.styl +16 -5
  64. package/source/components/VehicleDetailedSidebar/partials/PriceContent.tsx +9 -4
  65. package/source/components/VehicleDetailedSidebar/partials/Properties.tsx +1 -1
  66. package/source/components/VehicleDetailedSlider/VehicleDetailedSlider.styl +45 -0
  67. package/source/components/VehicleDetailedSlider/VehicleDetailedSlider.tsx +121 -42
  68. package/source/components/VehicleDetailedSlider/partials/PriceData.styl +4 -1
  69. package/source/components/VehicleDetailedSlider/partials/PriceData.tsx +8 -1
  70. package/source/components/VehicleDetailedSlider/partials/Stats.tsx +2 -2
  71. package/source/components/VehicleSmallCard/VehicleData/VechiclePriceItem/VechiclePriceItem.tsx +9 -7
  72. package/source/components/VehicleSmallCard/VehicleData/VehiclePrice/VehiclePrice.styl +35 -1
  73. package/source/components/VehicleSmallCard/VehicleData/VehiclePrice/VehiclePrice.tsx +9 -3
  74. package/source/components/VehicleSmallCard/VehicleData/VehicleTitle/VehicleTitle.styl +11 -2
  75. package/source/components/VehicleSmallCard/VehicleData/VehicleTitle/VehicleTitle.tsx +2 -1
  76. package/source/components/VehicleSmallCard/VehicleSmallCard.styl +3 -1
  77. package/source/components/VehicleSmallCard/VehicleSmallCard.tsx +3 -7
  78. package/source/components/_common/Badge/Badge.styl +3 -0
  79. package/source/components/_common/Badge/Badge.tsx +1 -1
  80. package/source/components/_common/Button/Button.tsx +5 -4
  81. package/source/components/_common/Checkbox/FormCheckbox.tsx +4 -4
  82. package/source/components/_common/CheckboxMaterial/CheckboxMaterial.tsx +1 -1
  83. package/source/components/_common/Chip/Chip.tsx +1 -3
  84. package/source/components/_common/ExpansionPanel/ExpansionPanel.tsx +3 -3
  85. package/source/components/_common/IconSVG/IconSVGConfig.tsx +2 -0
  86. package/source/components/_common/IconSVG/SVG/flags/SK.tsx +0 -1
  87. package/source/components/_common/IconSVG/SVG/slider/360New.tsx +1 -1
  88. package/source/components/_common/IconSVG/SVG/slider/YoutubeButton.tsx +26 -0
  89. package/source/components/_common/MaterialAccordion/MaterialAccordion.tsx +22 -30
  90. package/source/components/_common/MaterialAutocomplete/MaterialAutocomplete.styled.tsx +8 -8
  91. package/source/components/_common/MaterialDatePicker/MaterialDatePicker.styled.tsx +0 -1
  92. package/source/components/_common/MaterialSelect/MaterialSelect.styled.tsx +12 -15
  93. package/source/components/_common/MaterialSelect/MaterialSelect.tsx +3 -3
  94. package/source/components/_common/MaterialSwitch/MaterialSwitch.tsx +3 -1
  95. package/source/components/_common/MaterialTooltip/MaterialTooltip.styled.tsx +1 -1
  96. package/source/components/_common/MaterialTooltip/MaterialTooltip.tsx +3 -3
  97. package/source/components/_common/Modal/CookieModal.tsx +1 -3
  98. package/source/components/_common/Modal/Modal.styled.tsx +2 -1
  99. package/source/components/_common/Modal/Modal.tsx +1 -5
  100. package/source/components/_common/Modal/ModalsConfig.tsx +5 -1
  101. package/source/components/_common/Modal/modals/ManageCookieModal/ManageCookieModal.styl +23 -7
  102. package/source/components/_common/Modal/modals/ManageCookieModal/ManageCookieModal.tsx +84 -36
  103. package/source/components/_common/Modal/modals/PreviewCookieModal/PreviewCookieModal.styl +29 -14
  104. package/source/components/_common/Modal/modals/PreviewCookieModal/PreviewCookieModal.tsx +17 -10
  105. package/source/components/_common/OfferRequestButtonWrapper/OfferRequestButtonWrapper.tsx +12 -4
  106. package/source/components/_common/Range/Range.tsx +26 -16
  107. package/source/components/_common/UserMenu/MaterialMenu.styled.tsx +0 -1
  108. package/source/components/_common/UserMenu/MaterialMenu.tsx +3 -3
  109. package/source/components/_common/UserMenu/MaterialMenuItem.tsx +42 -20
  110. package/source/components/_common/UserMenu/NestedMenu.tsx +1 -1
  111. package/source/components/_common/withStats/withStats.styl +3 -0
  112. package/source/components/_common/withStats/withStats.tsx +19 -16
  113. package/source/components/containers/SearchPage/FiltersContainer/FiltersContainer.styl +14 -1
  114. package/source/components/containers/SearchPage/FiltersContainer/FiltersContainer.tsx +78 -42
  115. package/source/framework/constants/common.ts +89 -60
  116. package/source/framework/constants/highlights.ts +1 -1
  117. package/source/framework/constants.ts +1 -1
  118. package/source/framework/types/types.ts +9 -4
  119. package/source/framework/utils/CommonUtils.ts +73 -62
  120. package/source/framework/utils/DateUtils.ts +10 -2
  121. package/source/framework/vehiclesProps/decoratedLightProps.tsx +1 -2
  122. package/source/framework/vehiclesProps/decoratedProps.tsx +1 -2
  123. package/source/locales/data.ts +2 -2
  124. package/tslint.json +1 -2
  125. package/utils.ts +2 -0
@@ -7,8 +7,9 @@ import styles from './OrderStatusSection.styl';
7
7
  import { Skeleton } from '@mui/material';
8
8
 
9
9
  import { getFormattedPrice } from '../../../../framework/utils/CommonUtils';
10
+ import { fromUTCToDateString } from '../../../../framework/utils/DateUtils';
10
11
 
11
- interface TFunction {
12
+ interface ITFunction {
12
13
  <T = string>(key: string, options?: object): T;
13
14
  <T = string>(keys: string[], options?: object): T;
14
15
  }
@@ -16,17 +17,19 @@ interface TFunction {
16
17
  interface IOrderStatusSection {
17
18
  getSupportedImageFormat: (id: string, mainImageId: string, size: 'small' | 'medium' | 'large') => string;
18
19
  redirectToUrl: (url: string) => void;
19
- t: TFunction;
20
+ t: ITFunction;
20
21
  isFetching: boolean;
21
22
  withAdditionalInfo?: boolean; // for using on /account/my-order.
22
23
  orderedCars: any[]; // TODO: create interface for orderedCars, when the object is formatted by the backend
24
+ wonCars?: any[];
23
25
  }
24
26
 
25
27
  const OrderStatusSection = ({
26
28
  getSupportedImageFormat,
27
29
  t,
28
- redirectToUrl,
30
+ redirectToUrl,
29
31
  orderedCars,
32
+ wonCars,
30
33
  isFetching,
31
34
  withAdditionalInfo = false
32
35
  }: IOrderStatusSection) => {
@@ -41,126 +44,202 @@ const OrderStatusSection = ({
41
44
  if (!!addressObj) {
42
45
  Object.keys(addressObj).forEach((key) => {
43
46
  switch (key) {
44
- case 'customerFirstname':
45
- case 'customerLastname':
47
+ case 'firstname':
48
+ case 'lastname':
46
49
  addressString = `${addressString} ${addressObj[key]}`;
47
50
  break;
48
- case 'deliveryPartner':
49
- case 'customerStreet':
50
- case 'deliveryStreet':
51
- case 'customerZip':
52
- case 'deliveryZip':
51
+ case 'partner':
52
+ case 'street':
53
+ case 'zip':
54
+ case 'number':
53
55
  if (!!addressString) {
54
56
  addressString = `${addressString}, ${addressObj[key]}`;
55
57
  } else {
56
58
  addressString = `${addressString} ${addressObj[key]}`;
57
59
  }
58
60
  break;
59
- case 'customerCity':
60
- case 'deliveryCity':
61
+ case 'city':
61
62
  addressString = `${addressString} ${addressObj[key]}`;
62
63
  break;
64
+ default: addressString = `${addressString} ${addressObj[key]}`;
63
65
  }
64
- })
66
+ });
65
67
  }
66
68
  return addressString;
67
69
  };
68
70
 
69
71
  const getDataPriceItem = (value: number, label: string): {value: string, label: string} | [] => {
70
72
  if (!!value && value !== 0) {
71
- return { value: getFormattedPrice(value, '$,.2f', ' €'), label };
73
+ return { label, value: getFormattedPrice(value, '$,.2f', ' €') };
74
+ }
75
+ };
76
+
77
+ const defaultCarProps = {
78
+ car: {
79
+ _id: '',
80
+ mainData: {
81
+ make: '',
82
+ model: '',
83
+ subModel: ''
84
+ },
85
+ metaData: {
86
+ mainImageId: ''
87
+ }
88
+ },
89
+ buyingType: '',
90
+ selfPickup: false,
91
+ paybackPeriod: 0,
92
+ monthlyInstallment: 0,
93
+ status: '',
94
+ request: '',
95
+ registration: false,
96
+ currentSalesPrice: 0,
97
+ deposit: 0,
98
+ preparationCost: 0,
99
+ licensePlateCost: 0,
100
+ registrationCost: 0,
101
+ transportationCost: 0,
102
+ customerAddress: {
103
+ customerFirstname: '',
104
+ customerLastname: '',
105
+ customerStreet: '',
106
+ customerZip: ''
107
+ },
108
+ deliveryAddress: {
109
+ deliveryPartner: '',
110
+ deliveryStreet: '',
111
+ deliveryZip: '',
112
+ deliveryCity: ''
72
113
  }
73
114
  }
74
115
 
75
- const renderRequestedCars = () => {
116
+ const carPriceWithWarrantyTitle = (warranty: { warrantyPackage: string, warrantyCost: number, warrantyPeriod: number }) => {
117
+ if (!warranty || !warranty.warrantyCost) {
118
+ return t('MyOrderPage:carPrice');
119
+ }
120
+ const warrantyPackage = t(`MyOrderPage:${warranty.warrantyPackage}`);
121
+ const warrantyPeriod = t(`MyOrderPage:${warranty.warrantyPeriod}year`, { warrantyPeriod: warranty.warrantyPeriod });
122
+ const carPriceIncWarrantyTitle =
123
+ `${t('MyOrderPage:carPrice')} ${t('MyOrderPage:incWarranty', { warrantyPackage, warrantyPeriod })}`;
124
+ return carPriceIncWarrantyTitle;
125
+ };
126
+
127
+ const renderRequestedCars = (cars: any[] = []) => {
76
128
  return (
77
129
  <>
78
- {!!orderedCars && orderedCars.map((orderedCar: any, index: number) => {
79
- const { car: { _id } } = orderedCar;
80
- const { car: { mainData: { make, model, subModel } } } = orderedCar;
81
- const { car: { metaData: { mainImageId } }} = orderedCar;
82
- const {
83
- buyingType,
84
- selfPickup,
85
- paybackPeriod,
86
- monthlyInstallment,
87
- status,
88
- request,
89
- registration,
90
- currentSalesPrice,
91
- deposit,
92
- preparationCost,
93
- licensePlateCost,
94
- registrationCost,
95
- transportationCost,
96
- customerAddress,
97
- deliveryAddress
98
- } = orderedCar;
99
-
100
- const additionalOrderData = {
101
- addressData: [
102
- ...customerAddress ? [{ label: t('MyOrderPage:billingAddress'), value: getTransformAddressToString(customerAddress) }] : [],
103
- ...deliveryAddress ? [{ label: t('MyOrderPage:vehicleDelivery'), value: getTransformAddressToString(deliveryAddress) }] : []
104
- ],
105
- carPriceData: [
106
- ...currentSalesPrice ? [getDataPriceItem(currentSalesPrice, t('MyOrderPage:carPrice'))] : [],
107
- ...preparationCost ? [getDataPriceItem(preparationCost, t('MyOrderPage:preparationCost'))] : [],
108
- ...registrationCost ? [getDataPriceItem(registrationCost, t('MyOrderPage:vehicleRegistration'))] : [],
109
- ...licensePlateCost ? [getDataPriceItem(licensePlateCost, t('MyOrderPage:licensePlates'))] : [],
110
- ...transportationCost ? [getDataPriceItem(transportationCost, t('MyOrderPage:delivery'))] : [],
111
- ...buyingType !== 'buy' ? [
112
- ...monthlyInstallment ? [
113
- {
114
- label: t(`MyOrderPage:${buyingType}Rate`),
115
- value: t('MyOrderPage:monthlyInstallment', { monthlyInstallment: getFormattedPrice(monthlyInstallment, '$,.2f', '', '€') })
116
- }] : [],
117
- ...paybackPeriod ? [{ label: t('MyOrderPage:runningTime'), value: t('MyOrderPage:paybackPeriod', { paybackPeriod })}] : [],
118
- ...deposit ? [getDataPriceItem(deposit, t('MyOrderPage:deposit'))] : []
119
- ] : []
120
- ],
121
- overallRate: {
122
- label: t('MyOrderPage:yourOverallRate'),
123
- value: buyingType === 'buy' ? currentSalesPrice : monthlyInstallment
124
- }
125
- };
126
-
127
- const additionalOrderInfoProps = {
128
- t,
129
- additionalOrderData,
130
- redirectToUrl,
131
- buyingType
132
- };
133
-
134
- const imageUrl = getSupportedImageFormat(_id, mainImageId, 'small');
135
-
136
- const orderStatusCarProps = {
137
- make,
138
- model,
139
- subModel,
140
- buyingType,
141
- imageUrl,
142
- selfPickup,
143
- paybackPeriod,
144
- monthlyInstallment,
145
- status,
146
- t,
147
- request,
148
- registration,
149
- currentSalesPrice,
150
- onClick: () => onDetailsClick(_id)
151
- };
130
+ {!!cars && cars.map((orderedCarData: any, index: number) => {
131
+ if (orderedCarData && typeof orderedCarData.car === 'object') {
132
+ const orderedCar = { ...defaultCarProps, ...orderedCarData };
133
+ const { car: { _id } } = orderedCar;
134
+ const { car: { mainData: { make, model, subModel } } } = orderedCar;
135
+ const { car: { metaData: { mainImageId } } } = orderedCar;
136
+ const {
137
+ buyingType,
138
+ selfPickup,
139
+ paybackPeriod,
140
+ monthlyInstallment,
141
+ status,
142
+ request,
143
+ registration,
144
+ currentSalesPrice,
145
+ totalPrice,
146
+ deposit,
147
+ preparationCost,
148
+ licensePlateCost,
149
+ registrationCost,
150
+ transportationCost,
151
+ customerAddress,
152
+ deliveryAddress,
153
+ firstRate,
154
+ paymentProtectionInsuranceCost,
155
+ wonStatus,
156
+ warranty,
157
+ deliveryDate,
158
+ isLicensePlateFee,
159
+ delivery,
160
+ extrasSumCost
161
+ } = orderedCar;
152
162
 
153
- const title = <span>
154
- {t('orderStatus.title')}:&nbsp;
155
- <span className={styles.orderStatus}>{t(`orderStatus.${status}`)}</span>
156
- </span>;
163
+ const transformedDeliveryDate = !!deliveryDate ? `${t('MyOrderPage:deliveredOn')} ${fromUTCToDateString(deliveryDate)}` : null;
157
164
 
158
- return (
159
- <DashboardSection key={index} title={title}>
160
- <OrderStatusCar { ...orderStatusCarProps } />
161
- {withAdditionalInfo ? <AdditionalOrderInfo { ...additionalOrderInfoProps } /> : null}
162
- </DashboardSection>
163
- );
165
+ const currentSalesPriceWithWarranty = !!warranty && !!warranty.warrantyCost ? currentSalesPrice + warranty.warrantyCost : currentSalesPrice;
166
+
167
+ const additionalOrderData = {
168
+ addressData: [
169
+ ...customerAddress ? [{ label: t('MyOrderPage:billingAddress'), value: getTransformAddressToString(customerAddress) }] : [],
170
+ ...deliveryAddress ? [{ label: t('MyOrderPage:vehicleDelivery'), value: selfPickup ? t('MyOrderPage:selfPickup') : getTransformAddressToString(deliveryAddress) }] : []
171
+ ],
172
+ carPriceData: [
173
+ ...currentSalesPrice ? [getDataPriceItem(currentSalesPriceWithWarranty, carPriceWithWarrantyTitle(warranty))] : [],
174
+ ...preparationCost ? [getDataPriceItem(preparationCost, t('MyOrderPage:preparationCost'))] : [],
175
+ ...extrasSumCost ? [getDataPriceItem(extrasSumCost, t('MyOrderPage:extrasSumCost'))] : [],
176
+ ...registrationCost && registration ? [getDataPriceItem(registrationCost, t('MyOrderPage:vehicleRegistration'))] : [],
177
+ ...licensePlateCost && isLicensePlateFee ? [getDataPriceItem(licensePlateCost, t('MyOrderPage:licensePlates'))] : [],
178
+ ...!!transportationCost && delivery ? [getDataPriceItem(transportationCost, t('MyOrderPage:delivery'))] : [],
179
+ ...paymentProtectionInsuranceCost ? [getDataPriceItem(paymentProtectionInsuranceCost, t('MyOrderPage:paymentProtectionInsuranceCost'))]: [],
180
+ ...firstRate ? [getDataPriceItem(firstRate, t('MyOrderPage:firstRate'))] : [],
181
+ ...buyingType !== 'buy' ? [
182
+ ...monthlyInstallment ? [
183
+ {
184
+ label: t(`MyOrderPage:${buyingType}Rate`),
185
+ value: t('MyOrderPage:monthlyInstallment', { monthlyInstallment: getFormattedPrice(monthlyInstallment, '$,.2f', '', '€') })
186
+ }] : [],
187
+ ...paybackPeriod ? [{ label: t('MyOrderPage:runningTime'), value: t('MyOrderPage:paybackPeriod', { paybackPeriod }) }] : [],
188
+ ...deposit ? [getDataPriceItem(deposit, t('MyOrderPage:deposit'))] : []
189
+ ] : []
190
+ ],
191
+ overallRate: {
192
+ label: (buyingType === 'buy' || wonStatus === 'won') ? t('MyOrderPage:yourOverallPrice') : t('MyOrderPage:yourOverallRate'),
193
+ value: buyingType === 'buy' || wonStatus === 'won' ? totalPrice : monthlyInstallment
194
+ }
195
+ };
196
+
197
+ const additionalOrderInfoProps = {
198
+ t,
199
+ additionalOrderData,
200
+ redirectToUrl,
201
+ buyingType
202
+ };
203
+
204
+ const imageUrl = getSupportedImageFormat(_id, mainImageId, 'small');
205
+
206
+ const orderStatusCarProps = {
207
+ make,
208
+ model,
209
+ subModel,
210
+ buyingType,
211
+ imageUrl,
212
+ selfPickup,
213
+ paybackPeriod,
214
+ monthlyInstallment,
215
+ status,
216
+ t,
217
+ request,
218
+ registration,
219
+ currentSalesPrice,
220
+ onClick: () => onDetailsClick(_id),
221
+ additionalOrderInfoProps,
222
+ wonStatus,
223
+ transformedDeliveryDate,
224
+ delivery
225
+ };
226
+
227
+ const title = wonStatus === 'pending' ? <span>
228
+ {t('orderStatus.title')}:&nbsp;
229
+ <span className={styles.orderStatus}>{t(`orderStatus.${status}`)}</span>
230
+ </span>
231
+ : <span>{t('orderStatus.myOrder')}</span>;
232
+
233
+ return (
234
+ <DashboardSection key={index} title={title}>
235
+ <OrderStatusCar { ...orderStatusCarProps } />
236
+ {withAdditionalInfo && wonStatus === 'pending' ?
237
+ <AdditionalOrderInfo { ...additionalOrderInfoProps } />
238
+ : null
239
+ }
240
+ </DashboardSection>
241
+ );
242
+ }
164
243
  })}
165
244
  </>
166
245
  );
@@ -168,11 +247,14 @@ const OrderStatusSection = ({
168
247
 
169
248
  return (
170
249
  <>
171
- {isFetching ?
250
+ {isFetching ?
172
251
  <div className={styles.skeletonBlock}>
173
252
  <Skeleton animation='wave' variant='rectangular' width='100%' />
174
253
  </div>
175
- : renderRequestedCars()
254
+ : <>
255
+ {renderRequestedCars(orderedCars)}
256
+ {renderRequestedCars(wonCars)}
257
+ </>
176
258
  }
177
259
  </>
178
260
  );
@@ -1,4 +1,4 @@
1
- import React, { useEffect } from 'react';
1
+ import React from 'react';
2
2
  import styles from './RequestedCarsSection.styl';
3
3
 
4
4
  import Slider from 'react-slick';
@@ -10,11 +10,8 @@ import { getFormattedPrice } from '../../../../framework/utils/CommonUtils';
10
10
  // import { history } from '../../../../../AppRouter';
11
11
  import Button from '../../../_common/Button/Button';
12
12
 
13
- interface IWithRouter {
14
- children?: JSX.Element;
15
- }
16
13
  // tslint:disable-next-line:interface-name
17
- interface TFunction {
14
+ interface ITFunction {
18
15
  <T = string>(key: string, options?: object): T;
19
16
  <T = string>(keys: string[], options?: object): T;
20
17
  }
@@ -23,7 +20,7 @@ interface IRequestedCarsSection {
23
20
  redirectToCar: (id: string) => void;
24
21
  getSupportedImageFormat: (id: string, mainImageId: string, size: 'small' | 'medium' | 'large') => string;
25
22
  requestedCars: any[];
26
- t: TFunction;
23
+ t: ITFunction;
27
24
  LinkRouter:any;
28
25
  // initHotjar:() => void;
29
26
  }
@@ -39,7 +36,7 @@ const RequestedCarsSection = ({ t, getSupportedImageFormat, requestedCars, redir
39
36
  const renderItems = () => {
40
37
  if (requestedCars && requestedCars.length > 0) {
41
38
  const carsCard = requestedCars.map((car) => {
42
- if (car && car.car) {
39
+ if (car && car.car.mainData && car.car.metaData) {
43
40
  const { car: { mainData: { make, model, subModel } } } = car;
44
41
  const { car: { _id, metaData: { mainImageId } } } = car;
45
42
  const { buyingType, paybackPeriod, monthlyInstallment, request, currentSalesPrice } = car;
@@ -123,4 +120,5 @@ const RequestedCarsSection = ({ t, getSupportedImageFormat, requestedCars, redir
123
120
  </>
124
121
  );
125
122
  };
123
+
126
124
  export default RequestedCarsSection;
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import React, { useEffect, useRef, useCallback } from 'react';
2
2
  import classnames from 'classnames';
3
3
  import FormattedNumber from '../../FormattedNumber/FormattedNumber';
4
4
  import styles from './VehicleFormattedPrice.styl';
@@ -23,6 +23,7 @@ export interface IVehiclePriceProps {
23
23
  size?: 'small' | 'semimedium' | 'medium' | 'large';
24
24
  disableStyles?: boolean;
25
25
  disablePrice?: boolean;
26
+ dynamicFontSize?: string;
26
27
 
27
28
  // FormattedNumber props
28
29
  toRound?: boolean;
@@ -34,13 +35,36 @@ export interface IVehiclePriceProps {
34
35
  }
35
36
 
36
37
  const VehicleFormattedPrice: React.FunctionComponent<IVehiclePriceProps> = (props) => {
38
+ const textRef = useRef(null);
39
+
40
+ const updateFontSize = useCallback(() => {
41
+ if (price && dynamicFontSize && textRef.current) {
42
+ const textWidth = textRef.current.getBoundingClientRect().width;
43
+ const priceLength = Math.round(price).toString().length;
44
+ if (textWidth > 110) {
45
+ if (dynamicFontSize === 'small') {
46
+ const newSize = Math.min(60, 165 / priceLength);
47
+ textRef.current.style.fontSize = `${newSize}px`;
48
+ } else {
49
+ const newSize = Math.min(60, (165 / priceLength) + 6);
50
+ textRef.current.style.fontSize = `${newSize}px`;
51
+ }
52
+
53
+ }
54
+ }
55
+ }, [props.price, props.dynamicFontSize]);
56
+
57
+ useEffect(() => {
58
+ updateFontSize();
59
+ }, [updateFontSize]);
60
+
37
61
  function renderUnit(): React.ReactNode {
38
62
  const { postfix, unit, unitClassName } = props;
39
63
  return (
40
- <span className={classnames(styles.unit, unitClassName)}>
41
- &nbsp;{unit}
42
- {postfix ? renderPostfix() : ''}
43
- </span>);
64
+ <span className={classnames(styles.unit, unitClassName)}>
65
+ &nbsp;{unit}
66
+ {postfix ? renderPostfix() : ''}
67
+ </span>);
44
68
  }
45
69
 
46
70
  function renderUnitMonthly(): React.ReactNode {
@@ -78,7 +102,7 @@ const VehicleFormattedPrice: React.FunctionComponent<IVehiclePriceProps> = (prop
78
102
  // FormattedNumber props
79
103
  const {
80
104
  unit, sub, numbersAfterDot, toRound, numberContainerClassName,
81
- afterCommaClassName, beforeCommaClassName, disableFormatting, disablePrice
105
+ afterCommaClassName, beforeCommaClassName, disableFormatting, disablePrice, dynamicFontSize
82
106
  } = props;
83
107
 
84
108
  const decimalsClass = classnames(afterCommaClassName, styles.decimals);
@@ -94,6 +118,7 @@ const VehicleFormattedPrice: React.FunctionComponent<IVehiclePriceProps> = (prop
94
118
  disableFormatting,
95
119
  numbersAfterDot,
96
120
  toRound,
121
+ dynamicFontSize,
97
122
  beforeCommaClassName,
98
123
  value: price,
99
124
  className: numberContainerClassName,
@@ -101,7 +126,7 @@ const VehicleFormattedPrice: React.FunctionComponent<IVehiclePriceProps> = (prop
101
126
  };
102
127
 
103
128
  return (
104
- <span className={containerClass}>
129
+ <span className={containerClass} ref={textRef}>
105
130
  {<FormattedNumber {...formattedNumberProps} />}
106
131
  {(unit && !monthly) && renderUnit()}
107
132
  {(monthly && unit) && renderUnitMonthly()}
@@ -125,6 +150,7 @@ VehicleFormattedPrice.defaultProps = {
125
150
  unitClassName: '',
126
151
  postfixClassName: '',
127
152
  subClassName: '',
153
+ dynamicFontSize: '',
128
154
  sub: '',
129
155
  // FormattedNumber props
130
156
  toRound: false,
@@ -1,7 +1,7 @@
1
1
  @import '../../theme/mixins.styl'
2
2
 
3
3
  .detailedInfo
4
- padding: 15px 15px 7px 15px
4
+ padding: 15px 15px 0px 15px
5
5
  width: 100%
6
6
  position: relative
7
7
  background-color: white
@@ -26,4 +26,12 @@
26
26
 
27
27
  .highlights
28
28
  padding-top: 0;
29
- margin-top: 6px;
29
+ margin-top: 6px;
30
+
31
+ .skeletonInfoContainer:not(:first-child)
32
+ margin-top: 6px
33
+
34
+ .skeletonInfoContainer
35
+ [class*='MuiSkeleton-root']
36
+ transform: none
37
+ height: 309px
@@ -9,6 +9,10 @@ import styles from './VehicleDetailedSidebar.styl';
9
9
  import { vehicleProps } from '../../locales/data';
10
10
  import { IVehicleDetailedSidebarProps } from '../../framework/types/types';
11
11
  import DealerInfo from '../Alternative/DealerInfo';
12
+ import { Skeleton } from '@mui/material';
13
+
14
+ declare global {
15
+ }
12
16
 
13
17
  const VehicleDetailedSidebar: FunctionComponent<IVehicleDetailedSidebarProps> = (props) => {
14
18
  const {
@@ -24,9 +28,9 @@ const VehicleDetailedSidebar: FunctionComponent<IVehicleDetailedSidebarProps> =
24
28
  setActiveTab,
25
29
  carLoaded,
26
30
  originUrl,
27
- // isAlternative,
28
31
  infoSections,
29
- onCurrentSalesPriceChange
32
+ onCurrentSalesPriceChange,
33
+ isFetching
30
34
  } = props;
31
35
  const [offerBlockOpen, setOfferBlockOpen] = useState(false);
32
36
  const onAdjustRateClick = () => setOfferBlockOpen(!offerBlockOpen);
@@ -129,14 +133,15 @@ const VehicleDetailedSidebar: FunctionComponent<IVehicleDetailedSidebarProps> =
129
133
 
130
134
  return (
131
135
  <>
132
- <div className={styles.detailedInfo}>
133
- <Title {...titleProps} />
134
- <Price {...priceProps} />
135
- <Price {...priceProps} isSticky={true} />
136
- {props.children}
137
- </div>
138
- <div>
139
- {isAlternativeType &&
136
+ {!isFetching ? <div className={styles.detailedInfo}>
137
+ <Title {...titleProps} />
138
+ <Price {...priceProps} />
139
+ <Price {...priceProps} isSticky={true} />
140
+ {}
141
+ {props.children}
142
+ </div> : <div className={styles.skeletonInfoContainer}><Skeleton /></div>
143
+ }
144
+ {!isFetching ? <div>{isAlternativeType &&
140
145
  <DealerInfo
141
146
  t={t}
142
147
  infoSections={infoSections}
@@ -146,10 +151,12 @@ const VehicleDetailedSidebar: FunctionComponent<IVehicleDetailedSidebarProps> =
146
151
  currentSalesPrice={currentSalesPrice}
147
152
  onCurrentSalesPriceChange={onCurrentSalesPriceChange}
148
153
  />}
149
- </div>
150
- <Hidden xs sm md>
151
- <div className={`${styles.detailedInfo} ${styles.highlights}`}>{carLoaded && <Properties {...propertiesProps} />}</div>
152
- </Hidden>
154
+ </div> : <div className={styles.skeletonInfoContainer}><Skeleton /></div>
155
+ }
156
+ {!isFetching ? <Hidden xs sm md>
157
+ <div className={`${styles.detailedInfo} ${styles.highlights}`}>{carLoaded && <Properties {...propertiesProps} />}</div>
158
+ </Hidden> : <div className={styles.skeletonInfoContainer}><Skeleton /></div>
159
+ }
153
160
  </>
154
161
  );
155
162
  };
@@ -20,4 +20,8 @@
20
20
  transition: 0.45s;
21
21
  transition-timing-function: ease-out;
22
22
  transform: translateY(0);
23
- opacity: 1;
23
+ opacity: 1;
24
+ box-shadow: 0px 5px 12px #4c4e64d1;
25
+
26
+ .tabContent
27
+ padding-bottom: 7px
@@ -21,7 +21,8 @@ const Price: React.FunctionComponent<IVehicleDetailedSidebarPriceProps> = ({
21
21
  const tabsProps = {
22
22
  tabsTitles,
23
23
  onTabPriceSelect,
24
- priceTabActiveIndex
24
+ priceTabActiveIndex,
25
+ tabContentClassName: styles.tabContent
25
26
  };
26
27
 
27
28
  return (
@@ -1,7 +1,7 @@
1
1
  @import '../../../theme/mixins.styl';
2
2
 
3
3
  .newFinancingPriceWrapper
4
- width: 100%
4
+ width: 159px
5
5
  display: flex
6
6
  align-items: flex-start;
7
7
  color: $lightGreen;
@@ -10,7 +10,7 @@
10
10
  font-size: 60px;
11
11
  display flex;
12
12
  line-height: .8;
13
- margin 8px 0 0 16px;
13
+ margin 8px 0 0 10px;
14
14
  [class^="VehicleFormattedPrice__decimals"], [class^="VehicleFormattedPrice__unit"]
15
15
  font-size: 16px !important;
16
16
  transform: none !important;
@@ -18,13 +18,14 @@
18
18
  .tabContentPaddingForBuy
19
19
  .newFinancingPriceWrapper
20
20
  [class*="VehicleFormattedPrice__large"]
21
- font-size: 40px;
22
21
  margin-left: 0;
23
22
  +media-phone-only()
24
23
  [class*="VehicleFormattedPrice__large"]
25
- font-size: 45px;
26
24
  margin-left: 3px;
27
25
 
26
+
27
+
28
+
28
29
  .tabContentPadding
29
30
  padding: 10px 10px 10px 10px;
30
31
  flex-direction: row
@@ -110,4 +111,14 @@
110
111
  transform: rotate(180deg);
111
112
 
112
113
  .wrapper
113
- padding-right: 15px;
114
+ +media-tablet-landscape-up()
115
+ padding-right: 15px;
116
+
117
+ .priceFontSizeSmall
118
+ .priceInfoLabel
119
+ margin-top:8px!important
120
+
121
+
122
+ .tabContentPaddingForBuy.priceFontSizeSmall
123
+ .financingPriceItem
124
+ display: flex;