@bytebrand/fe-ui-core 4.2.67 → 4.2.69
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/__tests__/components/UserDasboardPage/sections/OrderStatusSection/OrderStatusCar.test.tsx +4 -4
- package/__tests__/components/UserDasboardPage/sections/RequestedCarsSection/RequestedCarsSection.test.tsx +116 -0
- package/package.json +1 -1
- package/setupTests.js +8 -1
- package/source/components/UserDashboardPage/sections/OrderStatusSection/OrderStatusCar.tsx +2 -0
- package/source/components/UserDashboardPage/sections/RequestedCarsSection/RequestedCarsSection.story.js +97 -0
- package/source/components/UserDashboardPage/sections/RequestedCarsSection/RequestedCarsSection.styl +145 -0
- package/source/components/UserDashboardPage/sections/RequestedCarsSection/RequestedCarsSection.tsx +126 -0
- package/source/components/UserDashboardPage/sections/RequestedCarsSection/SupportSection.styl +47 -0
- package/source/components/UserDashboardPage/sections/RequestedCarsSection/SupportSection.tsx +32 -0
- package/source/components/_common/Modal/modals/PreviewCookieModal/PreviewCookieModal.tsx +1 -1
- package/source/components/_common/OfferRequestButtonWrapper/OfferRequestButtonWrapper.tsx +1 -0
- package/source/framework/utils/CommonUtils.ts +1 -0
package/__tests__/components/UserDasboardPage/sections/OrderStatusSection/OrderStatusCar.test.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { render, fireEvent } from '@testing-library/react'
|
|
2
|
+
import { render, fireEvent } from '@testing-library/react';
|
|
3
3
|
import OrderStatusCar from '../../../../../source/components/UserDashboardPage/sections/OrderStatusSection/OrderStatusCar';
|
|
4
4
|
|
|
5
5
|
const t = (phrase: string | string[], options: object) => {
|
|
@@ -8,7 +8,7 @@ const t = (phrase: string | string[], options: object) => {
|
|
|
8
8
|
return `${phrase} ${value}`;
|
|
9
9
|
}
|
|
10
10
|
return phrase;
|
|
11
|
-
}
|
|
11
|
+
};
|
|
12
12
|
|
|
13
13
|
const mockProps = {
|
|
14
14
|
t,
|
|
@@ -25,7 +25,7 @@ const mockProps = {
|
|
|
25
25
|
registration: false,
|
|
26
26
|
currentSalesPrice: 30000,
|
|
27
27
|
onClick: jest.fn()
|
|
28
|
-
}
|
|
28
|
+
};
|
|
29
29
|
|
|
30
30
|
describe('OrderStatusCar', () => {
|
|
31
31
|
it('renders OrderStatusCar component without error', () => {
|
|
@@ -45,7 +45,7 @@ describe('OrderStatusCar', () => {
|
|
|
45
45
|
|
|
46
46
|
it('should display correct car image', () => {
|
|
47
47
|
const { getByTestId } = render(<OrderStatusCar {...mockProps}/>);
|
|
48
|
-
const carImage = getByTestId('car-image')
|
|
48
|
+
const carImage = getByTestId('car-image');
|
|
49
49
|
expect(carImage).toHaveAttribute('src', mockProps.imageUrl);
|
|
50
50
|
});
|
|
51
51
|
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { fireEvent, getByTestId, render, screen } from '@testing-library/react';
|
|
2
|
+
// import userEvent from '@testing-library/user-event';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import RequestedCarsSection from '../../../../../source/components/UserDashboardPage/sections/RequestedCarsSection/RequestedCarsSection';
|
|
5
|
+
|
|
6
|
+
const t = (phrase: string | string[], options: object) => {
|
|
7
|
+
if (options) {
|
|
8
|
+
const value = Object.values(options).map((option) => option);
|
|
9
|
+
return `${phrase} ${value}`;
|
|
10
|
+
}
|
|
11
|
+
return phrase;
|
|
12
|
+
};
|
|
13
|
+
interface IWithRouter {
|
|
14
|
+
children?: JSX.Element;
|
|
15
|
+
link?: string;
|
|
16
|
+
}
|
|
17
|
+
const LinkRouter = ({ children, link } :IWithRouter) => {
|
|
18
|
+
return (
|
|
19
|
+
<a href={link} >
|
|
20
|
+
{ children }
|
|
21
|
+
</a>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const requestedCars = [
|
|
26
|
+
{
|
|
27
|
+
car: {
|
|
28
|
+
_id: '28121b1a-398c-4e9c-9097-51be545817c5',
|
|
29
|
+
mainData: {
|
|
30
|
+
make: 'Volvo',
|
|
31
|
+
model: 'CX95',
|
|
32
|
+
subModel: 'Test123'
|
|
33
|
+
},
|
|
34
|
+
metaData: {
|
|
35
|
+
mainImageId: 'RQ_mHNek5hIk'
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
buyingType: 'leasing',
|
|
39
|
+
selfPickup: true,
|
|
40
|
+
paybackPeriod: 24,
|
|
41
|
+
monthlyInstallment: 2000,
|
|
42
|
+
request: '010203555',
|
|
43
|
+
currentSalesPrice: 50000
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
car: {
|
|
47
|
+
_id: '1234567890',
|
|
48
|
+
mainData: {
|
|
49
|
+
make: 'Volvo',
|
|
50
|
+
model: 'CX90',
|
|
51
|
+
subModel: 'Test155'
|
|
52
|
+
},
|
|
53
|
+
metaData: {
|
|
54
|
+
mainImageId: 'main image id'
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
buyingType: 'financing',
|
|
58
|
+
selfPickup: false,
|
|
59
|
+
paybackPeriod: 24,
|
|
60
|
+
monthlyInstallment: 1000,
|
|
61
|
+
request: '010203123',
|
|
62
|
+
currentSalesPrice: 20000
|
|
63
|
+
}
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
const mockProps = {
|
|
67
|
+
t,
|
|
68
|
+
requestedCars,
|
|
69
|
+
getSupportedImageFormat: jest.fn(),
|
|
70
|
+
redirectToCar: jest.fn(),
|
|
71
|
+
// tslint:disable-next-line:object-shorthand-properties-first
|
|
72
|
+
LinkRouter
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
describe('RequestedCarsSection', () => {
|
|
76
|
+
it('renders correctly', () => {
|
|
77
|
+
const { container } = render(<RequestedCarsSection {...mockProps} />);
|
|
78
|
+
expect(container).toBeInTheDocument();
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it('should display correct car data', () => {
|
|
82
|
+
const { container } = render(<RequestedCarsSection {...mockProps} />);
|
|
83
|
+
const requestedCars = mockProps.requestedCars;
|
|
84
|
+
requestedCars.forEach((element) => {
|
|
85
|
+
expect(container).toHaveTextContent(element.buyingType);
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
it('should display correct car make and model', () => {
|
|
89
|
+
const { getByText } = render(<RequestedCarsSection {...mockProps} />);
|
|
90
|
+
const requestedCars = mockProps.requestedCars;
|
|
91
|
+
requestedCars.forEach((element) => {
|
|
92
|
+
expect(getByText(`${element.car.mainData.make} ${element.car.mainData.model}`)).toBeInTheDocument();
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
it('should display correct car subModel', () => {
|
|
96
|
+
const { getByText } = render(<RequestedCarsSection {...mockProps} />);
|
|
97
|
+
const requestedCars = mockProps.requestedCars;
|
|
98
|
+
requestedCars.forEach((element) => {
|
|
99
|
+
expect(getByText(`${element.car.mainData.subModel}`)).toBeInTheDocument();
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
it('should display correct car request number', () => {
|
|
103
|
+
const { getByText } = render(<RequestedCarsSection {...mockProps} />);
|
|
104
|
+
const requestedCars = mockProps.requestedCars;
|
|
105
|
+
requestedCars.forEach((element) => {
|
|
106
|
+
expect(getByText(`${element.request}`)).toBeInTheDocument();
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
it('calls redirectToCar with car ID on button click', () => {
|
|
110
|
+
const { getByTestId } = render(<RequestedCarsSection {...mockProps} />);
|
|
111
|
+
const carWrapper = getByTestId(mockProps.requestedCars[0].car._id);
|
|
112
|
+
fireEvent.click(carWrapper);
|
|
113
|
+
expect(mockProps.redirectToCar).toHaveBeenCalledTimes(1);
|
|
114
|
+
expect(mockProps.redirectToCar).toHaveBeenCalledWith(mockProps.requestedCars[0].car._id); // assert the correct car ID
|
|
115
|
+
});
|
|
116
|
+
});
|
package/package.json
CHANGED
package/setupTests.js
CHANGED
|
@@ -4,10 +4,12 @@ import OrderStatusCard from './OrderStatusCard';
|
|
|
4
4
|
import Image from '../../../_common/Image/Image';
|
|
5
5
|
import { getFormattedPrice } from '../../../../framework/utils/CommonUtils';
|
|
6
6
|
|
|
7
|
+
// tslint:disable-next-line:interface-name
|
|
7
8
|
interface TFunction {
|
|
8
9
|
<T = string>(key: string, options?: object): T;
|
|
9
10
|
<T = string>(keys: string[], options?: object): T;
|
|
10
11
|
}
|
|
12
|
+
// tslint:disable-next-line:interface-name
|
|
11
13
|
interface IOrderStatusCar {
|
|
12
14
|
make?: string;
|
|
13
15
|
model?: string;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { storiesOf } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import RequestedCarsSection from './RequestedCarsSection';
|
|
5
|
+
|
|
6
|
+
const requestedCars = [
|
|
7
|
+
{
|
|
8
|
+
car: {
|
|
9
|
+
_id: '1234567892',
|
|
10
|
+
mainData: {
|
|
11
|
+
make: 'Volvo',
|
|
12
|
+
model: 'CX90',
|
|
13
|
+
subModel: 'sub model',
|
|
14
|
+
},
|
|
15
|
+
metaData: {
|
|
16
|
+
mainImageId: 'main image id'
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
buyingType: 'leasing',
|
|
20
|
+
selfPickup: true,
|
|
21
|
+
paybackPeriod: 24,
|
|
22
|
+
monthlyInstallment: 1000,
|
|
23
|
+
status: 'selector_status_preparation',
|
|
24
|
+
request: '010203',
|
|
25
|
+
registration: true,
|
|
26
|
+
currentSalesPrice: 20000
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
car: {
|
|
30
|
+
_id: '1234567890',
|
|
31
|
+
mainData: {
|
|
32
|
+
make: 'Volvo',
|
|
33
|
+
model: 'CX90',
|
|
34
|
+
subModel: 'sub model',
|
|
35
|
+
},
|
|
36
|
+
metaData: {
|
|
37
|
+
mainImageId: 'main image id'
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
buyingType: 'financing',
|
|
41
|
+
selfPickup: false,
|
|
42
|
+
paybackPeriod: 24,
|
|
43
|
+
monthlyInstallment: 1000,
|
|
44
|
+
status: 'selector_status_registration',
|
|
45
|
+
request: '010203',
|
|
46
|
+
registration: false,
|
|
47
|
+
currentSalesPrice: 20000
|
|
48
|
+
}
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
const translates = {
|
|
52
|
+
'DealerDashboardPage:buyingType.buy': 'buy',
|
|
53
|
+
'DealerDashboardPage:buyingType.leasing': 'leasing',
|
|
54
|
+
'DealerDashboardPage:buyingType.financing': 'financing',
|
|
55
|
+
'DealerDashboardPage:paybackPeriod': 'payback period',
|
|
56
|
+
'DealerDashboardPage:currentSalesPrice': 'current sales price',
|
|
57
|
+
'DealerDashboardPage:monthlyInstallment': 'monthly installment',
|
|
58
|
+
'DealerDashboardPage:requestedCars.requestedCarsTitle':'Requested cars',
|
|
59
|
+
'DealerDashboardPage:requestedCars.toOffer': 'To offer',
|
|
60
|
+
'DealerDashboardPage:requestedCars.customerService':'Support',
|
|
61
|
+
'DealerDashboardPage:requestedCars.customerServiceText':'Do you have questions about your desired vehicle or about car financing, delivery or registration? Please use the contact form and let us know your question. We will get back to you as soon as possible. Thank you very much.',
|
|
62
|
+
'DealerDashboardPage:requestedCars.contact':'Contact'
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const t = (phrase, options) => {
|
|
66
|
+
if (options) {
|
|
67
|
+
console.log('qqqq options ====', options);
|
|
68
|
+
const value = Object.values(options).map((option) => option)
|
|
69
|
+
return `${translates[phrase]} ${value}`;
|
|
70
|
+
}
|
|
71
|
+
return translates[phrase];
|
|
72
|
+
}
|
|
73
|
+
const LinkRouter = ({ children, link }) => {
|
|
74
|
+
return (
|
|
75
|
+
<a href={link} >
|
|
76
|
+
{ children }
|
|
77
|
+
</a>
|
|
78
|
+
);
|
|
79
|
+
};
|
|
80
|
+
const initHotjar = () => {
|
|
81
|
+
console.log('Hotjar works')
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const props = {
|
|
85
|
+
t,
|
|
86
|
+
redirectToCar: (id) => console.log(`redirect to car with id: ${id}`),
|
|
87
|
+
getSupportedImageFormat: (id, mainImageId, size) => 'https://images.autode-dev.de/carimage/28121b1a-398c-4e9c-9097-51be545817c5/RQ_mHNek5hIk/small-cached.webp',
|
|
88
|
+
requestedCars,
|
|
89
|
+
LinkRouter,
|
|
90
|
+
initHotjar
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
storiesOf('userDashboard', module)
|
|
95
|
+
.add('RequestedCarsSection', () => (
|
|
96
|
+
<RequestedCarsSection {...props} />
|
|
97
|
+
));
|
package/source/components/UserDashboardPage/sections/RequestedCarsSection/RequestedCarsSection.styl
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
@import '../../../../theme/mixins.styl'
|
|
2
|
+
|
|
3
|
+
.requestedCarsSectionWrapper
|
|
4
|
+
border-right: 1px solid rgba(76, 78, 100, 0.12)
|
|
5
|
+
width: 219px!important
|
|
6
|
+
padding: 28px 10px 21px
|
|
7
|
+
cursor: pointer
|
|
8
|
+
display: flex!important;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
height: 305px;
|
|
11
|
+
justify-content: space-between;
|
|
12
|
+
+media-tablet-landscape-down()
|
|
13
|
+
width: 100% !important;
|
|
14
|
+
padding: 28px 10px 21px;
|
|
15
|
+
|
|
16
|
+
.carsContainer
|
|
17
|
+
display: flex;
|
|
18
|
+
+media-tablet-landscape-down()
|
|
19
|
+
width: 93vw;
|
|
20
|
+
overflow-x: scroll;
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
.model
|
|
24
|
+
font-style: normal;
|
|
25
|
+
font-weight: 500;
|
|
26
|
+
font-size: 20px;
|
|
27
|
+
line-height: 24px;
|
|
28
|
+
text-align: center;
|
|
29
|
+
letter-spacing: 0.15px;
|
|
30
|
+
color: rgba(76, 78, 100, 0.87);
|
|
31
|
+
max-height: 48px
|
|
32
|
+
display: flex
|
|
33
|
+
justify-content: center
|
|
34
|
+
-webkit-line-clamp: 1;
|
|
35
|
+
display: -webkit-box;
|
|
36
|
+
-webkit-box-orient: vertical;
|
|
37
|
+
overflow: hidden;
|
|
38
|
+
height: 26px;
|
|
39
|
+
|
|
40
|
+
.subModel
|
|
41
|
+
font-style: normal;
|
|
42
|
+
font-weight: 500;
|
|
43
|
+
font-size: 12px;
|
|
44
|
+
line-height: 16px;
|
|
45
|
+
text-align: center;
|
|
46
|
+
letter-spacing: 0.15px;
|
|
47
|
+
color: rgba(76, 78, 100, 0.87);
|
|
48
|
+
width: 100%;
|
|
49
|
+
-webkit-line-clamp: 1;
|
|
50
|
+
display: -webkit-box;
|
|
51
|
+
-webkit-box-orient: vertical;
|
|
52
|
+
overflow: hidden;
|
|
53
|
+
height: 16px;
|
|
54
|
+
|
|
55
|
+
.payment
|
|
56
|
+
height: 20px;
|
|
57
|
+
font-style: normal;
|
|
58
|
+
font-weight: 400;
|
|
59
|
+
font-size: 12px;
|
|
60
|
+
line-height: 20px;
|
|
61
|
+
text-align: center;
|
|
62
|
+
letter-spacing: 0.15px;
|
|
63
|
+
color: rgba(76, 78, 100, 0.87);
|
|
64
|
+
+media-tablet-landscape-down()
|
|
65
|
+
height: 40px;
|
|
66
|
+
|
|
67
|
+
.req
|
|
68
|
+
font-style: normal;
|
|
69
|
+
font-weight: 400;
|
|
70
|
+
font-size: 12px;
|
|
71
|
+
line-height: 16px;
|
|
72
|
+
text-align: center;
|
|
73
|
+
letter-spacing: 0.4px;
|
|
74
|
+
color: rgba(76, 78, 100, 0.87);
|
|
75
|
+
|
|
76
|
+
.offerButton
|
|
77
|
+
display: flex;
|
|
78
|
+
justify-content: center;
|
|
79
|
+
margin-top: 8px;
|
|
80
|
+
[class*='MuiButtonBase-root']
|
|
81
|
+
width: 187px
|
|
82
|
+
|
|
83
|
+
.container
|
|
84
|
+
display: flex
|
|
85
|
+
flex-direction: row
|
|
86
|
+
|
|
87
|
+
.defaultLayout
|
|
88
|
+
display: flex
|
|
89
|
+
flex-direction: row
|
|
90
|
+
justify-content: space-around
|
|
91
|
+
+media-tablet-landscape-down()
|
|
92
|
+
width: 100% !important;
|
|
93
|
+
|
|
94
|
+
.image
|
|
95
|
+
max-height: 164px;
|
|
96
|
+
overflow: hidden;
|
|
97
|
+
|
|
98
|
+
.sliderContainer
|
|
99
|
+
width: 720px;
|
|
100
|
+
+media-tablet-landscape-down()
|
|
101
|
+
width: 90vw;
|
|
102
|
+
:global
|
|
103
|
+
.slick-slider
|
|
104
|
+
overflow: hidden
|
|
105
|
+
+media-tablet-landscape-down()
|
|
106
|
+
padding 0;
|
|
107
|
+
.slick-arrow,
|
|
108
|
+
.slick-arrow:focus,
|
|
109
|
+
.slick-arrow:hover
|
|
110
|
+
display: inline-block
|
|
111
|
+
width: 25px
|
|
112
|
+
height: 50px
|
|
113
|
+
z-index: 1
|
|
114
|
+
transition: all 0.2s ease-in-out
|
|
115
|
+
.slick-arrow::before
|
|
116
|
+
display: none
|
|
117
|
+
.click-arrow::before:hover
|
|
118
|
+
background-color: black
|
|
119
|
+
|
|
120
|
+
.slick-arrow::after
|
|
121
|
+
position: absolute
|
|
122
|
+
content: ''
|
|
123
|
+
display: inline-block
|
|
124
|
+
width: inherit
|
|
125
|
+
height: inherit
|
|
126
|
+
top: 50%
|
|
127
|
+
transform: translateY(-50%)
|
|
128
|
+
transform-origin: top center
|
|
129
|
+
background-image: url('../../../../../media/images/slider-arrow-new.svg')
|
|
130
|
+
background-size: cover
|
|
131
|
+
|
|
132
|
+
.slick-next::after
|
|
133
|
+
left: 0px
|
|
134
|
+
|
|
135
|
+
.slick-prev::after
|
|
136
|
+
transform: rotate(180deg) translateY(-50%)
|
|
137
|
+
right: 0
|
|
138
|
+
|
|
139
|
+
.slick-prev
|
|
140
|
+
left: -5px!important
|
|
141
|
+
top:50%!important
|
|
142
|
+
|
|
143
|
+
.slick-next
|
|
144
|
+
right: -5px!important
|
|
145
|
+
top:50%!important
|
package/source/components/UserDashboardPage/sections/RequestedCarsSection/RequestedCarsSection.tsx
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import styles from './RequestedCarsSection.styl';
|
|
3
|
+
|
|
4
|
+
import Slider from 'react-slick';
|
|
5
|
+
import DashboardSection from '../../../containers/DasboardSection/DashboardSection';
|
|
6
|
+
import SupportSection from './SupportSection';
|
|
7
|
+
import Image from '../../../_common/Image/Image';
|
|
8
|
+
import { Hidden, Visible } from 'react-grid-system';
|
|
9
|
+
import { getFormattedPrice } from '../../../../framework/utils/CommonUtils';
|
|
10
|
+
// import { history } from '../../../../../AppRouter';
|
|
11
|
+
import Button from '../../../_common/Button/Button';
|
|
12
|
+
|
|
13
|
+
interface IWithRouter {
|
|
14
|
+
children?: JSX.Element;
|
|
15
|
+
}
|
|
16
|
+
// tslint:disable-next-line:interface-name
|
|
17
|
+
interface TFunction {
|
|
18
|
+
<T = string>(key: string, options?: object): T;
|
|
19
|
+
<T = string>(keys: string[], options?: object): T;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface IRequestedCarsSection {
|
|
23
|
+
redirectToCar: (id: string) => void;
|
|
24
|
+
getSupportedImageFormat: (id: string, mainImageId: string, size: 'small' | 'medium' | 'large') => string;
|
|
25
|
+
requestedCars: any[];
|
|
26
|
+
t: TFunction;
|
|
27
|
+
LinkRouter:any;
|
|
28
|
+
initHotjar:() => void;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const RequestedCarsSection = ({ t, getSupportedImageFormat, requestedCars, redirectToCar, LinkRouter }: IRequestedCarsSection) => {
|
|
32
|
+
const onDetailsClick = (event: React.MouseEvent, carId: string) => {
|
|
33
|
+
redirectToCar(carId);
|
|
34
|
+
event.preventDefault();
|
|
35
|
+
event.stopPropagation();
|
|
36
|
+
// history.push(`/search/vehicle/${carId}`);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const renderItems = () => {
|
|
40
|
+
if (requestedCars && requestedCars.length > 0) {
|
|
41
|
+
const carsCard = requestedCars.map((car) => {
|
|
42
|
+
if (car && car.car) {
|
|
43
|
+
const { car: { mainData: { make, model, subModel } } } = car;
|
|
44
|
+
const { car: { _id, metaData: { mainImageId } } } = car;
|
|
45
|
+
const { buyingType, paybackPeriod, monthlyInstallment, request, currentSalesPrice } = car;
|
|
46
|
+
const imageUrl = getSupportedImageFormat(_id, mainImageId, 'small');
|
|
47
|
+
return (
|
|
48
|
+
<div key={_id} className={styles.requestedCarsSectionWrapper} data-testid={_id} onClick={(e: React.MouseEvent<HTMLDivElement>) => onDetailsClick(e, _id)}>
|
|
49
|
+
<div className={styles.model}>{make} {model}</div>
|
|
50
|
+
<div className={styles.subModel}>{subModel}</div>
|
|
51
|
+
<Image className={styles.image} width='100%' ratioW={4} ratioH={3} data-testid='car-image' src={imageUrl} />
|
|
52
|
+
<div className={styles.req}>{request}</div>
|
|
53
|
+
{
|
|
54
|
+
(buyingType !== 'buy')
|
|
55
|
+
? (<div className={styles.payment}> {t(`DealerDashboardPage:buyingType.${buyingType}`)}, {t('DealerDashboardPage:paybackPeriod', { paybackPeriod })}, {t('DealerDashboardPage:monthlyInstallment', { monthlyInstallment: getFormattedPrice(monthlyInstallment, '$,.2f') })}</div>)
|
|
56
|
+
: (<div className={styles.payment}>
|
|
57
|
+
{t(`DealerDashboardPage:buyingType.${buyingType}`)}, {t('DealerDashboardPage:currentSalesPrice', { currentSalesPrice: getFormattedPrice(currentSalesPrice) })}
|
|
58
|
+
</div>)
|
|
59
|
+
}
|
|
60
|
+
<div></div>
|
|
61
|
+
<div className={styles.offerButton}>
|
|
62
|
+
<Button variant='outlined' size='small' onClick={(e: React.MouseEvent<HTMLButtonElement>) => { onDetailsClick(e, _id); }}>{t('DealerDashboardPage:requestedCars.toOffer')}</Button>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
return carsCard.reverse();
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const renderSlider = () => {
|
|
73
|
+
const sliderProps = {
|
|
74
|
+
className: 'react-slider-container',
|
|
75
|
+
slidesToShow: 3,
|
|
76
|
+
slidesToScroll: 1,
|
|
77
|
+
dots: false,
|
|
78
|
+
arrow: false,
|
|
79
|
+
rows: 1,
|
|
80
|
+
infinity: false
|
|
81
|
+
};
|
|
82
|
+
return (
|
|
83
|
+
<>
|
|
84
|
+
<Visible xs sm md>
|
|
85
|
+
<div className={styles.defaultLayout}>
|
|
86
|
+
{renderItems()}
|
|
87
|
+
</div>
|
|
88
|
+
</Visible>
|
|
89
|
+
<Hidden xs sm md>
|
|
90
|
+
{(requestedCars.length >= 3) ? (
|
|
91
|
+
<div className={styles.sliderContainer}>
|
|
92
|
+
<Slider {...sliderProps}>
|
|
93
|
+
{renderItems()}
|
|
94
|
+
</Slider>
|
|
95
|
+
</div>) :
|
|
96
|
+
(<div className={styles.defaultLayout}>
|
|
97
|
+
{renderItems()}
|
|
98
|
+
</div>)
|
|
99
|
+
}
|
|
100
|
+
</Hidden>
|
|
101
|
+
</>
|
|
102
|
+
);
|
|
103
|
+
};
|
|
104
|
+
const SupportSectionProps = {
|
|
105
|
+
t,
|
|
106
|
+
Link:LinkRouter
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
return (
|
|
110
|
+
<>
|
|
111
|
+
{requestedCars.length > 0 ? (
|
|
112
|
+
<DashboardSection title={t('DealerDashboardPage:requestedCars.requestedCarsTitle')}>
|
|
113
|
+
<div className={styles.carsContainer}>
|
|
114
|
+
<div className={styles.wrapper}>
|
|
115
|
+
{renderSlider()}
|
|
116
|
+
</div>
|
|
117
|
+
<SupportSection {...SupportSectionProps} />
|
|
118
|
+
</div>
|
|
119
|
+
</DashboardSection>
|
|
120
|
+
) : (
|
|
121
|
+
null
|
|
122
|
+
)}
|
|
123
|
+
</>
|
|
124
|
+
);
|
|
125
|
+
};
|
|
126
|
+
export default RequestedCarsSection;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
@import '../../../../theme/mixins.styl'
|
|
2
|
+
.supportSection
|
|
3
|
+
padding: 22px 20px
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
justify-content: space-between;
|
|
7
|
+
+media-tablet-landscape-down()
|
|
8
|
+
padding: 22px 10px;
|
|
9
|
+
|
|
10
|
+
.circle
|
|
11
|
+
width: 56px;
|
|
12
|
+
height: 56px;
|
|
13
|
+
background: linear-gradient(0deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.88)), #666CFF;
|
|
14
|
+
border-radius: 56px;
|
|
15
|
+
display: flex;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
align-items: center;
|
|
18
|
+
margin: 0px auto;
|
|
19
|
+
.title
|
|
20
|
+
font-style: normal;
|
|
21
|
+
font-weight: 500;
|
|
22
|
+
font-size: 20px;
|
|
23
|
+
line-height: 32px;
|
|
24
|
+
text-align: center;
|
|
25
|
+
letter-spacing: 0.15px;
|
|
26
|
+
color: rgba(76, 78, 100, 0.87);
|
|
27
|
+
|
|
28
|
+
.text
|
|
29
|
+
font-style: normal;
|
|
30
|
+
font-weight: 400;
|
|
31
|
+
font-size: 14px;
|
|
32
|
+
line-height: 20px;
|
|
33
|
+
text-align: center;
|
|
34
|
+
letter-spacing: 0.15px;
|
|
35
|
+
color: rgba(76, 78, 100, 0.68);
|
|
36
|
+
+media-tablet-landscape-down()
|
|
37
|
+
width: 88vw
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
.contactButton
|
|
41
|
+
display: flex;
|
|
42
|
+
justify-content: center;
|
|
43
|
+
margin-top: 8px;
|
|
44
|
+
[class*='MuiButtonBase-root']
|
|
45
|
+
background-color: rgba(0, 184, 0, 1);
|
|
46
|
+
width: 111px;
|
|
47
|
+
height: 42px;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// import { Button, IconSVG } from '@bytebrand/fe-ui-core/common';
|
|
2
|
+
import i18next from 'i18next';
|
|
3
|
+
import IconSVG from '../../../_common/IconSVG/IconSVG';
|
|
4
|
+
import Button from '../../../_common/Button/Button';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import styles from './SupportSection.styl';
|
|
7
|
+
|
|
8
|
+
export interface IProps {
|
|
9
|
+
t: i18next.TFunction;
|
|
10
|
+
Link?: any;
|
|
11
|
+
}
|
|
12
|
+
const SupportSection: React.FunctionComponent<IProps> = ({ t , Link }) => {
|
|
13
|
+
return (
|
|
14
|
+
<div className={styles.supportSection}>
|
|
15
|
+
<div className={styles.circle}>
|
|
16
|
+
<IconSVG className={styles.icon} name='dashboardQuestionMark' customDimensions />
|
|
17
|
+
</div>
|
|
18
|
+
<div className={styles.title}>
|
|
19
|
+
{t('DealerDashboardPage:requestedCars.customerService')}
|
|
20
|
+
</div>
|
|
21
|
+
<div className={styles.text}>
|
|
22
|
+
{t('DealerDashboardPage:requestedCars.customerServiceText')}</div>
|
|
23
|
+
<div className={styles.contactButton}>
|
|
24
|
+
<Link to='/account/kontakt'>
|
|
25
|
+
<Button size='small' color='success' variant='contained'>{t('DealerDashboardPage:requestedCars.contact')}</Button>
|
|
26
|
+
</Link>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default SupportSection;
|
|
@@ -12,7 +12,7 @@ interface IPreviewCookieModal {
|
|
|
12
12
|
|
|
13
13
|
const PreviewCookieModal = ({ toggleModal, setModal }: IPreviewCookieModal) => {
|
|
14
14
|
const onAcceptAll = () => {
|
|
15
|
-
|
|
15
|
+
localStorage.setItem('cookieConfig', JSON.stringify({}));
|
|
16
16
|
updateCookieList();
|
|
17
17
|
toggleModal();
|
|
18
18
|
};
|
|
@@ -54,6 +54,7 @@ const OfferRequestBtnWrapper: React.FunctionComponent<IOfferRequestButtonWrapper
|
|
|
54
54
|
|
|
55
55
|
const getRequestButtonTitle = () => {
|
|
56
56
|
if (isSale) return t('sidebar.requestOfferSale');
|
|
57
|
+
// tslint:disable-next-line:no-else-after-return
|
|
57
58
|
else if (isAlternativeType) return t('sidebar.importRequest');
|
|
58
59
|
else if (hasCheckout) return t('vehicleProps:title.toCheckoutCar');
|
|
59
60
|
else if (isOfferRequested) return t('CheckoutPage:onlineCheckoutModal.redirectBtn');
|
|
@@ -15,6 +15,7 @@ import { SearchPage as SearchPageTranslate } from '../../locales/data';
|
|
|
15
15
|
const PRICE_DEFAULT = DROP_DOWN_GROUP[PRICE].defaultValue;
|
|
16
16
|
|
|
17
17
|
declare global {
|
|
18
|
+
// tslint:disable-next-line:interface-name
|
|
18
19
|
interface Window {
|
|
19
20
|
grantHotjarCookieConsent?: () => void;
|
|
20
21
|
grantCookieConsent?: (list: string[]) => void;
|