kupos-ui-components-lib 9.0.3 → 9.0.5

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.
@@ -38,6 +38,7 @@ import StageTooltip from "../../ui/StagesTooltip";
38
38
  const SEAT_EXCEPTIONS = ["Asiento mascota"];
39
39
  function ServiceItemPB({ serviceItem, onBookButtonPress, colors, metaData, children, busStage, serviceDetailsLoading, cityOrigin, cityDestination, translation, orignLabel, destinationLabel, currencySign, isCiva, showRating, showLastSeats, removeArrivalTime, removeDuplicateSeats, isPeruSites, showAvailableSeats, isSeatIcon, isLinatal, isPeru, t = (key) => key, siteType, isAllinBus, }) {
40
40
  var _a, _b;
41
+ console.log("🚀 ~ ServiceItemPB ~ serviceItem:", serviceItem);
41
42
  const animationMap = {
42
43
  promoAnim: {
43
44
  kupos: promoAnimation,
@@ -74,7 +74,7 @@ function ServiceItemMobile({ serviceItem, onBookButtonPress, colors, busStage, o
74
74
  React.createElement("span", { className: "min-[420]:text-[13px] text-[11px] ", style: {
75
75
  // marginLeft: "10px",
76
76
  color: isSoldOut ? "#bbb" : "#464647",
77
- } }, type.label),
77
+ } }, commonService.truncateSeatLabel(type.label)),
78
78
  React.createElement("span", { className: "min-[420]:text-[13px] text-[11px] bold-text", style: { color: isSoldOut ? "#bbb" : colors.seatPriceColor } }, (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.available_seats) <= 0 && !isPeru
79
79
  ? commonService.currency(0, currencySign)
80
80
  : commonService.currency(type.fare, currencySign))));
