kupos-ui-components-lib 9.9.9 → 9.9.10
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/dist/components/ServiceItem/ServiceItemDesktop.d.ts +1 -1
- package/dist/components/ServiceItem/ServiceItemDesktop.js +6 -24
- package/dist/components/ServiceItem/ServiceItemMobile.d.ts +1 -1
- package/dist/components/ServiceItem/ServiceItemMobile.js +9 -4
- package/dist/components/ServiceItem/mobileTypes.d.ts +0 -2
- package/dist/components/ServiceItem/types.d.ts +0 -7
- package/dist/styles.css +6 -6
- package/dist/ui/OfferBanner.js +1 -1
- package/dist/ui/SeatSection/SeatSection.d.ts +1 -7
- package/dist/ui/SeatSection/SeatSection.js +9 -38
- package/dist/ui/ServiceBadges/ServiceBadges.d.ts +1 -1
- package/dist/ui/ServiceBadges/ServiceBadges.js +3 -1
- package/dist/ui/mobileweb/DateTimeSectionMobile.d.ts +1 -2
- package/dist/ui/mobileweb/DateTimeSectionMobile.js +6 -12
- package/dist/ui/mobileweb/SeatSectionMobile.d.ts +1 -2
- package/dist/ui/mobileweb/SeatSectionMobile.js +14 -21
- package/dist/ui/mobileweb/ServiceBadgesMobile.d.ts +1 -1
- package/dist/ui/mobileweb/ServiceBadgesMobile.js +3 -3
- package/dist/utils/CommonService.d.ts +1 -1
- package/dist/utils/CommonService.js +1 -5
- package/package.json +1 -1
- package/src/components/ServiceItem/ServiceItemDesktop.tsx +6 -46
- package/src/components/ServiceItem/ServiceItemMobile.tsx +14 -5
- package/src/components/ServiceItem/mobileTypes.ts +26 -32
- package/src/components/ServiceItem/types.ts +0 -12
- package/src/ui/OfferBanner.tsx +1 -1
- package/src/ui/SeatSection/SeatSection.tsx +18 -83
- package/src/ui/ServiceBadges/ServiceBadges.tsx +6 -4
- package/src/ui/mobileweb/DateTimeSectionMobile.tsx +35 -44
- package/src/ui/mobileweb/SeatSectionMobile.tsx +11 -23
- package/src/ui/mobileweb/ServiceBadgesMobile.tsx +8 -5
- package/src/utils/CommonService.ts +1 -7
|
@@ -131,13 +131,6 @@ function ServiceItemPB({
|
|
|
131
131
|
showLoginModal,
|
|
132
132
|
isLoggedIn,
|
|
133
133
|
showLoginOption,
|
|
134
|
-
isTrain,
|
|
135
|
-
selectedSeatKey,
|
|
136
|
-
onSeatSelect,
|
|
137
|
-
onTrainButtonClick,
|
|
138
|
-
showSeatSelectionError,
|
|
139
|
-
onShowSeatSelectionError,
|
|
140
|
-
onClearSeatSelectionError,
|
|
141
134
|
isFeatureDropDownExpand,
|
|
142
135
|
setIsFeatureDropDownExpand,
|
|
143
136
|
ticketQuantity,
|
|
@@ -151,15 +144,6 @@ function ServiceItemPB({
|
|
|
151
144
|
wowDealData,
|
|
152
145
|
isFlores,
|
|
153
146
|
}: ServiceItemProps & { currencySign?: string }): React.ReactElement {
|
|
154
|
-
const handleSeatSelect = (
|
|
155
|
-
key: any,
|
|
156
|
-
price: number,
|
|
157
|
-
seatKey: string,
|
|
158
|
-
apiSeatType?: string,
|
|
159
|
-
) => {
|
|
160
|
-
onClearSeatSelectionError?.();
|
|
161
|
-
onSeatSelect?.(key, price, seatKey, apiSeatType);
|
|
162
|
-
};
|
|
163
147
|
const getAnimationIcon = (icon: string) => {
|
|
164
148
|
const animation = ANIMATION_MAP[icon];
|
|
165
149
|
if (!animation) return null;
|
|
@@ -259,7 +243,7 @@ function ServiceItemPB({
|
|
|
259
243
|
}
|
|
260
244
|
: {};
|
|
261
245
|
|
|
262
|
-
const renderIcon = (iconKey: string, size: string = "14px") => {
|
|
246
|
+
const renderIcon = (iconKey: string, size: string = "14px", styles?: any) => {
|
|
263
247
|
const iconValue = serviceItem.icons?.[iconKey];
|
|
264
248
|
if (iconValue) {
|
|
265
249
|
if (typeof iconValue === "string") {
|
|
@@ -268,6 +252,9 @@ function ServiceItemPB({
|
|
|
268
252
|
src={iconValue}
|
|
269
253
|
alt={iconKey}
|
|
270
254
|
className={`${`w-[${size}] h-[${size}]`} `}
|
|
255
|
+
style={{
|
|
256
|
+
...(styles || {}),
|
|
257
|
+
}}
|
|
271
258
|
/>
|
|
272
259
|
);
|
|
273
260
|
}
|
|
@@ -357,17 +344,6 @@ function ServiceItemPB({
|
|
|
357
344
|
return;
|
|
358
345
|
}
|
|
359
346
|
|
|
360
|
-
if (isTrain) {
|
|
361
|
-
if (!selectedSeatKey) {
|
|
362
|
-
onShowSeatSelectionError?.(serviceItem.id);
|
|
363
|
-
return;
|
|
364
|
-
}
|
|
365
|
-
if (onTrainButtonClick) {
|
|
366
|
-
onTrainButtonClick();
|
|
367
|
-
return;
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
|
|
371
347
|
onBookButtonPress();
|
|
372
348
|
};
|
|
373
349
|
|
|
@@ -511,11 +487,11 @@ function ServiceItemPB({
|
|
|
511
487
|
/>
|
|
512
488
|
) : (
|
|
513
489
|
<div
|
|
514
|
-
className={`relative hover:z-[150] ${hasOfferText || hasDpEnabled ? "mb-[55px]" : "mb-[10px]"} ${
|
|
490
|
+
className={`relative hover:z-[150] ${hasOfferText || hasDpEnabled || isNewUiEnabled ? "mb-[55px]" : "mb-[10px]"} ${
|
|
515
491
|
serviceItem?.is_direct_trip ||
|
|
516
492
|
serviceItem?.train_type_label === "Tren Express (Nuevo)" ||
|
|
517
493
|
showTopLabel
|
|
518
|
-
? "mt-[
|
|
494
|
+
? "mt-[30px]"
|
|
519
495
|
: "mt-[20px]"
|
|
520
496
|
} `}
|
|
521
497
|
>
|
|
@@ -621,10 +597,6 @@ function ServiceItemPB({
|
|
|
621
597
|
isPeru={isPeru}
|
|
622
598
|
renderIcon={renderIcon}
|
|
623
599
|
discountSeatPriceColor={colors.discountSeatPriceColor}
|
|
624
|
-
isTrain={isTrain}
|
|
625
|
-
selectedSeatKey={selectedSeatKey}
|
|
626
|
-
onSeatSelect={handleSeatSelect}
|
|
627
|
-
topLabelColor={colors.topLabelColor}
|
|
628
600
|
/>
|
|
629
601
|
</div>
|
|
630
602
|
|
|
@@ -640,18 +612,6 @@ function ServiceItemPB({
|
|
|
640
612
|
soldOutIcon={renderIcon("soldOutIcon", "14px")}
|
|
641
613
|
onClick={checkMidnight}
|
|
642
614
|
/>
|
|
643
|
-
{showSeatSelectionError === serviceItem.id && isTrain && (
|
|
644
|
-
<div className="flex justify-center mr-[11px] w-[100%] right-[0px] absolute left-[0] top-[40px]">
|
|
645
|
-
<div
|
|
646
|
-
className="text-[9px] text-center whitespace-nowrap"
|
|
647
|
-
style={{
|
|
648
|
-
color: colors.seatPriceColor,
|
|
649
|
-
}}
|
|
650
|
-
>
|
|
651
|
-
Selecciona el tipo de servicio
|
|
652
|
-
</div>
|
|
653
|
-
</div>
|
|
654
|
-
)}
|
|
655
615
|
{showLastSeats ? (
|
|
656
616
|
<div className="flex justify-center mr-[11px] w-[100%] right-[0px] absolute left-[0] top-[40px]">
|
|
657
617
|
{serviceItem?.available_seats < 10 &&
|
|
@@ -46,8 +46,6 @@ function ServiceItemMobile({
|
|
|
46
46
|
removeDuplicateSeats,
|
|
47
47
|
isLinatal,
|
|
48
48
|
viewersConfig,
|
|
49
|
-
operatorLabel,
|
|
50
|
-
isTrain,
|
|
51
49
|
isFeatureDropDownExpand,
|
|
52
50
|
setIsFeatureDropDownExpand,
|
|
53
51
|
ticketQuantity,
|
|
@@ -148,7 +146,7 @@ function ServiceItemMobile({
|
|
|
148
146
|
return nodes;
|
|
149
147
|
};
|
|
150
148
|
|
|
151
|
-
const renderIcon = (iconKey: string, size: string = "14px") => {
|
|
149
|
+
const renderIcon = (iconKey: string, size: string = "14px", styles?: any) => {
|
|
152
150
|
const iconValue = serviceItem.icons?.[iconKey];
|
|
153
151
|
if (iconValue) {
|
|
154
152
|
if (typeof iconValue === "string") {
|
|
@@ -157,7 +155,10 @@ function ServiceItemMobile({
|
|
|
157
155
|
src={iconValue}
|
|
158
156
|
alt={iconKey}
|
|
159
157
|
className={`${`w-[${size}] h-[${size}]`} mr-[5px]`}
|
|
160
|
-
style={{
|
|
158
|
+
style={{
|
|
159
|
+
filter: isSoldOut ? "grayscale" : "",
|
|
160
|
+
...(styles || {}),
|
|
161
|
+
}}
|
|
161
162
|
/>
|
|
162
163
|
);
|
|
163
164
|
}
|
|
@@ -225,7 +226,15 @@ function ServiceItemMobile({
|
|
|
225
226
|
}`}
|
|
226
227
|
style={{ ...serviceCardStyle, backgroundColor: "#fff" }}
|
|
227
228
|
>
|
|
228
|
-
<div
|
|
229
|
+
<div
|
|
230
|
+
style={{
|
|
231
|
+
padding: "12px 12px 8px 12px",
|
|
232
|
+
marginTop:
|
|
233
|
+
serviceItem?.is_direct_trip && showTopLabel && isConexion
|
|
234
|
+
? " 10px"
|
|
235
|
+
: "",
|
|
236
|
+
}}
|
|
237
|
+
>
|
|
229
238
|
{/* Header with operator info and favorite */}
|
|
230
239
|
<div className="flex justify-between items-center mb-[10px]">
|
|
231
240
|
<div
|
|
@@ -135,36 +135,36 @@ export interface MobileServiceItemProps {
|
|
|
135
135
|
bombAnim?: string;
|
|
136
136
|
whiteBoardingIcon?: string;
|
|
137
137
|
downArrow?: string;
|
|
138
|
-
personIcon?: string
|
|
138
|
+
personIcon?: string
|
|
139
139
|
specialDeparture?: string;
|
|
140
140
|
fireIcon?: string;
|
|
141
141
|
directoIcon?: string;
|
|
142
|
-
whiteFireIcon?: string
|
|
143
|
-
femaleAnim?:
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
whiteDestination?: string
|
|
148
|
-
userIcon?: string
|
|
149
|
-
|
|
150
|
-
sheildIcon?: string
|
|
151
|
-
busIcon?: string
|
|
152
|
-
whiteDownArrow?: string
|
|
153
|
-
empressaIcon?: string
|
|
154
|
-
flexibleIcon?: string
|
|
155
|
-
listoIcon?: string
|
|
156
|
-
precioIcon?: string
|
|
157
|
-
confirmarIcon?: string
|
|
142
|
+
whiteFireIcon?: string
|
|
143
|
+
femaleAnim?:string
|
|
144
|
+
thunderAnim?: string
|
|
145
|
+
personsAnim?: string
|
|
146
|
+
whiteOrigin?: string,
|
|
147
|
+
whiteDestination?: string,
|
|
148
|
+
userIcon?: string,
|
|
149
|
+
|
|
150
|
+
sheildIcon?: string,
|
|
151
|
+
busIcon?: string,
|
|
152
|
+
whiteDownArrow?: string,
|
|
153
|
+
empressaIcon?: string,
|
|
154
|
+
flexibleIcon?: string,
|
|
155
|
+
listoIcon?: string,
|
|
156
|
+
precioIcon?: string,
|
|
157
|
+
confirmarIcon?: string
|
|
158
158
|
cancelTicketIcon?: string;
|
|
159
159
|
changeTicketIcon?: string;
|
|
160
160
|
petFriendlyIcon?: string;
|
|
161
|
-
womenSeatIcon?: string
|
|
161
|
+
womenSeatIcon?: string
|
|
162
162
|
[key: string]: string | Record<string, string | undefined> | undefined;
|
|
163
163
|
};
|
|
164
164
|
useLottieFor?: string[];
|
|
165
165
|
};
|
|
166
166
|
onBookButtonPress?: () => void;
|
|
167
|
-
onRemateUiButtonClick?: ()
|
|
167
|
+
onRemateUiButtonClick?: ()=> void;
|
|
168
168
|
terminals?: any[];
|
|
169
169
|
showDropdown?: boolean;
|
|
170
170
|
setShowDropdown?: (value: boolean) => void;
|
|
@@ -208,7 +208,7 @@ export interface MobileServiceItemProps {
|
|
|
208
208
|
seatPriceColor?: string;
|
|
209
209
|
rightGradiantColor?: string;
|
|
210
210
|
leftGradiantColor?: string;
|
|
211
|
-
discountSeatPriceColor?: string
|
|
211
|
+
discountSeatPriceColor?: string
|
|
212
212
|
};
|
|
213
213
|
isCiva?: boolean;
|
|
214
214
|
currencySign?: string;
|
|
@@ -221,29 +221,23 @@ export interface MobileServiceItemProps {
|
|
|
221
221
|
showLastSeats?: boolean;
|
|
222
222
|
removeDuplicateSeats?: boolean;
|
|
223
223
|
isLinatal?: boolean;
|
|
224
|
-
|
|
224
|
+
viewersConfig?: {
|
|
225
225
|
min: number;
|
|
226
226
|
max: number;
|
|
227
227
|
interval?: number; // ms, default 5000
|
|
228
228
|
label?: string; // e.g. "personas están viendo este viaje"
|
|
229
229
|
icon?: string; // optional icon URL
|
|
230
230
|
};
|
|
231
|
-
|
|
232
|
-
isTrain?: boolean;
|
|
233
|
-
isFeatureDropDownExpand?: any;
|
|
231
|
+
isFeatureDropDownExpand?: any;
|
|
234
232
|
setIsFeatureDropDownExpand?: (value: any) => void;
|
|
235
233
|
ticketQuantity?: number;
|
|
236
|
-
onIncreaseTicketQuantity?: (
|
|
237
|
-
|
|
238
|
-
) => void;
|
|
239
|
-
onDecreaseTicketQuantity?: (
|
|
240
|
-
serviceItem: MobileServiceItemProps["serviceItem"],
|
|
241
|
-
) => void;
|
|
234
|
+
onIncreaseTicketQuantity?: (serviceItem: MobileServiceItemProps["serviceItem"]) => void;
|
|
235
|
+
onDecreaseTicketQuantity?: (serviceItem: MobileServiceItemProps["serviceItem"]) => void;
|
|
242
236
|
cityOrigin?: { value: number; label: string };
|
|
243
237
|
cityDestination?: { value: number; label: string };
|
|
244
|
-
|
|
238
|
+
isNewUi?: boolean
|
|
245
239
|
|
|
246
|
-
|
|
240
|
+
selectedTimeSlot?: string;
|
|
247
241
|
onTimeSlotChange?: (slot: string) => void;
|
|
248
242
|
isTimeDropdownOpen?: string | number | null;
|
|
249
243
|
onTimeDropdownToggle?: (id?: string | number | null) => void;
|
|
@@ -252,18 +252,6 @@ export interface ServiceItemProps {
|
|
|
252
252
|
showLoginModal?: any;
|
|
253
253
|
isLoggedIn?: any;
|
|
254
254
|
showLoginOption?: boolean;
|
|
255
|
-
isTrain?: boolean;
|
|
256
|
-
selectedSeatKey?: any;
|
|
257
|
-
onSeatSelect?: (
|
|
258
|
-
key: any,
|
|
259
|
-
price: number,
|
|
260
|
-
seatKey: string,
|
|
261
|
-
apiSeatType?: string,
|
|
262
|
-
) => void;
|
|
263
|
-
onTrainButtonClick?: any;
|
|
264
|
-
showSeatSelectionError?: string | null;
|
|
265
|
-
onShowSeatSelectionError?: (serviceId: string) => void;
|
|
266
|
-
onClearSeatSelectionError?: () => void;
|
|
267
255
|
selectedTimeSlot?: string;
|
|
268
256
|
onTimeSlotChange?: (slot: string) => void;
|
|
269
257
|
isTimeDropdownOpen?: string | number | null;
|
package/src/ui/OfferBanner.tsx
CHANGED
|
@@ -38,7 +38,7 @@ const OfferBanner: React.FC<OfferBannerProps> = ({
|
|
|
38
38
|
}) => {
|
|
39
39
|
return (
|
|
40
40
|
<div
|
|
41
|
-
className="text-white p-[
|
|
41
|
+
className="text-white p-[10px_15px] text-left w-full flex items-center absolute -bottom-[44px] pt-[50px] rounded-b-[14px] text-[14px] mt-[10px]"
|
|
42
42
|
style={{
|
|
43
43
|
background:
|
|
44
44
|
serviceItem?.offer_text && !isNewUiEnabled
|
|
@@ -7,8 +7,6 @@ interface SeatType {
|
|
|
7
7
|
label: string;
|
|
8
8
|
fare: number;
|
|
9
9
|
key: any;
|
|
10
|
-
apiSeatType?: string;
|
|
11
|
-
api_seat_type?: string;
|
|
12
10
|
}
|
|
13
11
|
|
|
14
12
|
interface SeatSectionProps {
|
|
@@ -23,15 +21,6 @@ interface SeatSectionProps {
|
|
|
23
21
|
serviceItem?: any;
|
|
24
22
|
renderIcon?: (iconKey: string, size?: string) => React.ReactNode;
|
|
25
23
|
discountSeatPriceColor?: string;
|
|
26
|
-
isTrain?: boolean;
|
|
27
|
-
selectedSeatKey?: any;
|
|
28
|
-
onSeatSelect?: (
|
|
29
|
-
key: any,
|
|
30
|
-
price: number,
|
|
31
|
-
seatKey: string,
|
|
32
|
-
apiSeatType?: string,
|
|
33
|
-
) => void;
|
|
34
|
-
topLabelColor?: string;
|
|
35
24
|
}
|
|
36
25
|
|
|
37
26
|
function getAllSeatTypes(seatTypes: SeatType[]) {
|
|
@@ -42,8 +31,6 @@ function getAllSeatTypes(seatTypes: SeatType[]) {
|
|
|
42
31
|
let seatTypesWithPrices = seatTypes.filter(Boolean).map((val) => ({
|
|
43
32
|
label: val?.label,
|
|
44
33
|
price: val?.fare,
|
|
45
|
-
key: val?.key,
|
|
46
|
-
apiSeatType: val?.apiSeatType || val?.api_seat_type,
|
|
47
34
|
}));
|
|
48
35
|
|
|
49
36
|
seatTypesWithPrices.sort((a, b) => a.price - b.price);
|
|
@@ -51,7 +38,7 @@ function getAllSeatTypes(seatTypes: SeatType[]) {
|
|
|
51
38
|
return seatTypesWithPrices;
|
|
52
39
|
}
|
|
53
40
|
|
|
54
|
-
function getSortedSeatTypes(seatTypes: SeatType[]
|
|
41
|
+
function getSortedSeatTypes(seatTypes: SeatType[]) {
|
|
55
42
|
if (!seatTypes?.length) {
|
|
56
43
|
return [{ label: "Salon cama", price: 0 }];
|
|
57
44
|
}
|
|
@@ -65,9 +52,7 @@ function getSortedSeatTypes(seatTypes: SeatType[], isTrain: any) {
|
|
|
65
52
|
seatTypesWithPrices[2] = seatTypesWithPrices[premiumIndex];
|
|
66
53
|
}
|
|
67
54
|
|
|
68
|
-
|
|
69
|
-
seatTypesWithPrices = seatTypesWithPrices.slice(0, 2);
|
|
70
|
-
}
|
|
55
|
+
seatTypesWithPrices = seatTypesWithPrices.slice(0, 2);
|
|
71
56
|
|
|
72
57
|
const seenPrices = new Set<number>();
|
|
73
58
|
seatTypesWithPrices = seatTypesWithPrices.filter((seat) => {
|
|
@@ -112,18 +97,14 @@ function SeatSection({
|
|
|
112
97
|
priceColor,
|
|
113
98
|
currencySign,
|
|
114
99
|
removeDuplicateSeats,
|
|
115
|
-
selectedSeatKey,
|
|
116
|
-
onSeatSelect,
|
|
117
100
|
isPeru,
|
|
118
101
|
serviceItem,
|
|
119
102
|
renderIcon,
|
|
120
103
|
dpSeatColor,
|
|
121
104
|
discountSeatPriceColor,
|
|
122
|
-
isTrain,
|
|
123
|
-
topLabelColor,
|
|
124
105
|
}: SeatSectionProps): React.ReactElement {
|
|
125
106
|
const uniqueSeats = getUniqueSeats(seatTypes);
|
|
126
|
-
const sortedSeatTypes = getSortedSeatTypes(seatTypes
|
|
107
|
+
const sortedSeatTypes = getSortedSeatTypes(seatTypes);
|
|
127
108
|
const numberOfSeats = getNumberOfSeats(seatTypes);
|
|
128
109
|
const isCentered = numberOfSeats < 2 || removeDuplicateSeats;
|
|
129
110
|
|
|
@@ -135,68 +116,22 @@ function SeatSection({
|
|
|
135
116
|
const renderSeatNames = () => {
|
|
136
117
|
const seats = removeDuplicateSeats ? uniqueSeats : sortedSeatTypes;
|
|
137
118
|
|
|
138
|
-
return seats.map((val, key: number) =>
|
|
139
|
-
|
|
140
|
-
<
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
? () =>
|
|
146
|
-
val.label === selectedSeatKey
|
|
147
|
-
? onSeatSelect?.(null, 0, "", "")
|
|
148
|
-
: onSeatSelect?.(
|
|
149
|
-
val.label,
|
|
150
|
-
val.price,
|
|
151
|
-
val.key,
|
|
152
|
-
(val as any).apiSeatType,
|
|
153
|
-
)
|
|
154
|
-
: undefined
|
|
155
|
-
}
|
|
119
|
+
return seats.map((val, key: number) =>
|
|
120
|
+
SEAT_EXCEPTIONS.includes(val.label) ? null : (
|
|
121
|
+
<span
|
|
122
|
+
key={key}
|
|
123
|
+
className={`flex items-center justify-between text-[13.33px] ${
|
|
124
|
+
isSoldOut ? "text-[#c0c0c0]" : ""
|
|
125
|
+
}`}
|
|
156
126
|
>
|
|
157
|
-
{
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
marginRight: "10px",
|
|
166
|
-
display: "flex",
|
|
167
|
-
alignItems: "center",
|
|
168
|
-
justifyContent: "center",
|
|
169
|
-
}}
|
|
170
|
-
>
|
|
171
|
-
{val.label === selectedSeatKey && (
|
|
172
|
-
<div
|
|
173
|
-
style={{
|
|
174
|
-
backgroundColor: topLabelColor,
|
|
175
|
-
borderRadius: "50%",
|
|
176
|
-
width: "7px",
|
|
177
|
-
height: "7px",
|
|
178
|
-
}}
|
|
179
|
-
/>
|
|
180
|
-
)}
|
|
181
|
-
</div>
|
|
182
|
-
)}
|
|
183
|
-
<span
|
|
184
|
-
key={key}
|
|
185
|
-
className={`flex items-center justify-between text-[13.33px] ${
|
|
186
|
-
isSoldOut ? "text-[#c0c0c0]" : ""
|
|
187
|
-
}`}
|
|
188
|
-
>
|
|
189
|
-
{typeof val.label === "string" || typeof val.label === "number"
|
|
190
|
-
? removeDuplicateSeats && isPeru
|
|
191
|
-
? CommonService.truncateSeatLabel(val.label)
|
|
192
|
-
: isTrain
|
|
193
|
-
? CommonService.truncateSeatLabel(val.label, 8)
|
|
194
|
-
: val.label
|
|
195
|
-
: null}
|
|
196
|
-
</span>
|
|
197
|
-
</div>
|
|
198
|
-
);
|
|
199
|
-
});
|
|
127
|
+
{typeof val.label === "string" || typeof val.label === "number"
|
|
128
|
+
? removeDuplicateSeats && isPeru
|
|
129
|
+
? CommonService.truncateSeatLabel(val.label)
|
|
130
|
+
: val.label
|
|
131
|
+
: null}
|
|
132
|
+
</span>
|
|
133
|
+
),
|
|
134
|
+
);
|
|
200
135
|
};
|
|
201
136
|
|
|
202
137
|
const renderSeatPrices = () => {
|
|
@@ -4,7 +4,7 @@ interface ServiceBadgesProps {
|
|
|
4
4
|
showTopLabel?: string;
|
|
5
5
|
isSoldOut: boolean;
|
|
6
6
|
colors: any;
|
|
7
|
-
renderIcon: (iconKey: string, size?: string) => React.ReactNode;
|
|
7
|
+
renderIcon: (iconKey: string, size?: string, styles?: any) => React.ReactNode;
|
|
8
8
|
translation?: {
|
|
9
9
|
directService?: string;
|
|
10
10
|
};
|
|
@@ -36,9 +36,11 @@ const ServiceBadges: React.FC<ServiceBadgesProps> = ({
|
|
|
36
36
|
color: isSoldOut ? "#ccc" : colors.topLabelColor,
|
|
37
37
|
}}
|
|
38
38
|
>
|
|
39
|
-
<div className={isSoldOut ? "grayscale" : ""}>
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
{/* <div className={isSoldOut ? "grayscale" : ""}> */}
|
|
40
|
+
{renderIcon("specialDeparture", "12px", {
|
|
41
|
+
filter: isSoldOut ? "grayscale(0.5)" : "",
|
|
42
|
+
})}
|
|
43
|
+
{/* </div> */}
|
|
42
44
|
<div>{showTopLabel}</div>
|
|
43
45
|
</div>
|
|
44
46
|
)}
|
|
@@ -25,7 +25,6 @@ interface DateTimeSectionMobileProps {
|
|
|
25
25
|
tooltipBgColor?: string;
|
|
26
26
|
showLastSeats?: boolean;
|
|
27
27
|
discountSeatPriceColor?: string;
|
|
28
|
-
isTrain?: boolean;
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
const pad = (n: number) => (n < 10 ? "0" + n : String(n));
|
|
@@ -68,43 +67,41 @@ const TimeRow: React.FC<TimeRowProps> = ({
|
|
|
68
67
|
isSoldOut,
|
|
69
68
|
}) => {
|
|
70
69
|
const formattedDate = DateService.getServiceItemDate(date);
|
|
71
|
-
const dotPositionClass = formattedDate.includes("dom")
|
|
72
|
-
|
|
73
|
-
:
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
<
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
>
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
<div className="font-[900] relative black-text">{timeContent}</div>
|
|
104
|
-
</div>
|
|
70
|
+
const dotPositionClass = formattedDate.includes("dom") ? "max-[399px]:left-[53%]" : "";
|
|
71
|
+
return <div
|
|
72
|
+
className={`flex items-center min-[420]:text-[13px] text-[12px] justify-between ${
|
|
73
|
+
isSoldOut ? "text-[#c0c0c0]" : ""
|
|
74
|
+
}`}
|
|
75
|
+
>
|
|
76
|
+
<div className="flex items-center" style={{ flex: 1 }}>
|
|
77
|
+
<div>
|
|
78
|
+
{" "}
|
|
79
|
+
{label ? (
|
|
80
|
+
<div className="w-[60px]">{label}</div>
|
|
81
|
+
) : (
|
|
82
|
+
<div className="w-[12px] h-auto mr-[5px]">
|
|
83
|
+
<img
|
|
84
|
+
src={icon}
|
|
85
|
+
alt={alt}
|
|
86
|
+
className={`w-[12px] h-auto mr-[5px] ${
|
|
87
|
+
isSoldOut ? "grayscale" : ""
|
|
88
|
+
}`}
|
|
89
|
+
/>
|
|
90
|
+
</div>
|
|
91
|
+
)}
|
|
92
|
+
</div>
|
|
93
|
+
<div
|
|
94
|
+
className="flex items-center relative capitalize justify-between"
|
|
95
|
+
style={{ flex: 1 }}
|
|
96
|
+
>
|
|
97
|
+
<span className="cursor-pointer black-text">
|
|
98
|
+
{formattedDate}
|
|
99
|
+
</span>
|
|
100
|
+
<div className={`absolute left-[50%] ${dotPositionClass}`}>•</div>
|
|
101
|
+
<div className="font-[900] relative black-text">{timeContent}</div>
|
|
105
102
|
</div>
|
|
106
103
|
</div>
|
|
107
|
-
|
|
104
|
+
</div>;
|
|
108
105
|
};
|
|
109
106
|
|
|
110
107
|
function DateTimeSectionMobile({
|
|
@@ -130,7 +127,6 @@ function DateTimeSectionMobile({
|
|
|
130
127
|
tooltipBgColor,
|
|
131
128
|
showLastSeats,
|
|
132
129
|
discountSeatPriceColor,
|
|
133
|
-
isTrain,
|
|
134
130
|
}: DateTimeSectionMobileProps): React.ReactElement {
|
|
135
131
|
const { cleaned: cleanedDepTime, hasAM, hasPM } = getCleanedDepTime(depTime);
|
|
136
132
|
|
|
@@ -157,12 +153,8 @@ function DateTimeSectionMobile({
|
|
|
157
153
|
>
|
|
158
154
|
{/* DATE AND TIME */}
|
|
159
155
|
<div
|
|
160
|
-
className=
|
|
161
|
-
style={{
|
|
162
|
-
justifyContent: isCiva && "center",
|
|
163
|
-
minHeight: isTrain ? undefined : "2.5rem",
|
|
164
|
-
alignSelf: isTrain ? "stretch" : undefined,
|
|
165
|
-
}}
|
|
156
|
+
className="min-h-[2.5rem] flex flex-col justify-between gap-[4px] w-[50%] "
|
|
157
|
+
style={{ justifyContent: isCiva && "center" }}
|
|
166
158
|
>
|
|
167
159
|
<TimeRow
|
|
168
160
|
label={orignLabel}
|
|
@@ -206,7 +198,6 @@ function DateTimeSectionMobile({
|
|
|
206
198
|
tooltipBgColor={tooltipBgColor}
|
|
207
199
|
showLastSeats={showLastSeats}
|
|
208
200
|
discountSeatPriceColor={discountSeatPriceColor}
|
|
209
|
-
isTrain={isTrain}
|
|
210
201
|
/>
|
|
211
202
|
</div>
|
|
212
203
|
);
|
|
@@ -31,7 +31,6 @@ interface SeatSectionMobileProps {
|
|
|
31
31
|
tooltipBgColor?: string;
|
|
32
32
|
showLastSeats?: boolean;
|
|
33
33
|
discountSeatPriceColor?: string;
|
|
34
|
-
isTrain?: boolean;
|
|
35
34
|
}
|
|
36
35
|
|
|
37
36
|
interface SeatRowProps {
|
|
@@ -43,7 +42,6 @@ interface SeatRowProps {
|
|
|
43
42
|
seatPriceColor: string;
|
|
44
43
|
hasMultipleTypes: boolean;
|
|
45
44
|
textSize: string;
|
|
46
|
-
isTrain?: boolean;
|
|
47
45
|
}
|
|
48
46
|
|
|
49
47
|
const SeatRow: React.FC<SeatRowProps> = ({
|
|
@@ -55,7 +53,6 @@ const SeatRow: React.FC<SeatRowProps> = ({
|
|
|
55
53
|
seatPriceColor,
|
|
56
54
|
hasMultipleTypes,
|
|
57
55
|
textSize,
|
|
58
|
-
isTrain,
|
|
59
56
|
}) => {
|
|
60
57
|
if (EXCEPTIONS.includes(type.label)) return null;
|
|
61
58
|
|
|
@@ -72,9 +69,7 @@ const SeatRow: React.FC<SeatRowProps> = ({
|
|
|
72
69
|
className={`min-[420]:text-[13px] ${textSize} `}
|
|
73
70
|
style={{ color: labelColor }}
|
|
74
71
|
>
|
|
75
|
-
{
|
|
76
|
-
? commonService.truncateSeatLabel(displayLabel, 8)
|
|
77
|
-
: displayLabel}
|
|
72
|
+
{displayLabel}
|
|
78
73
|
</span>
|
|
79
74
|
<span
|
|
80
75
|
className={`min-[420]:text-[13px] ${textSize} bold-text`}
|
|
@@ -123,7 +118,6 @@ function SeatSectionMobile({
|
|
|
123
118
|
tooltipBgColor,
|
|
124
119
|
showLastSeats,
|
|
125
120
|
discountSeatPriceColor,
|
|
126
|
-
isTrain,
|
|
127
121
|
}: SeatSectionMobileProps): React.ReactElement {
|
|
128
122
|
const hasMultipleTypes = (seatTypesData?.length ?? 0) > 2;
|
|
129
123
|
|
|
@@ -284,17 +278,15 @@ function SeatSectionMobile({
|
|
|
284
278
|
seatPriceColor={seatPriceColor}
|
|
285
279
|
hasMultipleTypes={hasMultipleTypes}
|
|
286
280
|
textSize="text-[11px]"
|
|
287
|
-
isTrain={isTrain}
|
|
288
281
|
/>
|
|
289
282
|
));
|
|
290
283
|
}
|
|
291
284
|
|
|
292
|
-
|
|
285
|
+
return seatTypesData
|
|
293
286
|
?.filter((item) => getFilteredSeats(item.label))
|
|
294
|
-
?.sort((a, b) => a.fare - b.fare)
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
(type, i) => (
|
|
287
|
+
?.sort((a, b) => a.fare - b.fare)
|
|
288
|
+
?.slice(0, 2)
|
|
289
|
+
?.map((type, i) => (
|
|
298
290
|
<SeatRow
|
|
299
291
|
key={i}
|
|
300
292
|
type={type}
|
|
@@ -305,20 +297,16 @@ function SeatSectionMobile({
|
|
|
305
297
|
seatPriceColor={seatPriceColor}
|
|
306
298
|
hasMultipleTypes={hasMultipleTypes}
|
|
307
299
|
textSize="text-[12px]"
|
|
308
|
-
isTrain={isTrain}
|
|
309
300
|
/>
|
|
310
|
-
)
|
|
311
|
-
);
|
|
301
|
+
));
|
|
312
302
|
};
|
|
313
303
|
|
|
314
304
|
const seats = removeDuplicateSeats
|
|
315
305
|
? getUniqueSeats(seatTypesData, 3)
|
|
316
|
-
:
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
return isTrain ? filtered : filtered?.slice(0, 2);
|
|
321
|
-
})();
|
|
306
|
+
: seatTypesData
|
|
307
|
+
?.filter((item) => getFilteredSeats(item.label))
|
|
308
|
+
?.sort((a, b) => a.fare - b.fare)
|
|
309
|
+
?.slice(0, 2);
|
|
322
310
|
|
|
323
311
|
const discountedSeats = seats?.map((seat) => ({
|
|
324
312
|
...seat,
|
|
@@ -553,7 +541,7 @@ function SeatSectionMobile({
|
|
|
553
541
|
</div>
|
|
554
542
|
) : (
|
|
555
543
|
<div
|
|
556
|
-
className=
|
|
544
|
+
className="flex flex-col justify-between h-[2.5rem] "
|
|
557
545
|
style={{
|
|
558
546
|
gap: isSoldOut ? "0px" : "5px",
|
|
559
547
|
justifyContent: hasMultipleTypes ? "space-between" : "center",
|