@bytebrand/fe-ui-core 4.2.213 → 4.2.215
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/package.json +1 -1
- package/source/components/UserDashboardPage/sections/OrderStatusSection/OrderStatusSection.tsx +1 -1
- package/source/components/VehicleDetailedSlider/VehicleDetailedSlider.styl +8 -0
- package/source/components/VehicleDetailedSlider/VehicleDetailedSlider.tsx +55 -41
- package/source/framework/types/types.ts +1 -0
package/package.json
CHANGED
package/source/components/UserDashboardPage/sections/OrderStatusSection/OrderStatusSection.tsx
CHANGED
|
@@ -189,7 +189,7 @@ const OrderStatusSection = ({
|
|
|
189
189
|
] : []
|
|
190
190
|
],
|
|
191
191
|
overallRate: {
|
|
192
|
-
label: t('MyOrderPage:yourOverallRate'),
|
|
192
|
+
label: buyingType === 'buy' ? t('MyOrderPage:yourOverallPrice') : t('MyOrderPage:yourOverallRate'),
|
|
193
193
|
value: buyingType === 'buy' ? totalPrice : monthlyInstallment
|
|
194
194
|
}
|
|
195
195
|
};
|
|
@@ -34,6 +34,7 @@ interface IProps {
|
|
|
34
34
|
powerKW: number;
|
|
35
35
|
powerPS: number;
|
|
36
36
|
financingConfig:any;
|
|
37
|
+
youtubeId:string;
|
|
37
38
|
showModal?: (id: string, props?: any) => void;
|
|
38
39
|
hideModal: (id: string) => void;
|
|
39
40
|
onCarFavorite: (event: MouseEvent<HTMLElement>) => void;
|
|
@@ -78,6 +79,7 @@ class VehicleDetailedSlider extends Component<IProps, IState> {
|
|
|
78
79
|
|
|
79
80
|
handleSetFirstSlide = () => {
|
|
80
81
|
this.slider.slickGoTo(0);
|
|
82
|
+
|
|
81
83
|
};
|
|
82
84
|
|
|
83
85
|
componentDidUpdate(prevProps: IProps) {
|
|
@@ -113,7 +115,7 @@ class VehicleDetailedSlider extends Component<IProps, IState> {
|
|
|
113
115
|
};
|
|
114
116
|
|
|
115
117
|
getImages = () => {
|
|
116
|
-
const { photos, mainImageUrl, mainImageBlur } = this.props;
|
|
118
|
+
const { photos, mainImageUrl, mainImageBlur, youtubeId } = this.props;
|
|
117
119
|
const { activeSlide, largeLoaded, smallLoaded, largeLoaded1, largeLoaded01 } = this.state;
|
|
118
120
|
|
|
119
121
|
const imageProps = {
|
|
@@ -123,6 +125,7 @@ class VehicleDetailedSlider extends Component<IProps, IState> {
|
|
|
123
125
|
className: styles.image,
|
|
124
126
|
withLoader: false
|
|
125
127
|
};
|
|
128
|
+
|
|
126
129
|
if (Array.isArray(photos) && photos.length > 0 && largeLoaded && smallLoaded && largeLoaded1 && largeLoaded01) {
|
|
127
130
|
let isMouseDown = false;
|
|
128
131
|
let isDragging = false;
|
|
@@ -151,7 +154,6 @@ class VehicleDetailedSlider extends Component<IProps, IState> {
|
|
|
151
154
|
const currentSlide = activeSlide;
|
|
152
155
|
const prevSlide = (activeSlide - 1 % imagesCount + imagesCount) % imagesCount;
|
|
153
156
|
const nextSlide = (activeSlide + 1 % imagesCount + imagesCount) % imagesCount;
|
|
154
|
-
|
|
155
157
|
return photos.map((item: IImage, index: number) => {
|
|
156
158
|
const showImage = index === currentSlide || index === prevSlide || index === nextSlide || this.imagesCache[index] !== undefined;
|
|
157
159
|
const imageUrlSmall = _get(item, 'imageUrlSmall', null);
|
|
@@ -169,7 +171,7 @@ class VehicleDetailedSlider extends Component<IProps, IState> {
|
|
|
169
171
|
onMouseMove={handleMouseMove}
|
|
170
172
|
onMouseUp={handleMouseUp}
|
|
171
173
|
>
|
|
172
|
-
{showImage && (
|
|
174
|
+
{showImage && !item.videoUrl && (
|
|
173
175
|
<MagnifyGlassImage
|
|
174
176
|
src={index !== 0 ? imageUrlLarge : null}
|
|
175
177
|
srcSmall={index === 0 ? imageUrlSmall : null}
|
|
@@ -177,50 +179,61 @@ class VehicleDetailedSlider extends Component<IProps, IState> {
|
|
|
177
179
|
{...imageProps}
|
|
178
180
|
/>
|
|
179
181
|
)}
|
|
182
|
+
{showImage && item.videoUrl && (
|
|
183
|
+
<iframe
|
|
184
|
+
width='100%'
|
|
185
|
+
height='441'
|
|
186
|
+
src={`https://www.youtube.com/embed/${item.videoUrl}?&enablejsapi=1&&rel=0&showinfo=0&html5=1`}
|
|
187
|
+
title='YouTube Video'
|
|
188
|
+
className={styles.frame}
|
|
189
|
+
></iframe>
|
|
190
|
+
)}
|
|
180
191
|
</div>
|
|
181
192
|
);
|
|
182
193
|
});
|
|
183
194
|
}
|
|
184
|
-
|
|
185
195
|
if (mainImageUrl) {
|
|
186
|
-
const imagesCount = Array.isArray(photos) && photos.length > 0 ? photos.length
|
|
196
|
+
const imagesCount = Array.isArray(photos) && photos.length > 0 ? photos.length : 0;
|
|
187
197
|
const prevSlide = (activeSlide - 1 % imagesCount + imagesCount) % imagesCount;
|
|
188
198
|
const nextSlide = (activeSlide + 1 % imagesCount + imagesCount) % imagesCount;
|
|
189
199
|
return (
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
{(
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
200
|
+
// preload cached photos from props
|
|
201
|
+
|
|
202
|
+
<div className={classnames(styles.photo, { [styles.blurred]: (mainImageBlur && mainImageUrl !== PLACEHOLDER_IMAGE_SMALL_URL) })} key={mainImageUrl}>
|
|
203
|
+
{(!largeLoaded || !smallLoaded || !largeLoaded1 || !largeLoaded01) && <Image src={mainImageUrl} {...imageProps} /> }
|
|
204
|
+
|
|
205
|
+
{ Array.isArray(photos) && photos.length > 0 && <Image
|
|
206
|
+
style={ { display: 'none' } }
|
|
207
|
+
src={ photos[activeSlide]?.imageUrlSmall }
|
|
208
|
+
onLoad={ () => this.setState({ smallLoaded: true }) }
|
|
209
|
+
{...imageProps}
|
|
210
|
+
/>
|
|
211
|
+
}
|
|
212
|
+
{ Array.isArray(photos) && photos.length > 0 && <Image
|
|
213
|
+
style={ { display: 'none' } }
|
|
214
|
+
src={ photos[activeSlide]?.imageUrlLarge }
|
|
215
|
+
onLoad={ () => this.setState({ largeLoaded: true }) }
|
|
216
|
+
{...imageProps}
|
|
217
|
+
/>
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
{ Array.isArray(photos) && photos.length > 0 && <Image
|
|
221
|
+
style={ { display: 'none' } }
|
|
222
|
+
src={ photos[nextSlide]?.imageUrlLarge }
|
|
223
|
+
onLoad={ () => this.setState({ largeLoaded1: true }) }
|
|
224
|
+
{...imageProps}
|
|
225
|
+
/>
|
|
226
|
+
}
|
|
227
|
+
{ Array.isArray(photos) && photos.length > 0 && <Image
|
|
228
|
+
style={ { display: 'none' } }
|
|
229
|
+
src={ photos[prevSlide]?.imageUrlLarge }
|
|
230
|
+
onLoad={ () => this.setState({ largeLoaded01: true }) }
|
|
231
|
+
{...imageProps}
|
|
232
|
+
/>
|
|
233
|
+
}
|
|
234
|
+
</div>
|
|
223
235
|
);
|
|
236
|
+
|
|
224
237
|
}
|
|
225
238
|
|
|
226
239
|
return (
|
|
@@ -249,7 +262,6 @@ class VehicleDetailedSlider extends Component<IProps, IState> {
|
|
|
249
262
|
onCarFavorite
|
|
250
263
|
} = this.props;
|
|
251
264
|
const { activeSlide } = this.state;
|
|
252
|
-
|
|
253
265
|
const sliderProps = {
|
|
254
266
|
autoPlay: false,
|
|
255
267
|
speed: 300,
|
|
@@ -293,11 +305,13 @@ class VehicleDetailedSlider extends Component<IProps, IState> {
|
|
|
293
305
|
<Title {...{ t, make, model, subModel, powerKW, powerPS, onCarFavorite, isFavorite }}/>
|
|
294
306
|
}
|
|
295
307
|
<div className={styles.slider}>
|
|
296
|
-
<PriceData {...priceProps}/>
|
|
308
|
+
{!photos[activeSlide]?.videoUrl && <PriceData {...priceProps}/>}
|
|
297
309
|
<Slider ref={slider => (this.slider = slider)} {...sliderProps}>
|
|
298
310
|
{this.getImages()}
|
|
299
311
|
</Slider>
|
|
300
|
-
{
|
|
312
|
+
{!photos[activeSlide]?.videoUrl ? (
|
|
313
|
+
isMobileOnly ? <MobileStats {...statsProps} /> : <Stats {...statsProps} />
|
|
314
|
+
) : null}
|
|
301
315
|
</div>
|
|
302
316
|
</div>
|
|
303
317
|
);
|