@@ -183,11 +183,11 @@ function ServiceItemMobile({ serviceItem, onBookButtonPress, colors, busStage, o
183
183
  : typeof raw === "string"
184
184
  ? raw.split("|").filter(Boolean)
185
185
  : [];
186
- const nodes = list
187
- .slice(0, 2)
188
- .map((am, i) => {
186
+ const nodes = list.slice(0, 2).map((am, i) => {
189
187
  var _a;
190
- return (React.createElement("img", { key: i, className: "amenity", height: 14, width: 14, src: getAmenitiesImage((_a = amenitiesData === null || amenitiesData === void 0 ? void 0 : amenitiesData[am]) === null || _a === void 0 ? void 0 : _a.toLowerCase()), alt: "icon" }));
188
+ return (React.createElement("img", { key: i, className: "amenity", height: 14, width: 14,
189
+ // src={getAmenitiesImage(amenitiesData?.[am]?.toLowerCase())}
190
+ src: commonService.getAmenitiesImage((_a = amenitiesData === null || amenitiesData === void 0 ? void 0 : amenitiesData[am]) === null || _a === void 0 ? void 0 : _a.toLowerCase(), serviceItem), alt: "icon" }));
191
191
  });
192
192
  return nodes;
193
193
  };
package/dist/styles.css CHANGED
@@ -3,6 +3,9 @@
3
3
  .pointer-events-none {
4
4
  pointer-events: none;
5
5
  }
6
+ .visible {
7
+ visibility: visible;
8
+ }
6
9
  .absolute {
7
10
  position: absolute;
8
11
  }
@@ -1,78 +1,83 @@
1
1
  import React from "react";
2
2
  import LottiePlayer from "../assets/LottiePlayer";
3
- const AmenitiesBlock = ({ serviceItem, metaData, isSoldOut, colors, isPeru, getAnimationIcon, getAmenityName, SvgAmenities, }) => {
4
- var _a, _b;
5
- if (!metaData ||
6
- !((_a = serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.operator_details) === null || _a === void 0 ? void 0 : _a[4]) ||
7
- !serviceItem.operator_details[4].length) {
8
- return null;
9
- }
10
- const PRIORITY_IDS = ["2", "3", "13"];
11
- const amenities = [...serviceItem.operator_details[4]];
12
- const priorityAmenities = amenities.filter((id) => PRIORITY_IDS.includes(id));
13
- const nonPriorityAmenities = amenities.filter((id) => !PRIORITY_IDS.includes(id));
14
- const hasPriority = priorityAmenities.length > 0;
3
+ const DEFAULT_PRIORITY_IDS = ["2", "3", "13"];
4
+ const TOOLTIP_CLASS = "hidden group-hover:block absolute top-[30px] left-1/2 -translate-x-1/2 text-white rounded-[14px] whitespace-nowrap mt-2.5 text-center shadow-service text-[13.33px]";
5
+ const getAmenityBaseName = (amenityStr) => { var _a; return (_a = amenityStr === null || amenityStr === void 0 ? void 0 : amenityStr.split(".")[0]) !== null && _a !== void 0 ? _a : ""; };
6
+ const isWater = (amenityStr) => { var _a; return ((_a = getAmenityBaseName(amenityStr)) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === "WATER"; };
7
+ const TooltipArrow = ({ color }) => (React.createElement("div", { className: "tooltip-arrow absolute -top-[7px] left-1/2 -translate-x-1/2 w-0 h-0 border-l-8 border-r-8 border-b-8 border-l-transparent border-r-transparent", style: { borderBottomColor: color } }));
8
+ const getAmenitySplit = ({ isPeru, amenities, priorityIds }) => {
9
+ const priority = amenities.filter((id) => priorityIds.includes(id));
10
+ const nonPriority = amenities.filter((id) => !priorityIds.includes(id));
11
+ const hasPriority = priority.length > 0;
15
12
  /* ============================
16
13
  🇵🇪 PERU LOGIC
17
14
  ============================ */
18
- let visibleAmenities = [];
19
- let shouldShowPlus = false;
20
- let plusAmenities = [];
21
15
  if (isPeru) {
22
- if (hasPriority) {
23
- visibleAmenities = priorityAmenities;
24
- shouldShowPlus = nonPriorityAmenities.length > 0;
25
- plusAmenities = nonPriorityAmenities;
26
- }
27
- else {
28
- visibleAmenities = [];
29
- shouldShowPlus = amenities.length > 0;
30
- plusAmenities = amenities;
31
- }
16
+ return hasPriority
17
+ ? { visible: priority, plus: nonPriority }
18
+ : { visible: [], plus: amenities };
32
19
  }
33
20
  /* ============================
34
21
  🌍 NON-PERU LOGIC
35
22
  ============================ */
36
- if (!isPeru) {
37
- const sortedAmenities = [...amenities].sort((a, b) => Number(PRIORITY_IDS.includes(b)) - Number(PRIORITY_IDS.includes(a)));
38
- visibleAmenities = sortedAmenities.slice(0, 3);
39
- shouldShowPlus = sortedAmenities.length > 3;
40
- plusAmenities = sortedAmenities.slice(3);
23
+ const sorted = [...amenities].sort((a, b) => Number(priorityIds.includes(b)) - Number(priorityIds.includes(a)));
24
+ return {
25
+ visible: sorted.slice(0, 3),
26
+ plus: sorted.slice(3),
27
+ };
28
+ };
29
+ const AmenitiesBlock = ({ serviceItem, metaData, isSoldOut, colors, isPeru, getAnimationIcon, getAmenityName, SvgAmenities, }) => {
30
+ var _a, _b, _c;
31
+ if (!metaData ||
32
+ !((_a = serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.operator_details) === null || _a === void 0 ? void 0 : _a[4]) ||
33
+ !serviceItem.operator_details[4].length) {
34
+ return null;
41
35
  }
36
+ const operatorPriorityIds = (_b = serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.operator_details) === null || _b === void 0 ? void 0 : _b[5];
37
+ const priorityIds = (operatorPriorityIds === null || operatorPriorityIds === void 0 ? void 0 : operatorPriorityIds.length) > 0
38
+ ? operatorPriorityIds
39
+ : DEFAULT_PRIORITY_IDS;
40
+ const amenities = [...serviceItem.operator_details[4]];
41
+ const { visible: visibleAmenities, plus: plusAmenities } = getAmenitySplit({
42
+ isPeru,
43
+ amenities,
44
+ priorityIds,
45
+ });
46
+ const shouldShowPlus = plusAmenities.length > 0;
47
+ const grayscaleClass = isSoldOut ? "grayscale" : "";
42
48
  return (React.createElement("div", { className: "flex items-center gap-[6px]" },
43
- (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.is_tracking_enabled) && (React.createElement("div", { className: isSoldOut ? "grayscale" : "" },
49
+ (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.is_tracking_enabled) && (React.createElement("div", { className: grayscaleClass },
44
50
  React.createElement(LottiePlayer, { animationData: getAnimationIcon("locationAnim"), width: "20px", height: "20px" }))),
45
51
  visibleAmenities.map((val, key) => {
46
- var _a, _b, _c, _d, _e, _f, _g;
47
- return ((_b = (_a = metaData.amenities[val]) === null || _a === void 0 ? void 0 : _a.split(".")[0]) === null || _b === void 0 ? void 0 : _b.toUpperCase()) !== "WATER" ? (React.createElement("div", { key: key, className: "relative group cursor-pointer" },
48
- React.createElement("div", { className: `${isSoldOut ? "grayscale" : ""}` },
49
- React.createElement(SvgAmenities, { moreAnemities: false, name: (_d = (_c = metaData.amenities[val]) === null || _c === void 0 ? void 0 : _c.split(".")[0]) === null || _d === void 0 ? void 0 : _d.toLowerCase() })),
50
- React.createElement("div", { className: "hidden group-hover:block absolute top-[30px] left-1/2 -translate-x-1/2 text-white rounded-[14px] whitespace-nowrap mt-2.5 text-center shadow-service text-[13.33px]", style: {
52
+ const raw = metaData.amenities[val];
53
+ if (isWater(raw))
54
+ return null;
55
+ const baseName = getAmenityBaseName(raw);
56
+ return (React.createElement("div", { key: key, className: "relative group cursor-pointer" },
57
+ React.createElement("div", { className: grayscaleClass },
58
+ React.createElement(SvgAmenities, { moreAnemities: false, name: baseName.toLowerCase() })),
59
+ React.createElement("div", { className: TOOLTIP_CLASS, style: {
51
60
  backgroundColor: colors.tooltipColor,
52
61
  zIndex: 21,
53
62
  padding: "12px",
54
63
  } },
55
- React.createElement("div", { className: "tooltip-arrow absolute -top-[7px] left-1/2 -translate-x-1/2 w-0 h-0 border-l-8 border-r-8 border-b-8 border-l-transparent border-r-transparent", style: {
56
- borderBottomColor: colors.tooltipColor,
57
- } }),
58
- getAmenityName((_g = (_f = (_e = metaData.amenities[val]) === null || _e === void 0 ? void 0 : _e.split(".")[0]) === null || _f === void 0 ? void 0 : _f.split("_")) === null || _g === void 0 ? void 0 : _g.join(" "))))) : null;
64
+ React.createElement(TooltipArrow, { color: colors.tooltipColor }),
65
+ getAmenityName(baseName.split("_").join(" ")))));
59
66
  }),
60
67
  shouldShowPlus && (React.createElement("div", { className: "relative ml-1 cursor-pointer" },
61
68
  React.createElement("div", { className: "group" },
62
- React.createElement("img", { src: ((_b = serviceItem.icons) === null || _b === void 0 ? void 0 : _b.plus) ||
69
+ React.createElement("img", { src: ((_c = serviceItem.icons) === null || _c === void 0 ? void 0 : _c.plus) ||
63
70
  "/images/icons/amenities/icon_plus.svg", className: "w-[16px] h-[16px]", alt: "plus" }),
64
- React.createElement("div", { style: { zIndex: 100 }, className: "hidden group-hover:block absolute top-[30px] left-1/2 -translate-x-1/2 text-white rounded-[14px] whitespace-nowrap mt-2.5 text-center shadow-service text-[13.33px]" },
65
- React.createElement("div", { className: "tooltip-arrow absolute -top-[7px] left-1/2 -translate-x-1/2 w-0 h-0 border-l-8 border-r-8 border-b-8 border-l-transparent border-r-transparent", style: {
66
- borderBottomColor: colors.tooltipColor,
67
- } }),
68
- React.createElement("div", { className: "flex flex-col gap-[10px] p-3 rounded-[8px] shadow-md", style: {
69
- backgroundColor: colors.tooltipColor,
70
- } }, plusAmenities.map((val, key) => {
71
- var _a, _b, _c, _d, _e, _f, _g;
72
- return ((_b = (_a = metaData.amenities[val]) === null || _a === void 0 ? void 0 : _a.split(".")[0]) === null || _b === void 0 ? void 0 : _b.toUpperCase()) !==
73
- "WATER" ? (React.createElement("div", { key: key, className: "flex items-center gap-[5px] text-xs whitespace-nowrap" },
74
- React.createElement(SvgAmenities, { moreAnemities: true, name: (_d = (_c = metaData.amenities[val]) === null || _c === void 0 ? void 0 : _c.split(".")[0]) === null || _d === void 0 ? void 0 : _d.toUpperCase(), color: "white" }),
75
- getAmenityName((_g = (_f = (_e = metaData.amenities[val]) === null || _e === void 0 ? void 0 : _e.split(".")[0]) === null || _f === void 0 ? void 0 : _f.split("_")) === null || _g === void 0 ? void 0 : _g.join(" ")))) : null;
71
+ React.createElement("div", { style: { zIndex: 100 }, className: TOOLTIP_CLASS },
72
+ React.createElement(TooltipArrow, { color: colors.tooltipColor }),
73
+ React.createElement("div", { className: "flex flex-col gap-[10px] p-3 rounded-[8px] shadow-md", style: { backgroundColor: colors.tooltipColor } }, plusAmenities.map((val, key) => {
74
+ const raw = metaData.amenities[val];
75
+ if (isWater(raw))
76
+ return null;
77
+ const baseName = getAmenityBaseName(raw);
78
+ return (React.createElement("div", { key: key, className: "flex items-center gap-[5px] text-xs whitespace-nowrap" },
79
+ React.createElement(SvgAmenities, { moreAnemities: true, name: baseName.toUpperCase(), color: "white" }),
80
+ getAmenityName(baseName.split("_").join(" "))));
76
81
  }))))))));
77
82
  };
78
83
  export default AmenitiesBlock;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kupos-ui-components-lib",
3
- "version": "9.0.3",
3
+ "version": "9.0.5",
4
4
  "description": "A reusable UI components package",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -72,6 +72,7 @@ function ServiceItemPB({
72
72
  siteType,
73
73
  isAllinBus,
74
74
  }: ServiceItemProps & { currencySign?: string }): React.ReactElement {
75
+ console.log("🚀 ~ ServiceItemPB ~ serviceItem:", serviceItem);
75
76
  const animationMap: Record<string, Record<string, any>> = {
76
77
  promoAnim: {
77
78
  kupos: promoAnimation,
@@ -116,8 +116,8 @@ function ServiceItemMobile({
116
116
  const uniqueSeats = Array.from(seatMap.values())
117
117
  .sort((a, b) => a.fare - b.fare)
118
118
  .slice(0, 3);
119
- return uniqueSeats.map((type, i) =>
120
- exceptions.includes(type.label) ? null : (
119
+ return uniqueSeats.map((type, i) => {
120
+ return exceptions.includes(type.label) ? null : (
121
121
  <div
122
122
  className={
123
123
  serviceItem.seat_types?.length > 2
@@ -133,7 +133,7 @@ function ServiceItemMobile({
133
133
  color: isSoldOut ? "#bbb" : "#464647",
134
134
  }}
135
135
  >
136
- {type.label}
136
+ {commonService.truncateSeatLabel(type.label)}
137
137
  </span>
138
138
  <span
139
139
  className={"min-[420]:text-[13px] text-[11px] bold-text"}
@@ -149,8 +149,8 @@ function ServiceItemMobile({
149
149
  : commonService.currency(type.fare, currencySign)}
150
150
  </span>
151
151
  </div>
152
- ),
153
- );
152
+ );
153
+ });
154
154
  };
155
155
 
156
156
  const getFilteredSeats = (item) => {
@@ -257,18 +257,20 @@ function ServiceItemMobile({
257
257
  ? raw.split("|").filter(Boolean)
258
258
  : [];
259
259
 
260
- const nodes = list
261
- .slice(0, 2)
262
- .map((am, i) => (
263
- <img
264
- key={i}
265
- className="amenity"
266
- height={14}
267
- width={14}
268
- src={getAmenitiesImage(amenitiesData?.[am]?.toLowerCase())}
269
- alt="icon"
270
- />
271
- ));
260
+ const nodes = list.slice(0, 2).map((am, i) => (
261
+ <img
262
+ key={i}
263
+ className="amenity"
264
+ height={14}
265
+ width={14}
266
+ // src={getAmenitiesImage(amenitiesData?.[am]?.toLowerCase())}
267
+ src={commonService.getAmenitiesImage(
268
+ amenitiesData?.[am]?.toLowerCase(),
269
+ serviceItem,
270
+ )}
271
+ alt="icon"
272
+ />
273
+ ));
272
274
 
273
275
  return nodes;
274
276
  };
@@ -1,6 +1,50 @@
1
1
  import React from "react";
2
2
  import LottiePlayer from "../assets/LottiePlayer";
3
3
 
4
+ const DEFAULT_PRIORITY_IDS = ["2", "3", "13"];
5
+
6
+ const TOOLTIP_CLASS =
7
+ "hidden group-hover:block absolute top-[30px] left-1/2 -translate-x-1/2 text-white rounded-[14px] whitespace-nowrap mt-2.5 text-center shadow-service text-[13.33px]";
8
+
9
+ const getAmenityBaseName = (amenityStr) => amenityStr?.split(".")[0] ?? "";
10
+
11
+ const isWater = (amenityStr) =>
12
+ getAmenityBaseName(amenityStr)?.toUpperCase() === "WATER";
13
+
14
+ const TooltipArrow = ({ color }) => (
15
+ <div
16
+ className="tooltip-arrow absolute -top-[7px] left-1/2 -translate-x-1/2 w-0 h-0 border-l-8 border-r-8 border-b-8 border-l-transparent border-r-transparent"
17
+ style={{ borderBottomColor: color }}
18
+ />
19
+ );
20
+
21
+ const getAmenitySplit = ({ isPeru, amenities, priorityIds }) => {
22
+ const priority = amenities.filter((id) => priorityIds.includes(id));
23
+ const nonPriority = amenities.filter((id) => !priorityIds.includes(id));
24
+ const hasPriority = priority.length > 0;
25
+
26
+ /* ============================
27
+ 🇵🇪 PERU LOGIC
28
+ ============================ */
29
+ if (isPeru) {
30
+ return hasPriority
31
+ ? { visible: priority, plus: nonPriority }
32
+ : { visible: [], plus: amenities };
33
+ }
34
+
35
+ /* ============================
36
+ 🌍 NON-PERU LOGIC
37
+ ============================ */
38
+ const sorted = [...amenities].sort(
39
+ (a, b) => Number(priorityIds.includes(b)) - Number(priorityIds.includes(a)),
40
+ );
41
+
42
+ return {
43
+ visible: sorted.slice(0, 3),
44
+ plus: sorted.slice(3),
45
+ };
46
+ };
47
+
4
48
  const AmenitiesBlock = ({
5
49
  serviceItem,
6
50
  metaData,
@@ -19,56 +63,28 @@ const AmenitiesBlock = ({
19
63
  return null;
20
64
  }
21
65
 
22
- const PRIORITY_IDS = ["2", "3", "13"];
66
+ const operatorPriorityIds = serviceItem?.operator_details?.[5];
67
+ const priorityIds =
68
+ operatorPriorityIds?.length > 0
69
+ ? operatorPriorityIds
70
+ : DEFAULT_PRIORITY_IDS;
23
71
 
24
72
  const amenities = [...serviceItem.operator_details[4]];
25
73
 
26
- const priorityAmenities = amenities.filter((id) => PRIORITY_IDS.includes(id));
27
-
28
- const nonPriorityAmenities = amenities.filter(
29
- (id) => !PRIORITY_IDS.includes(id),
30
- );
74
+ const { visible: visibleAmenities, plus: plusAmenities } = getAmenitySplit({
75
+ isPeru,
76
+ amenities,
77
+ priorityIds,
78
+ });
31
79
 
32
- const hasPriority = priorityAmenities.length > 0;
33
-
34
- /* ============================
35
- 🇵🇪 PERU LOGIC
36
- ============================ */
37
- let visibleAmenities = [];
38
- let shouldShowPlus = false;
39
- let plusAmenities = [];
40
-
41
- if (isPeru) {
42
- if (hasPriority) {
43
- visibleAmenities = priorityAmenities;
44
- shouldShowPlus = nonPriorityAmenities.length > 0;
45
- plusAmenities = nonPriorityAmenities;
46
- } else {
47
- visibleAmenities = [];
48
- shouldShowPlus = amenities.length > 0;
49
- plusAmenities = amenities;
50
- }
51
- }
52
-
53
- /* ============================
54
- 🌍 NON-PERU LOGIC
55
- ============================ */
56
- if (!isPeru) {
57
- const sortedAmenities = [...amenities].sort(
58
- (a, b) =>
59
- Number(PRIORITY_IDS.includes(b)) - Number(PRIORITY_IDS.includes(a)),
60
- );
61
-
62
- visibleAmenities = sortedAmenities.slice(0, 3);
63
- shouldShowPlus = sortedAmenities.length > 3;
64
- plusAmenities = sortedAmenities.slice(3);
65
- }
80
+ const shouldShowPlus = plusAmenities.length > 0;
81
+ const grayscaleClass = isSoldOut ? "grayscale" : "";
66
82
 
67
83
  return (
68
84
  <div className="flex items-center gap-[6px]">
69
85
  {/* GPS */}
70
86
  {serviceItem?.is_tracking_enabled && (
71
- <div className={isSoldOut ? "grayscale" : ""}>
87
+ <div className={grayscaleClass}>
72
88
  <LottiePlayer
73
89
  animationData={getAnimationIcon("locationAnim")}
74
90
  width="20px"
@@ -78,38 +94,35 @@ const AmenitiesBlock = ({
78
94
  )}
79
95
 
80
96
  {/* AMENITIES */}
81
- {visibleAmenities.map((val, key) =>
82
- metaData.amenities[val]?.split(".")[0]?.toUpperCase() !== "WATER" ? (
97
+ {visibleAmenities.map((val, key) => {
98
+ const raw = metaData.amenities[val];
99
+ if (isWater(raw)) return null;
100
+ const baseName = getAmenityBaseName(raw);
101
+
102
+ return (
83
103
  <div key={key} className="relative group cursor-pointer">
84
- <div className={`${isSoldOut ? "grayscale" : ""}`}>
104
+ <div className={grayscaleClass}>
85
105
  <SvgAmenities
86
106
  moreAnemities={false}
87
- name={metaData.amenities[val]?.split(".")[0]?.toLowerCase()}
107
+ name={baseName.toLowerCase()}
88
108
  />
89
109
  </div>
90
110
 
91
111
  {/* Tooltip */}
92
112
  <div
93
- className="hidden group-hover:block absolute top-[30px] left-1/2 -translate-x-1/2 text-white rounded-[14px] whitespace-nowrap mt-2.5 text-center shadow-service text-[13.33px]"
113
+ className={TOOLTIP_CLASS}
94
114
  style={{
95
115
  backgroundColor: colors.tooltipColor,
96
116
  zIndex: 21,
97
117
  padding: "12px",
98
118
  }}
99
119
  >
100
- <div
101
- className="tooltip-arrow absolute -top-[7px] left-1/2 -translate-x-1/2 w-0 h-0 border-l-8 border-r-8 border-b-8 border-l-transparent border-r-transparent"
102
- style={{
103
- borderBottomColor: colors.tooltipColor,
104
- }}
105
- />
106
- {getAmenityName(
107
- metaData.amenities[val]?.split(".")[0]?.split("_")?.join(" "),
108
- )}
120
+ <TooltipArrow color={colors.tooltipColor} />
121
+ {getAmenityName(baseName.split("_").join(" "))}
109
122
  </div>
110
123
  </div>
111
- ) : null,
112
- )}
124
+ );
125
+ })}
113
126
 
114
127
  {/* PLUS ICON */}
115
128
  {shouldShowPlus && (
@@ -124,46 +137,32 @@ const AmenitiesBlock = ({
124
137
  alt="plus"
125
138
  />
126
139
 
127
- <div
128
- style={{ zIndex: 100 }}
129
- className="hidden group-hover:block absolute top-[30px] left-1/2 -translate-x-1/2 text-white rounded-[14px] whitespace-nowrap mt-2.5 text-center shadow-service text-[13.33px]"
130
- >
131
- <div
132
- className="tooltip-arrow absolute -top-[7px] left-1/2 -translate-x-1/2 w-0 h-0 border-l-8 border-r-8 border-b-8 border-l-transparent border-r-transparent"
133
- style={{
134
- borderBottomColor: colors.tooltipColor,
135
- }}
136
- ></div>
140
+ <div style={{ zIndex: 100 }} className={TOOLTIP_CLASS}>
141
+ <TooltipArrow color={colors.tooltipColor} />
137
142
 
138
143
  <div
139
144
  className="flex flex-col gap-[10px] p-3 rounded-[8px] shadow-md"
140
- style={{
141
- backgroundColor: colors.tooltipColor,
142
- }}
145
+ style={{ backgroundColor: colors.tooltipColor }}
143
146
  >
144
- {plusAmenities.map((val, key) =>
145
- metaData.amenities[val]?.split(".")[0]?.toUpperCase() !==
146
- "WATER" ? (
147
+ {plusAmenities.map((val, key) => {
148
+ const raw = metaData.amenities[val];
149
+ if (isWater(raw)) return null;
150
+ const baseName = getAmenityBaseName(raw);
151
+
152
+ return (
147
153
  <div
148
154
  key={key}
149
155
  className="flex items-center gap-[5px] text-xs whitespace-nowrap"
150
156
  >
151
157
  <SvgAmenities
152
158
  moreAnemities={true}
153
- name={metaData.amenities[val]
154
- ?.split(".")[0]
155
- ?.toUpperCase()}
159
+ name={baseName.toUpperCase()}
156
160
  color="white"
157
161
  />
158
- {getAmenityName(
159
- metaData.amenities[val]
160
- ?.split(".")[0]
161
- ?.split("_")
162
- ?.join(" "),
163
- )}
162
+ {getAmenityName(baseName.split("_").join(" "))}
164
163
  </div>
165
- ) : null,
166
- )}
164
+ );
165
+ })}
167
166
  </div>
168
167
  </div>
169
168
  </div>