@devtravelcode/widget-native 1.0.0
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/LICENSE +18 -0
- package/dist/App.d.ts +10 -0
- package/dist/App.js +192 -0
- package/dist/TravelHubWidget.d.ts +12 -0
- package/dist/TravelHubWidget.js +58 -0
- package/dist/components/ErrorBoundary.d.ts +18 -0
- package/dist/components/ErrorBoundary.js +63 -0
- package/dist/components/ui/Modal.d.ts +11 -0
- package/dist/components/ui/Modal.js +66 -0
- package/dist/components/ui/Skeleton.d.ts +8 -0
- package/dist/components/ui/Skeleton.js +33 -0
- package/dist/components/ui/badge.d.ts +11 -0
- package/dist/components/ui/badge.js +54 -0
- package/dist/components/ui/button.d.ts +14 -0
- package/dist/components/ui/button.js +101 -0
- package/dist/components/ui/card.d.ts +16 -0
- package/dist/components/ui/card.js +51 -0
- package/dist/components/ui/input.d.ts +8 -0
- package/dist/components/ui/input.js +61 -0
- package/dist/components/ui/label.d.ts +8 -0
- package/dist/components/ui/label.js +17 -0
- package/dist/context/WidgetContext.d.ts +29 -0
- package/dist/context/WidgetContext.js +64 -0
- package/dist/icons/CarIcon.d.ts +4 -0
- package/dist/icons/CarIcon.js +3 -0
- package/dist/icons/CloseIcon.d.ts +7 -0
- package/dist/icons/CloseIcon.js +3 -0
- package/dist/icons/FlightIcon.d.ts +4 -0
- package/dist/icons/FlightIcon.js +3 -0
- package/dist/icons/HotelIcon.d.ts +4 -0
- package/dist/icons/HotelIcon.js +3 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +3 -0
- package/dist/locales/widgetTranslations.d.ts +1 -0
- package/dist/locales/widgetTranslations.js +732 -0
- package/dist/modules/hooks/useAirportSearch.d.ts +21 -0
- package/dist/modules/hooks/useAirportSearch.js +48 -0
- package/dist/modules/hooks/useCarOffers.d.ts +7 -0
- package/dist/modules/hooks/useCarOffers.js +47 -0
- package/dist/modules/hooks/useCountriesByCodes.d.ts +4 -0
- package/dist/modules/hooks/useCountriesByCodes.js +60 -0
- package/dist/modules/hooks/useCountriesSearch.d.ts +11 -0
- package/dist/modules/hooks/useCountriesSearch.js +55 -0
- package/dist/modules/hooks/useDefaultHotelLocation.d.ts +7 -0
- package/dist/modules/hooks/useDefaultHotelLocation.js +44 -0
- package/dist/modules/hooks/useDetectNationality.d.ts +1 -0
- package/dist/modules/hooks/useDetectNationality.js +20 -0
- package/dist/modules/hooks/useFlightSearch.d.ts +20 -0
- package/dist/modules/hooks/useFlightSearch.js +243 -0
- package/dist/modules/hooks/useHotelDetails.d.ts +7 -0
- package/dist/modules/hooks/useHotelDetails.js +80 -0
- package/dist/modules/hooks/useHotelLocations.d.ts +5 -0
- package/dist/modules/hooks/useHotelLocations.js +42 -0
- package/dist/modules/hooks/useHotelMapData.d.ts +12 -0
- package/dist/modules/hooks/useHotelMapData.js +78 -0
- package/dist/modules/hooks/useHotelOffers.d.ts +11 -0
- package/dist/modules/hooks/useHotelOffers.js +122 -0
- package/dist/modules/hooks/useHotelSearchSSE.d.ts +18 -0
- package/dist/modules/hooks/useHotelSearchSSE.js +411 -0
- package/dist/modules/hooks/useSearchExpiration.d.ts +6 -0
- package/dist/modules/hooks/useSearchExpiration.js +35 -0
- package/dist/modules/hooks/useTranslationsHub.d.ts +5 -0
- package/dist/modules/hooks/useTranslationsHub.js +48 -0
- package/dist/modules/navbar/Navbar.d.ts +8 -0
- package/dist/modules/navbar/Navbar.js +69 -0
- package/dist/modules/search-form/AgeSelector.d.ts +9 -0
- package/dist/modules/search-form/AgeSelector.js +109 -0
- package/dist/modules/search-form/CustomSelect.d.ts +14 -0
- package/dist/modules/search-form/CustomSelect.js +94 -0
- package/dist/modules/search-form/FiltersSkeleton.d.ts +6 -0
- package/dist/modules/search-form/FiltersSkeleton.js +35 -0
- package/dist/modules/search-form/NationalityInput.d.ts +18 -0
- package/dist/modules/search-form/NationalityInput.js +172 -0
- package/dist/modules/search-form/Pagination.d.ts +8 -0
- package/dist/modules/search-form/Pagination.js +84 -0
- package/dist/modules/search-form/SearchExpiredPopup.d.ts +10 -0
- package/dist/modules/search-form/SearchExpiredPopup.js +91 -0
- package/dist/modules/search-form/SkeletonWidget.d.ts +2 -0
- package/dist/modules/search-form/SkeletonWidget.js +33 -0
- package/dist/modules/search-form/TimePicker.d.ts +9 -0
- package/dist/modules/search-form/TimePicker.js +182 -0
- package/dist/modules/search-form/cars/CarEmptyState.d.ts +6 -0
- package/dist/modules/search-form/cars/CarEmptyState.js +42 -0
- package/dist/modules/search-form/cars/CarFiltersSkeleton.d.ts +6 -0
- package/dist/modules/search-form/cars/CarFiltersSkeleton.js +35 -0
- package/dist/modules/search-form/cars/CarOffersList.d.ts +43 -0
- package/dist/modules/search-form/cars/CarOffersList.js +214 -0
- package/dist/modules/search-form/cars/CarResults.d.ts +25 -0
- package/dist/modules/search-form/cars/CarResults.js +116 -0
- package/dist/modules/search-form/cars/CarSearchForm.d.ts +19 -0
- package/dist/modules/search-form/cars/CarSearchForm.js +173 -0
- package/dist/modules/search-form/cars/CarSkeleton.d.ts +6 -0
- package/dist/modules/search-form/cars/CarSkeleton.js +46 -0
- package/dist/modules/search-form/cars/CarTopOffersSlider.d.ts +20 -0
- package/dist/modules/search-form/cars/CarTopOffersSlider.js +100 -0
- package/dist/modules/search-form/cars/car-filters/CarFilters.d.ts +8 -0
- package/dist/modules/search-form/cars/car-filters/CarFilters.js +318 -0
- package/dist/modules/search-form/cars/car-filters/FilterSection.d.ts +9 -0
- package/dist/modules/search-form/cars/car-filters/FilterSection.js +30 -0
- package/dist/modules/search-form/cars/car-filters/index.d.ts +6 -0
- package/dist/modules/search-form/cars/car-filters/index.js +3 -0
- package/dist/modules/search-form/cars/car-filters/useCarFilters.d.ts +24 -0
- package/dist/modules/search-form/cars/car-filters/useCarFilters.js +121 -0
- package/dist/modules/search-form/flight/AirlinesSelector.d.ts +8 -0
- package/dist/modules/search-form/flight/AirlinesSelector.js +235 -0
- package/dist/modules/search-form/flight/CabinClassSelector.d.ts +9 -0
- package/dist/modules/search-form/flight/CabinClassSelector.js +63 -0
- package/dist/modules/search-form/flight/DatePicker.d.ts +12 -0
- package/dist/modules/search-form/flight/DatePicker.js +536 -0
- package/dist/modules/search-form/flight/FlightSearchForm.d.ts +18 -0
- package/dist/modules/search-form/flight/FlightSearchForm.js +147 -0
- package/dist/modules/search-form/flight/LocationInput.d.ts +11 -0
- package/dist/modules/search-form/flight/LocationInput.js +294 -0
- package/dist/modules/search-form/flight/PassengersPicker.d.ts +16 -0
- package/dist/modules/search-form/flight/PassengersPicker.js +203 -0
- package/dist/modules/search-form/flight/SwitchLocationBtn.d.ts +9 -0
- package/dist/modules/search-form/flight/SwitchLocationBtn.js +48 -0
- package/dist/modules/search-form/flight/flight-filters/FiltersContent.d.ts +21 -0
- package/dist/modules/search-form/flight/flight-filters/FiltersContent.js +145 -0
- package/dist/modules/search-form/flight/flight-filters/FlightFiltersDynamic.d.ts +11 -0
- package/dist/modules/search-form/flight/flight-filters/FlightFiltersDynamic.js +213 -0
- package/dist/modules/search-form/flight/flight-filters/RangeBlock.d.ts +22 -0
- package/dist/modules/search-form/flight/flight-filters/RangeBlock.js +164 -0
- package/dist/modules/search-form/flight/flight-filters/index.d.ts +1 -0
- package/dist/modules/search-form/flight/flight-filters/index.js +1 -0
- package/dist/modules/search-form/flight/flight-results/FlightAdditionalInfo.d.ts +16 -0
- package/dist/modules/search-form/flight/flight-results/FlightAdditionalInfo.js +229 -0
- package/dist/modules/search-form/flight/flight-results/FlightBaggageToggle.d.ts +15 -0
- package/dist/modules/search-form/flight/flight-results/FlightBaggageToggle.js +110 -0
- package/dist/modules/search-form/flight/flight-results/FlightCard.d.ts +14 -0
- package/dist/modules/search-form/flight/flight-results/FlightCard.js +436 -0
- package/dist/modules/search-form/flight/flight-results/FlightInfo.d.ts +12 -0
- package/dist/modules/search-form/flight/flight-results/FlightInfo.js +48 -0
- package/dist/modules/search-form/flight/flight-results/FlightPriceBlock.d.ts +11 -0
- package/dist/modules/search-form/flight/flight-results/FlightPriceBlock.js +36 -0
- package/dist/modules/search-form/flight/flight-results/FlightResults.d.ts +22 -0
- package/dist/modules/search-form/flight/flight-results/FlightResults.js +109 -0
- package/dist/modules/search-form/flight/flight-results/FlightSegments.d.ts +40 -0
- package/dist/modules/search-form/flight/flight-results/FlightSegments.js +162 -0
- package/dist/modules/search-form/flight/flight-results/FlightsSkeleton.d.ts +6 -0
- package/dist/modules/search-form/flight/flight-results/FlightsSkeleton.js +52 -0
- package/dist/modules/search-form/flight/flight-results/ProvidersLoader.d.ts +9 -0
- package/dist/modules/search-form/flight/flight-results/ProvidersLoader.js +242 -0
- package/dist/modules/search-form/hotel/DatePicker.d.ts +1 -0
- package/dist/modules/search-form/hotel/DatePicker.js +1 -0
- package/dist/modules/search-form/hotel/GuestSelector.d.ts +13 -0
- package/dist/modules/search-form/hotel/GuestSelector.js +272 -0
- package/dist/modules/search-form/hotel/GuestSelectorMobilePopup.d.ts +2 -0
- package/dist/modules/search-form/hotel/GuestSelectorMobilePopup.js +1 -0
- package/dist/modules/search-form/hotel/HotelLocation.d.ts +17 -0
- package/dist/modules/search-form/hotel/HotelLocation.js +178 -0
- package/dist/modules/search-form/hotel/HotelLocationMobilePopup.d.ts +2 -0
- package/dist/modules/search-form/hotel/HotelLocationMobilePopup.js +1 -0
- package/dist/modules/search-form/hotel/HotelResults.d.ts +21 -0
- package/dist/modules/search-form/hotel/HotelResults.js +333 -0
- package/dist/modules/search-form/hotel/HotelSearchForm.d.ts +13 -0
- package/dist/modules/search-form/hotel/HotelSearchForm.js +130 -0
- package/dist/modules/search-form/hotel/HotelsSkeleton.d.ts +6 -0
- package/dist/modules/search-form/hotel/HotelsSkeleton.js +40 -0
- package/dist/modules/search-form/hotel/PassengersPicker.d.ts +2 -0
- package/dist/modules/search-form/hotel/PassengersPicker.js +1 -0
- package/dist/modules/search-form/hotel/components/HotelCard.d.ts +11 -0
- package/dist/modules/search-form/hotel/components/HotelCard.js +180 -0
- package/dist/modules/search-form/hotel/components/HotelEmptyState.d.ts +6 -0
- package/dist/modules/search-form/hotel/components/HotelEmptyState.js +34 -0
- package/dist/modules/search-form/hotel/components/HotelGallery.d.ts +6 -0
- package/dist/modules/search-form/hotel/components/HotelGallery.js +77 -0
- package/dist/modules/search-form/hotel/components/HotelList.d.ts +9 -0
- package/dist/modules/search-form/hotel/components/HotelList.js +12 -0
- package/dist/modules/search-form/hotel/components/HotelMap.d.ts +26 -0
- package/dist/modules/search-form/hotel/components/HotelMap.js +707 -0
- package/dist/modules/search-form/hotel/components/HotelPin.d.ts +7 -0
- package/dist/modules/search-form/hotel/components/HotelPin.js +1 -0
- package/dist/modules/search-form/hotel/hotel-filters/HotelFilters.d.ts +29 -0
- package/dist/modules/search-form/hotel/hotel-filters/HotelFilters.js +339 -0
- package/dist/modules/search-form/hotel/hotel-filters/HotelFiltersBar.d.ts +3 -0
- package/dist/modules/search-form/hotel/hotel-filters/HotelFiltersBar.js +2 -0
- package/dist/modules/search-form/hotel/hotel-filters/HotelFiltersContent.d.ts +2 -0
- package/dist/modules/search-form/hotel/hotel-filters/HotelFiltersContent.js +1 -0
- package/dist/modules/search-form/hotel/hotel-filters/HotelFiltersDynamic.d.ts +2 -0
- package/dist/modules/search-form/hotel/hotel-filters/HotelFiltersDynamic.js +1 -0
- package/dist/modules/search-form/hotel/hotel-filters/HotelFiltersMobilePopup.d.ts +2 -0
- package/dist/modules/search-form/hotel/hotel-filters/HotelFiltersMobilePopup.js +1 -0
- package/dist/modules/search-form/hotel/hotel-filters/RangeBlock.d.ts +1 -0
- package/dist/modules/search-form/hotel/hotel-filters/RangeBlock.js +1 -0
- package/dist/modules/search-form/hotel/hotel-filters/index.d.ts +1 -0
- package/dist/modules/search-form/hotel/hotel-filters/index.js +1 -0
- package/dist/modules/tabs/FlightsTab.d.ts +1 -0
- package/dist/modules/tabs/FlightsTab.js +1 -0
- package/dist/modules/tabs/HotelsTab.d.ts +1 -0
- package/dist/modules/tabs/HotelsTab.js +1 -0
- package/dist/store/index.d.ts +22 -0
- package/dist/store/index.js +19 -0
- package/dist/theme/colors.d.ts +56 -0
- package/dist/theme/colors.js +56 -0
- package/dist/theme/formStyles.d.ts +76 -0
- package/dist/theme/formStyles.js +78 -0
- package/dist/utils/applyWidgetColors.d.ts +1 -0
- package/dist/utils/applyWidgetColors.js +2 -0
- package/dist/utils/dateTime.d.ts +2 -0
- package/dist/utils/dateTime.js +23 -0
- package/dist/utils/fetchSSE.d.ts +23 -0
- package/dist/utils/fetchSSE.js +104 -0
- package/dist/utils/getToken.d.ts +3 -0
- package/dist/utils/getToken.js +12 -0
- package/package.json +64 -0
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
|
+
import { View, Text, TouchableOpacity, Modal, ScrollView, StyleSheet, } from "react-native";
|
|
4
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
5
|
+
import Svg, { Path } from "react-native-svg";
|
|
6
|
+
import { Colors, Spacing, BorderRadius, FontSize } from "../../../theme/colors";
|
|
7
|
+
import { CloseIcon } from "../../../store";
|
|
8
|
+
import { formStyles } from "../../../theme/formStyles";
|
|
9
|
+
const ChevronDown = () => (_jsx(Svg, { width: 20, height: 20, viewBox: "0 0 20 20", fill: "none", children: _jsx(Path, { d: "M5 8L10 12.5L15 8", stroke: Colors.primary, strokeWidth: 2, strokeLinecap: "round" }) }));
|
|
10
|
+
const MAX_GUESTS = 20;
|
|
11
|
+
const AGE_OPTIONS = Array.from({ length: 18 }, (_, i) => i);
|
|
12
|
+
const GuestSelector = ({ value = [{ adults: 2, children: 0, childrenAges: [] }], onChange, translations, }) => {
|
|
13
|
+
const insets = useSafeAreaInsets();
|
|
14
|
+
const [rooms, setRooms] = useState(value);
|
|
15
|
+
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
onChange(rooms);
|
|
18
|
+
}, [rooms]);
|
|
19
|
+
const totalAdults = rooms.reduce((s, r) => s + r.adults, 0);
|
|
20
|
+
const totalChildren = rooms.reduce((s, r) => s + r.children, 0);
|
|
21
|
+
const totalGuests = totalAdults + totalChildren;
|
|
22
|
+
const buttonText = `${totalAdults} ${translations["hotel_adults_text"] || "adults"}, ${totalChildren} ${translations["hotel_children_text"] || "children"}, ${rooms.length} ${translations["hotel_rooms_text"] || "room"}${rooms.length > 1 ? "s" : ""}`;
|
|
23
|
+
const updateRoom = (index, field, delta) => {
|
|
24
|
+
setRooms((prev) => prev.map((room, i) => {
|
|
25
|
+
if (i !== index)
|
|
26
|
+
return room;
|
|
27
|
+
const currentValue = room[field];
|
|
28
|
+
const newValue = currentValue + delta;
|
|
29
|
+
if (field === "adults" && newValue < 1)
|
|
30
|
+
return room;
|
|
31
|
+
if (field === "children" && newValue < 0)
|
|
32
|
+
return room;
|
|
33
|
+
const newTotal = totalGuests - currentValue + newValue;
|
|
34
|
+
if (newTotal > MAX_GUESTS)
|
|
35
|
+
return room;
|
|
36
|
+
if (field === "children") {
|
|
37
|
+
let ages = [...room.childrenAges];
|
|
38
|
+
if (newValue > room.children)
|
|
39
|
+
ages.push(5);
|
|
40
|
+
if (newValue < room.children)
|
|
41
|
+
ages.pop();
|
|
42
|
+
return { ...room, children: newValue, childrenAges: ages };
|
|
43
|
+
}
|
|
44
|
+
return { ...room, [field]: newValue };
|
|
45
|
+
}));
|
|
46
|
+
};
|
|
47
|
+
const updateChildAge = (roomIndex, childIndex, newAge) => {
|
|
48
|
+
setRooms((prev) => prev.map((r, ri) => ri === roomIndex
|
|
49
|
+
? {
|
|
50
|
+
...r,
|
|
51
|
+
childrenAges: r.childrenAges.map((a, ai) => ai === childIndex ? newAge : a),
|
|
52
|
+
}
|
|
53
|
+
: r));
|
|
54
|
+
};
|
|
55
|
+
const addRoom = () => {
|
|
56
|
+
if (totalGuests >= MAX_GUESTS)
|
|
57
|
+
return;
|
|
58
|
+
setRooms((prev) => [
|
|
59
|
+
...prev,
|
|
60
|
+
{ adults: 1, children: 0, childrenAges: [] },
|
|
61
|
+
]);
|
|
62
|
+
};
|
|
63
|
+
const removeRoom = (index) => setRooms((prev) => prev.filter((_, i) => i !== index));
|
|
64
|
+
const handleSave = () => {
|
|
65
|
+
setIsModalOpen(false);
|
|
66
|
+
};
|
|
67
|
+
return (_jsxs(View, { children: [_jsxs(TouchableOpacity, { style: formStyles.inputTrigger, onPress: () => setIsModalOpen(true), activeOpacity: 0.8, children: [_jsx(Text, { style: formStyles.label, children: translations["hotel_form_guests"] || "Guests" }), _jsxs(View, { style: formStyles.inputTriggerRow, children: [_jsx(Text, { style: styles.selectorText, numberOfLines: 1, children: buttonText }), _jsx(ChevronDown, {})] })] }), _jsx(Modal, { visible: isModalOpen, animationType: "slide", presentationStyle: "fullScreen", onRequestClose: () => setIsModalOpen(false), children: _jsxs(View, { style: [styles.modalContainer, { paddingTop: insets.top }], children: [_jsx(TouchableOpacity, { style: styles.closeButton, onPress: () => setIsModalOpen(false), hitSlop: { top: 8, bottom: 8, left: 8, right: 8 }, children: _jsx(CloseIcon, { size: 16 }) }), _jsx(View, { style: styles.modalHeaderRow, children: _jsx(Text, { style: styles.modalTitle, children: translations["hotel_form_guests"] || "Guests" }) }), _jsxs(ScrollView, { style: styles.scrollView, contentContainerStyle: styles.scrollContent, showsVerticalScrollIndicator: false, children: [rooms.map((room, index) => (_jsxs(View, { style: styles.roomBlock, children: [_jsxs(View, { style: styles.roomHeader, children: [_jsxs(Text, { style: styles.roomTitle, children: [translations["hotel_room_label"] || "Room", " ", index + 1] }), rooms.length > 1 && (_jsx(TouchableOpacity, { onPress: () => removeRoom(index), activeOpacity: 0.7, children: _jsx(Text, { style: styles.removeText, children: translations["hotel_remove_room"] || "Remove" }) }))] }), _jsxs(View, { style: styles.counterRow, children: [_jsx(Text, { style: styles.counterLabel, children: translations["hotel_adults_title"] || "Adults" }), _jsxs(View, { style: styles.counterControls, children: [_jsx(TouchableOpacity, { style: [
|
|
68
|
+
styles.counterButton,
|
|
69
|
+
room.adults <= 1 && styles.counterButtonDisabled,
|
|
70
|
+
], onPress: () => updateRoom(index, "adults", -1), disabled: room.adults <= 1, activeOpacity: 0.7, children: _jsx(Text, { style: styles.counterButtonText, children: "-" }) }), _jsx(Text, { style: styles.counterValue, children: room.adults }), _jsx(TouchableOpacity, { style: [
|
|
71
|
+
styles.counterButton,
|
|
72
|
+
totalGuests >= MAX_GUESTS && styles.counterButtonDisabled,
|
|
73
|
+
], onPress: () => updateRoom(index, "adults", 1), disabled: totalGuests >= MAX_GUESTS, activeOpacity: 0.7, children: _jsx(Text, { style: styles.counterButtonText, children: "+" }) })] })] }), _jsxs(View, { style: styles.counterRow, children: [_jsx(Text, { style: styles.counterLabel, children: translations["hotel_children_title"] || "Children" }), _jsxs(View, { style: styles.counterControls, children: [_jsx(TouchableOpacity, { style: [
|
|
74
|
+
styles.counterButton,
|
|
75
|
+
room.children <= 0 && styles.counterButtonDisabled,
|
|
76
|
+
], onPress: () => updateRoom(index, "children", -1), disabled: room.children <= 0, activeOpacity: 0.7, children: _jsx(Text, { style: styles.counterButtonText, children: "-" }) }), _jsx(Text, { style: styles.counterValue, children: room.children }), _jsx(TouchableOpacity, { style: [
|
|
77
|
+
styles.counterButton,
|
|
78
|
+
totalGuests >= MAX_GUESTS && styles.counterButtonDisabled,
|
|
79
|
+
], onPress: () => updateRoom(index, "children", 1), disabled: totalGuests >= MAX_GUESTS, activeOpacity: 0.7, children: _jsx(Text, { style: styles.counterButtonText, children: "+" }) })] })] }), room.children > 0 && (_jsxs(View, { style: styles.agesContainer, children: [_jsx(Text, { style: styles.agesTitle, children: translations["hotel_children_age_title"] ||
|
|
80
|
+
"Specify children ages" }), _jsx(View, { style: styles.agesGrid, children: room.childrenAges.map((age, childIdx) => (_jsxs(View, { style: styles.ageSelector, children: [_jsxs(Text, { style: styles.ageLabel, children: [translations["hotel_child_label"] || "Child", " ", childIdx + 1] }), _jsxs(View, { style: styles.ageButtonsRow, children: [_jsx(TouchableOpacity, { style: [
|
|
81
|
+
styles.ageAdjustButton,
|
|
82
|
+
age <= 0 && styles.counterButtonDisabled,
|
|
83
|
+
], onPress: () => age > 0 && updateChildAge(index, childIdx, age - 1), disabled: age <= 0, activeOpacity: 0.7, children: _jsx(Text, { style: styles.counterButtonText, children: "-" }) }), _jsx(Text, { style: styles.ageValue, children: age }), _jsx(TouchableOpacity, { style: [
|
|
84
|
+
styles.ageAdjustButton,
|
|
85
|
+
age >= 17 && styles.counterButtonDisabled,
|
|
86
|
+
], onPress: () => age < 17 && updateChildAge(index, childIdx, age + 1), disabled: age >= 17, activeOpacity: 0.7, children: _jsx(Text, { style: styles.counterButtonText, children: "+" }) })] })] }, childIdx))) })] }))] }, index))), _jsx(TouchableOpacity, { style: [
|
|
87
|
+
styles.addRoomButton,
|
|
88
|
+
totalGuests >= MAX_GUESTS && styles.addRoomButtonDisabled,
|
|
89
|
+
], onPress: addRoom, disabled: totalGuests >= MAX_GUESTS, activeOpacity: 0.7, children: _jsxs(Text, { style: styles.addRoomText, children: ["+ ", translations["hotel_add_room"] || "Add room"] }) })] }), _jsx(View, { style: styles.modalFooter, children: _jsx(TouchableOpacity, { style: styles.saveButton, onPress: handleSave, activeOpacity: 0.8, children: _jsx(Text, { style: styles.saveButtonText, children: translations["hotel_save_button"] || "Done" }) }) })] }) })] }));
|
|
90
|
+
};
|
|
91
|
+
const styles = StyleSheet.create({
|
|
92
|
+
selectorText: {
|
|
93
|
+
fontSize: FontSize.md,
|
|
94
|
+
color: Colors.text,
|
|
95
|
+
flex: 1,
|
|
96
|
+
fontWeight: "500",
|
|
97
|
+
},
|
|
98
|
+
modalContainer: {
|
|
99
|
+
flex: 1,
|
|
100
|
+
backgroundColor: Colors.surface,
|
|
101
|
+
},
|
|
102
|
+
closeButton: {
|
|
103
|
+
alignSelf: "flex-end",
|
|
104
|
+
padding: Spacing.lg,
|
|
105
|
+
},
|
|
106
|
+
modalHeaderRow: {
|
|
107
|
+
paddingHorizontal: Spacing.lg,
|
|
108
|
+
paddingBottom: Spacing.md,
|
|
109
|
+
borderBottomWidth: 1,
|
|
110
|
+
borderBottomColor: Colors.border,
|
|
111
|
+
},
|
|
112
|
+
modalTitle: {
|
|
113
|
+
fontSize: FontSize.lg,
|
|
114
|
+
fontWeight: "700",
|
|
115
|
+
color: Colors.text,
|
|
116
|
+
},
|
|
117
|
+
scrollView: {
|
|
118
|
+
flex: 1,
|
|
119
|
+
},
|
|
120
|
+
scrollContent: {
|
|
121
|
+
padding: Spacing.lg,
|
|
122
|
+
},
|
|
123
|
+
roomBlock: {
|
|
124
|
+
marginBottom: Spacing.xl,
|
|
125
|
+
backgroundColor: Colors.surfaceSecondary,
|
|
126
|
+
borderRadius: BorderRadius.lg,
|
|
127
|
+
padding: Spacing.lg,
|
|
128
|
+
},
|
|
129
|
+
roomHeader: {
|
|
130
|
+
flexDirection: "row",
|
|
131
|
+
justifyContent: "space-between",
|
|
132
|
+
alignItems: "center",
|
|
133
|
+
marginBottom: Spacing.md,
|
|
134
|
+
},
|
|
135
|
+
roomTitle: {
|
|
136
|
+
fontSize: FontSize.lg,
|
|
137
|
+
fontWeight: "600",
|
|
138
|
+
color: Colors.text,
|
|
139
|
+
},
|
|
140
|
+
removeText: {
|
|
141
|
+
fontSize: FontSize.sm,
|
|
142
|
+
color: Colors.error,
|
|
143
|
+
fontWeight: "500",
|
|
144
|
+
},
|
|
145
|
+
counterRow: {
|
|
146
|
+
flexDirection: "row",
|
|
147
|
+
justifyContent: "space-between",
|
|
148
|
+
alignItems: "center",
|
|
149
|
+
paddingVertical: Spacing.md,
|
|
150
|
+
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
151
|
+
borderBottomColor: Colors.borderLight,
|
|
152
|
+
},
|
|
153
|
+
counterLabel: {
|
|
154
|
+
fontSize: FontSize.md,
|
|
155
|
+
color: Colors.text,
|
|
156
|
+
fontWeight: "500",
|
|
157
|
+
},
|
|
158
|
+
counterControls: {
|
|
159
|
+
flexDirection: "row",
|
|
160
|
+
alignItems: "center",
|
|
161
|
+
gap: Spacing.lg,
|
|
162
|
+
},
|
|
163
|
+
counterButton: {
|
|
164
|
+
width: 36,
|
|
165
|
+
height: 36,
|
|
166
|
+
borderRadius: BorderRadius.full,
|
|
167
|
+
borderWidth: 1,
|
|
168
|
+
borderColor: Colors.border,
|
|
169
|
+
alignItems: "center",
|
|
170
|
+
justifyContent: "center",
|
|
171
|
+
backgroundColor: Colors.surface,
|
|
172
|
+
},
|
|
173
|
+
counterButtonDisabled: {
|
|
174
|
+
opacity: 0.3,
|
|
175
|
+
},
|
|
176
|
+
counterButtonText: {
|
|
177
|
+
fontSize: FontSize.xl,
|
|
178
|
+
color: Colors.primary,
|
|
179
|
+
fontWeight: "500",
|
|
180
|
+
lineHeight: FontSize.xl * 1.1,
|
|
181
|
+
},
|
|
182
|
+
counterValue: {
|
|
183
|
+
fontSize: FontSize.lg,
|
|
184
|
+
fontWeight: "600",
|
|
185
|
+
color: Colors.text,
|
|
186
|
+
minWidth: 24,
|
|
187
|
+
textAlign: "center",
|
|
188
|
+
},
|
|
189
|
+
agesContainer: {
|
|
190
|
+
marginTop: Spacing.md,
|
|
191
|
+
},
|
|
192
|
+
agesTitle: {
|
|
193
|
+
fontSize: FontSize.sm,
|
|
194
|
+
color: Colors.textSecondary,
|
|
195
|
+
marginBottom: Spacing.sm,
|
|
196
|
+
},
|
|
197
|
+
agesGrid: {
|
|
198
|
+
flexDirection: "row",
|
|
199
|
+
flexWrap: "wrap",
|
|
200
|
+
gap: Spacing.sm,
|
|
201
|
+
},
|
|
202
|
+
ageSelector: {
|
|
203
|
+
backgroundColor: Colors.surface,
|
|
204
|
+
borderRadius: BorderRadius.md,
|
|
205
|
+
padding: Spacing.sm,
|
|
206
|
+
borderWidth: 1,
|
|
207
|
+
borderColor: Colors.borderLight,
|
|
208
|
+
alignItems: "center",
|
|
209
|
+
minWidth: 100,
|
|
210
|
+
},
|
|
211
|
+
ageLabel: {
|
|
212
|
+
fontSize: FontSize.xs,
|
|
213
|
+
color: Colors.textTertiary,
|
|
214
|
+
marginBottom: Spacing.xs,
|
|
215
|
+
},
|
|
216
|
+
ageButtonsRow: {
|
|
217
|
+
flexDirection: "row",
|
|
218
|
+
alignItems: "center",
|
|
219
|
+
gap: Spacing.md,
|
|
220
|
+
},
|
|
221
|
+
ageAdjustButton: {
|
|
222
|
+
width: 28,
|
|
223
|
+
height: 28,
|
|
224
|
+
borderRadius: BorderRadius.full,
|
|
225
|
+
borderWidth: 1,
|
|
226
|
+
borderColor: Colors.border,
|
|
227
|
+
alignItems: "center",
|
|
228
|
+
justifyContent: "center",
|
|
229
|
+
backgroundColor: Colors.surface,
|
|
230
|
+
},
|
|
231
|
+
ageValue: {
|
|
232
|
+
fontSize: FontSize.md,
|
|
233
|
+
fontWeight: "600",
|
|
234
|
+
color: Colors.text,
|
|
235
|
+
minWidth: 20,
|
|
236
|
+
textAlign: "center",
|
|
237
|
+
},
|
|
238
|
+
addRoomButton: {
|
|
239
|
+
paddingVertical: Spacing.md,
|
|
240
|
+
borderRadius: BorderRadius.md,
|
|
241
|
+
borderWidth: 1,
|
|
242
|
+
borderColor: Colors.primary,
|
|
243
|
+
borderStyle: "dashed",
|
|
244
|
+
alignItems: "center",
|
|
245
|
+
marginBottom: Spacing.lg,
|
|
246
|
+
},
|
|
247
|
+
addRoomButtonDisabled: {
|
|
248
|
+
opacity: 0.4,
|
|
249
|
+
},
|
|
250
|
+
addRoomText: {
|
|
251
|
+
fontSize: FontSize.md,
|
|
252
|
+
color: Colors.primary,
|
|
253
|
+
fontWeight: "600",
|
|
254
|
+
},
|
|
255
|
+
modalFooter: {
|
|
256
|
+
padding: Spacing.lg,
|
|
257
|
+
borderTopWidth: 1,
|
|
258
|
+
borderTopColor: Colors.borderLight,
|
|
259
|
+
},
|
|
260
|
+
saveButton: {
|
|
261
|
+
backgroundColor: Colors.primary,
|
|
262
|
+
borderRadius: BorderRadius.md,
|
|
263
|
+
paddingVertical: Spacing.md,
|
|
264
|
+
alignItems: "center",
|
|
265
|
+
},
|
|
266
|
+
saveButtonText: {
|
|
267
|
+
fontSize: FontSize.lg,
|
|
268
|
+
fontWeight: "600",
|
|
269
|
+
color: Colors.textOnPrimary,
|
|
270
|
+
},
|
|
271
|
+
});
|
|
272
|
+
export default GuestSelector;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default null;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type HotelLocationProps = {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
onChange: (val: {
|
|
6
|
+
id: string;
|
|
7
|
+
}) => void;
|
|
8
|
+
lang?: "ru" | "en";
|
|
9
|
+
translations: Record<string, string>;
|
|
10
|
+
defaultItem?: {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
nameEn?: string;
|
|
14
|
+
} | null;
|
|
15
|
+
};
|
|
16
|
+
declare const HotelLocation: React.FC<HotelLocationProps>;
|
|
17
|
+
export default HotelLocation;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
|
+
import { View, Text, TextInput, TouchableOpacity, Modal, FlatList, SectionList, StyleSheet, ActivityIndicator, } from "react-native";
|
|
4
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
5
|
+
import Svg, { Circle, Path, Rect } from "react-native-svg";
|
|
6
|
+
import { SvgUri } from "react-native-svg";
|
|
7
|
+
import { useHotelLocations } from "../../hooks/useHotelLocations";
|
|
8
|
+
import { CloseIcon } from "../../../store";
|
|
9
|
+
import { Colors, Spacing, FontSize } from "../../../theme/colors";
|
|
10
|
+
import { formStyles } from "../../../theme/formStyles";
|
|
11
|
+
const POPULAR_HOTEL_LOCATIONS = [
|
|
12
|
+
{ id: "82", partner: "11160", nameEn: "Paris", addressEn: "France", countryCode: "FR", name: "\u041F\u0430\u0440\u0438\u0436", address: "\u0424\u0440\u0430\u043D\u0446\u0438\u044F" },
|
|
13
|
+
{ id: "103030", partner: "11160", nameEn: "New York", addressEn: "United States", countryCode: "US", name: "\u041D\u044C\u044E-\u0419\u043E\u0440\u043A", address: "\u0421\u0428\u0410" },
|
|
14
|
+
{ id: "763", partner: "11160", nameEn: "Istanbul", addressEn: "Turkey", countryCode: "TR", name: "\u0421\u0442\u0430\u043C\u0431\u0443\u043B", address: "\u0422\u0443\u0440\u0446\u0438\u044F" },
|
|
15
|
+
{ id: "965", partner: "11160", nameEn: "Rome", addressEn: "Italy", countryCode: "IT", name: "\u0420\u0438\u043C", address: "\u0418\u0442\u0430\u043B\u0438\u044F" },
|
|
16
|
+
{ id: "483", partner: "11160", nameEn: "Barcelona", addressEn: "Spain", countryCode: "ES", name: "\u0411\u0430\u0440\u0441\u0435\u043B\u043E\u043D\u0430", address: "\u0418\u0441\u043F\u0430\u043D\u0438\u044F" },
|
|
17
|
+
];
|
|
18
|
+
const FLAG_BASE = "https://cdn.travel-code.com/images/remaster/flags";
|
|
19
|
+
const RegionIcon = () => (_jsxs(Svg, { width: 20, height: 20, viewBox: "0 0 20 20", fill: "none", children: [_jsx(Path, { d: "M15.625 8.125C15.625 6.63316 15.0324 5.20242 13.9775 4.14752C12.9226 3.09263 11.4918 2.5 10 2.5C8.50816 2.5 7.07742 3.09263 6.02252 4.14752C4.96763 5.20242 4.375 6.63316 4.375 8.125C4.375 10.4325 6.22125 13.44 10 17.0425C13.7788 13.44 15.625 10.4325 15.625 8.125ZM10 18.75C5.41625 14.5838 3.125 11.0412 3.125 8.125C3.125 6.30164 3.84933 4.55295 5.13864 3.26364C6.42795 1.97433 8.17664 1.25 10 1.25C11.8234 1.25 13.572 1.97433 14.8614 3.26364C16.1507 4.55295 16.875 6.30164 16.875 8.125C16.875 11.0412 14.5838 14.5838 10 18.75Z", fill: "#ABABC8", stroke: "#ABABC8", strokeWidth: 0.25 }), _jsx(Path, { d: "M10 10C10.4973 10 10.9742 9.80246 11.3258 9.45083C11.6775 9.09919 11.875 8.62228 11.875 8.125C11.875 7.62772 11.6775 7.15081 11.3258 6.79917C10.9742 6.44754 10.4973 6.25 10 6.25C9.50272 6.25 9.02581 6.44754 8.67417 6.79917C8.32254 7.15081 8.125 7.62772 8.125 8.125C8.125 8.62228 8.32254 9.09919 8.67417 9.45083C9.02581 9.80246 9.50272 10 10 10ZM10 11.25C9.1712 11.25 8.37634 10.9208 7.79029 10.3347C7.20424 9.74866 6.875 8.9538 6.875 8.125C6.875 7.2962 7.20424 6.50134 7.79029 5.91529C8.37634 5.32924 9.1712 5 10 5C10.8288 5 11.6237 5.32924 12.2097 5.91529C12.7958 6.50134 13.125 7.2962 13.125 8.125C13.125 8.9538 12.7958 9.74866 12.2097 10.3347C11.6237 10.9208 10.8288 11.25 10 11.25Z", fill: "#ABABC8", stroke: "#ABABC8", strokeWidth: 0.25 })] }));
|
|
20
|
+
const HotelBuildingIcon = () => (_jsxs(Svg, { width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", children: [_jsx(Path, { d: "M16.8153 18.2691V3.72727C16.8153 2.22104 15.5942 1 14.088 1H5.72727C4.22104 1 3 2.22104 3 3.72727V22.5863", stroke: "#ABABC8", strokeWidth: 0.681818, strokeLinecap: "round" }), _jsx(Rect, { x: 7.32031, y: 5.31738, width: 1.72691, height: 1.72691, rx: 0.170455, fill: "#ABABC8" }), _jsx(Rect, { x: 7.32031, y: 8.771, width: 1.72691, height: 1.72691, rx: 0.170455, fill: "#ABABC8" }), _jsx(Rect, { x: 7.32031, y: 12.2249, width: 1.72691, height: 1.72691, rx: 0.170455, fill: "#ABABC8" }), _jsx(Rect, { x: 7.32031, y: 15.6787, width: 1.72691, height: 1.72691, rx: 0.170455, fill: "#ABABC8" }), _jsx(Rect, { x: 7.32031, y: 19.1323, width: 1.72691, height: 1.72691, rx: 0.170455, fill: "#ABABC8" }), _jsx(Path, { d: "M13.6822 5.31714C12.5525 5.31714 11.6367 6.23292 11.6367 7.36259V21.9044C11.6367 22.2809 11.942 22.5862 12.3185 22.5862H15.0977V19.3028C15.0977 19.2086 15.174 19.1323 15.2681 19.1323H18.381C18.4752 19.1323 18.5515 19.2086 18.5515 19.3028V22.5862H21.3163C21.6929 22.5862 21.9982 22.2809 21.9982 21.9044V7.36259C21.9982 6.23292 21.0824 5.31714 19.9527 5.31714H13.6822ZM14.2305 8.07793C14.2305 7.98379 14.3068 7.90747 14.4009 7.90747H15.7869C15.8811 7.90747 15.9574 7.98379 15.9574 8.07793V9.46392C15.9574 9.55806 15.8811 9.63438 15.7869 9.63438H14.4009C14.3068 9.63438 14.2305 9.55806 14.2305 9.46392V8.07793ZM17.8538 7.90747C17.7597 7.90747 17.6834 7.98379 17.6834 8.07793V9.46392C17.6834 9.55806 17.7597 9.63438 17.8538 9.63438H19.2398C19.334 9.63438 19.4103 9.55806 19.4103 9.46392V8.07793C19.4103 7.98379 19.334 7.90747 19.2398 7.90747H17.8538ZM14.2305 11.5318C14.2305 11.4376 14.3068 11.3613 14.4009 11.3613H15.7869C15.8811 11.3613 15.9574 11.4376 15.9574 11.5318V12.9178C15.9574 13.0119 15.8811 13.0882 15.7869 13.0882H14.4009C14.3068 13.0882 14.2305 13.0119 14.2305 12.9178V11.5318ZM17.8538 11.3613C17.7597 11.3613 17.6834 11.4376 17.6834 11.5318V12.9178C17.6834 13.0119 17.7597 13.0882 17.8538 13.0882H19.2398C19.334 13.0882 19.4103 13.0119 19.4103 12.9178V11.5318C19.4103 11.4376 19.334 11.3613 19.2398 11.3613H17.8538ZM14.2305 14.9856C14.2305 14.8915 14.3068 14.8152 14.4009 14.8152H15.7869C15.8811 14.8152 15.9574 14.8915 15.9574 14.9856V16.3716C15.9574 16.4657 15.8811 16.5421 15.7869 16.5421H14.4009C14.3068 16.5421 14.2305 16.4657 14.2305 16.3716V14.9856ZM17.8538 14.8152C17.7597 14.8152 17.6834 14.8915 17.6834 14.9856V16.3716C17.6834 16.4657 17.7597 16.5421 17.8538 16.5421H19.2398C19.334 16.5421 19.4103 16.4657 19.4103 16.3716V14.9856C19.4103 14.8915 19.334 14.8152 19.2398 14.8152H17.8538Z", fill: "#ABABC8", fillRule: "evenodd", clipRule: "evenodd" })] }));
|
|
21
|
+
const SearchIcon = () => (_jsxs(Svg, { width: 19, height: 18, viewBox: "0 0 19 18", fill: "none", children: [_jsx(Circle, { cx: 7, cy: 7, r: 6, stroke: Colors.primary, strokeWidth: 2 }), _jsx(Path, { d: "M12 11L17.2857 16.0902", stroke: Colors.primary, strokeWidth: 2, strokeLinecap: "round" })] }));
|
|
22
|
+
const HotelLocation = ({ label, value, onChange, lang = "ru", translations, defaultItem, }) => {
|
|
23
|
+
const getLabel = (item) => lang === "en" ? item.nameEn || item.name : item.name;
|
|
24
|
+
const getAddress = (item) => lang === "en" ? item.addressEn || item.address : item.address;
|
|
25
|
+
const insets = useSafeAreaInsets();
|
|
26
|
+
const [query, setQuery] = useState("");
|
|
27
|
+
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
28
|
+
const [selectedItem, setSelectedItem] = useState(null);
|
|
29
|
+
const { results, loading } = useHotelLocations(isModalOpen ? query : "");
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (!defaultItem)
|
|
32
|
+
return;
|
|
33
|
+
setQuery(defaultItem.name);
|
|
34
|
+
onChange({ id: defaultItem.id });
|
|
35
|
+
}, [defaultItem]);
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (!query)
|
|
38
|
+
return;
|
|
39
|
+
if (defaultItem && defaultItem.name) {
|
|
40
|
+
setQuery(getLabel(defaultItem));
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (selectedItem) {
|
|
44
|
+
setQuery(getLabel(selectedItem));
|
|
45
|
+
}
|
|
46
|
+
}, [lang]);
|
|
47
|
+
const handleSelect = (item) => {
|
|
48
|
+
setQuery(getLabel(item));
|
|
49
|
+
setSelectedItem(item);
|
|
50
|
+
onChange({ id: item.id });
|
|
51
|
+
setIsModalOpen(false);
|
|
52
|
+
};
|
|
53
|
+
const handleClose = () => {
|
|
54
|
+
if (!query.trim() && selectedItem) {
|
|
55
|
+
setQuery(getLabel(selectedItem));
|
|
56
|
+
}
|
|
57
|
+
setIsModalOpen(false);
|
|
58
|
+
};
|
|
59
|
+
const sections = (results || [])
|
|
60
|
+
.filter((cat) => cat.children?.length > 0)
|
|
61
|
+
.map((cat) => ({
|
|
62
|
+
type: cat.type,
|
|
63
|
+
title: cat.type === "hotels"
|
|
64
|
+
? translations["hotel_locations_hotels"] || "Hotels"
|
|
65
|
+
: translations["hotel_locations_regions"] || "Regions",
|
|
66
|
+
data: cat.children,
|
|
67
|
+
}));
|
|
68
|
+
const hasSearchResults = sections.length > 0;
|
|
69
|
+
const isSearching = query.trim().length >= 2;
|
|
70
|
+
const showPopular = !isSearching;
|
|
71
|
+
const renderLocationItem = (loc, isHotel) => {
|
|
72
|
+
const cityName = getLabel(loc);
|
|
73
|
+
const countryName = getAddress(loc);
|
|
74
|
+
return (_jsx(TouchableOpacity, { style: styles.locationItem, onPress: () => handleSelect(loc), activeOpacity: 0.7, children: _jsxs(View, { style: styles.locationItemContent, children: [_jsx(View, { style: styles.iconContainer, children: isHotel ? _jsx(HotelBuildingIcon, {}) : _jsx(RegionIcon, {}) }), _jsxs(View, { style: styles.locationInfo, children: [_jsx(Text, { style: styles.locationCity, numberOfLines: 1, children: cityName }), _jsxs(View, { style: styles.addressRow, children: [_jsx(SvgUri, { uri: `${FLAG_BASE}/${loc.countryCode}.svg`, width: 20, height: 14 }), _jsx(Text, { style: styles.locationAddress, numberOfLines: 1, children: countryName })] })] })] }) }));
|
|
75
|
+
};
|
|
76
|
+
return (_jsxs(_Fragment, { children: [_jsxs(TouchableOpacity, { style: formStyles.inputTrigger, onPress: () => setIsModalOpen(true), activeOpacity: 0.8, children: [_jsx(Text, { style: formStyles.label, children: label }), _jsx(View, { style: formStyles.inputTriggerRow, children: _jsx(Text, { style: [formStyles.inputTriggerText, !query && formStyles.inputTriggerPlaceholder], numberOfLines: 1, children: query || label }) })] }), _jsx(Modal, { visible: isModalOpen, animationType: "slide", presentationStyle: "fullScreen", onRequestClose: handleClose, children: _jsxs(View, { style: [styles.modalContainer, { paddingTop: insets.top }], children: [_jsx(TouchableOpacity, { style: styles.closeButton, onPress: handleClose, hitSlop: { top: 8, bottom: 8, left: 8, right: 8 }, children: _jsx(CloseIcon, { size: 16 }) }), _jsxs(View, { style: styles.searchHeader, children: [_jsx(SearchIcon, {}), _jsx(TextInput, { autoFocus: true, style: styles.searchInput, value: query, onChangeText: setQuery, placeholder: translations["location_popup_placeholder"] ||
|
|
77
|
+
"Enter city or hotel", placeholderTextColor: Colors.textTertiary, returnKeyType: "search" })] }), _jsxs(View, { style: styles.modalContent, children: [loading && (_jsxs(View, { style: styles.loadingContainer, children: [_jsx(ActivityIndicator, { size: "small", color: Colors.primary }), _jsx(Text, { style: styles.loadingText, children: translations["location_popup_loading"] || "Loading..." })] })), !loading && isSearching && !hasSearchResults && (_jsx(Text, { style: styles.noResults, children: translations["location_popup_no_results"] ||
|
|
78
|
+
"Nothing found" })), !loading && showPopular && (_jsxs(_Fragment, { children: [_jsx(Text, { style: styles.sectionTitle, children: translations["popular_locations"] || "Popular destinations" }), _jsx(FlatList, { data: POPULAR_HOTEL_LOCATIONS, renderItem: ({ item }) => renderLocationItem(item, false), keyExtractor: (item) => item.id, keyboardShouldPersistTaps: "handled", showsVerticalScrollIndicator: false })] })), !loading && isSearching && hasSearchResults && (_jsx(SectionList, { sections: sections, renderSectionHeader: ({ section }) => (_jsx(Text, { style: styles.sectionTitle, children: section.title })), renderItem: ({ item, section }) => renderLocationItem(item, section.type === "hotels"), keyExtractor: (item) => item.id, keyboardShouldPersistTaps: "handled", showsVerticalScrollIndicator: false, stickySectionHeadersEnabled: false }))] })] }) })] }));
|
|
79
|
+
};
|
|
80
|
+
const styles = StyleSheet.create({
|
|
81
|
+
inputText: {
|
|
82
|
+
fontSize: FontSize.lg,
|
|
83
|
+
color: Colors.text,
|
|
84
|
+
flex: 1,
|
|
85
|
+
fontWeight: "500",
|
|
86
|
+
},
|
|
87
|
+
modalContainer: {
|
|
88
|
+
flex: 1,
|
|
89
|
+
backgroundColor: Colors.surface,
|
|
90
|
+
},
|
|
91
|
+
closeButton: {
|
|
92
|
+
alignSelf: "flex-end",
|
|
93
|
+
padding: Spacing.lg,
|
|
94
|
+
},
|
|
95
|
+
closeButtonText: {
|
|
96
|
+
fontSize: FontSize.xl,
|
|
97
|
+
color: Colors.textSecondary,
|
|
98
|
+
fontWeight: "600",
|
|
99
|
+
},
|
|
100
|
+
searchHeader: {
|
|
101
|
+
flexDirection: "row",
|
|
102
|
+
alignItems: "center",
|
|
103
|
+
paddingHorizontal: Spacing.lg,
|
|
104
|
+
paddingVertical: Spacing.md,
|
|
105
|
+
borderBottomWidth: 1,
|
|
106
|
+
borderBottomColor: Colors.border,
|
|
107
|
+
gap: Spacing.md,
|
|
108
|
+
},
|
|
109
|
+
searchInput: {
|
|
110
|
+
flex: 1,
|
|
111
|
+
fontSize: FontSize.lg,
|
|
112
|
+
color: Colors.text,
|
|
113
|
+
paddingVertical: Spacing.sm,
|
|
114
|
+
},
|
|
115
|
+
modalContent: {
|
|
116
|
+
flex: 1,
|
|
117
|
+
paddingHorizontal: Spacing.lg,
|
|
118
|
+
},
|
|
119
|
+
loadingContainer: {
|
|
120
|
+
flexDirection: "row",
|
|
121
|
+
alignItems: "center",
|
|
122
|
+
padding: Spacing.lg,
|
|
123
|
+
gap: Spacing.sm,
|
|
124
|
+
},
|
|
125
|
+
loadingText: {
|
|
126
|
+
fontSize: FontSize.md,
|
|
127
|
+
color: Colors.textSecondary,
|
|
128
|
+
},
|
|
129
|
+
noResults: {
|
|
130
|
+
padding: Spacing.lg,
|
|
131
|
+
fontSize: FontSize.md,
|
|
132
|
+
color: Colors.textTertiary,
|
|
133
|
+
},
|
|
134
|
+
sectionTitle: {
|
|
135
|
+
fontSize: FontSize.sm,
|
|
136
|
+
color: Colors.textTertiary,
|
|
137
|
+
fontWeight: "600",
|
|
138
|
+
textTransform: "uppercase",
|
|
139
|
+
paddingVertical: Spacing.md,
|
|
140
|
+
letterSpacing: 0.5,
|
|
141
|
+
},
|
|
142
|
+
locationItem: {
|
|
143
|
+
paddingVertical: Spacing.md,
|
|
144
|
+
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
145
|
+
borderBottomColor: Colors.borderLight,
|
|
146
|
+
},
|
|
147
|
+
locationItemContent: {
|
|
148
|
+
flexDirection: "row",
|
|
149
|
+
alignItems: "center",
|
|
150
|
+
},
|
|
151
|
+
iconContainer: {
|
|
152
|
+
width: 24,
|
|
153
|
+
height: 24,
|
|
154
|
+
alignItems: "center",
|
|
155
|
+
justifyContent: "center",
|
|
156
|
+
marginRight: Spacing.sm,
|
|
157
|
+
},
|
|
158
|
+
locationInfo: {
|
|
159
|
+
flex: 1,
|
|
160
|
+
},
|
|
161
|
+
locationCity: {
|
|
162
|
+
fontSize: FontSize.md,
|
|
163
|
+
color: Colors.text,
|
|
164
|
+
fontWeight: "500",
|
|
165
|
+
},
|
|
166
|
+
addressRow: {
|
|
167
|
+
flexDirection: "row",
|
|
168
|
+
alignItems: "center",
|
|
169
|
+
marginTop: 2,
|
|
170
|
+
gap: 6,
|
|
171
|
+
},
|
|
172
|
+
locationAddress: {
|
|
173
|
+
fontSize: FontSize.sm,
|
|
174
|
+
color: Colors.textSecondary,
|
|
175
|
+
flex: 1,
|
|
176
|
+
},
|
|
177
|
+
});
|
|
178
|
+
export default HotelLocation;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default null;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type Props = {
|
|
3
|
+
offers: any[];
|
|
4
|
+
allHotels?: any[];
|
|
5
|
+
loading: boolean;
|
|
6
|
+
isStreaming?: boolean;
|
|
7
|
+
isPageLoading?: boolean;
|
|
8
|
+
error?: string | null;
|
|
9
|
+
translations: Record<string, string>;
|
|
10
|
+
lang: string;
|
|
11
|
+
searchParams?: Record<string, any> | null;
|
|
12
|
+
total?: number;
|
|
13
|
+
offset?: number;
|
|
14
|
+
limit?: number;
|
|
15
|
+
fetchPage?: (page: number) => void;
|
|
16
|
+
filterSearch?: (params: Record<string, any>) => void;
|
|
17
|
+
currency?: string;
|
|
18
|
+
headerComponent?: React.ReactElement;
|
|
19
|
+
};
|
|
20
|
+
declare const HotelResults: React.FC<Props>;
|
|
21
|
+
export default HotelResults;
|