@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,109 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect, useRef } from "react";
|
|
3
|
+
import { View, Text, ScrollView, ActivityIndicator, StyleSheet, } from "react-native";
|
|
4
|
+
import FlightCard from "./FlightCard";
|
|
5
|
+
import FlightsSkeleton from "./FlightsSkeleton";
|
|
6
|
+
import Pagination from "../../Pagination";
|
|
7
|
+
import { Colors, Spacing, FontSize } from "../../../../theme/colors";
|
|
8
|
+
const FlightResults = ({ results, loading, isFiltering = false, isPageLoading = false, total = 0, limit = 25, offset = 0, fetchPage, dictionaries, airlines, sessionId, filtersData, translations, lang, currencySign, onFlightSelect, headerComponent, }) => {
|
|
9
|
+
const currentPage = Math.floor(offset / limit) + 1;
|
|
10
|
+
const totalPages = Math.ceil(total / limit);
|
|
11
|
+
const scrollRef = useRef(null);
|
|
12
|
+
const [hasSearched, setHasSearched] = useState(false);
|
|
13
|
+
const prevLoadingRef = useRef(false);
|
|
14
|
+
const formHeightRef = useRef(0);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (loading && !prevLoadingRef.current) {
|
|
17
|
+
setHasSearched(true);
|
|
18
|
+
const scrollOffset = formHeightRef.current > 0 ? formHeightRef.current - 120 : 400;
|
|
19
|
+
isAutoScrollingRef.current = true;
|
|
20
|
+
setTimeout(() => {
|
|
21
|
+
scrollRef.current?.scrollTo({ y: scrollOffset, animated: true });
|
|
22
|
+
setTimeout(() => { isAutoScrollingRef.current = false; }, 500);
|
|
23
|
+
}, 200);
|
|
24
|
+
}
|
|
25
|
+
prevLoadingRef.current = loading;
|
|
26
|
+
}, [loading]);
|
|
27
|
+
const scrollYRef = useRef(0);
|
|
28
|
+
const isAutoScrollingRef = useRef(false);
|
|
29
|
+
const isInitialLoad = loading && !results.length;
|
|
30
|
+
const hasResults = results.length > 0;
|
|
31
|
+
const showNoResultsFirstSearch = !loading && !isFiltering && hasSearched && !hasResults && !filtersData;
|
|
32
|
+
const showNoResultsAfterFilters = !loading && !isFiltering && hasSearched && !hasResults && !!filtersData;
|
|
33
|
+
const renderFooter = () => {
|
|
34
|
+
if (totalPages <= 1)
|
|
35
|
+
return null;
|
|
36
|
+
return (_jsx(View, { style: styles.paginationWrapper, children: _jsx(Pagination, { currentPage: currentPage, totalPages: totalPages, onPageChange: (page) => {
|
|
37
|
+
if (fetchPage) {
|
|
38
|
+
fetchPage(page);
|
|
39
|
+
}
|
|
40
|
+
} }) }));
|
|
41
|
+
};
|
|
42
|
+
const renderNoResults = (isAfterFilters) => (_jsxs(View, { style: styles.noResultsContainer, children: [_jsx(Text, { style: styles.noResultsTitle, children: translations["flights_not_found_title"] || "No flights found" }), _jsxs(View, { style: styles.noResultsContent, children: [_jsx(Text, { style: styles.noResultsHint, children: translations["flights_not_found_hint"] ||
|
|
43
|
+
"Try adjusting your search parameters:" }), _jsxs(Text, { style: styles.noResultsOption, children: ["\u2022", " ", translations["flights_not_found_option_1"] ||
|
|
44
|
+
"Change departure or return dates"] }), _jsxs(Text, { style: styles.noResultsOption, children: ["\u2022", " ", translations["flights_not_found_option_2"] ||
|
|
45
|
+
"Choose a different cabin class"] }), _jsxs(Text, { style: styles.noResultsOption, children: ["\u2022", " ", translations["flights_not_found_option_3"] ||
|
|
46
|
+
"Check nearby airports"] }), _jsxs(Text, { style: styles.noResultsOption, children: ["\u2022", " ", translations["flights_not_found_option_4"] || "Modify your filters"] })] })] }));
|
|
47
|
+
return (_jsxs(View, { style: styles.container, children: [(isFiltering || isPageLoading) && (_jsxs(View, { style: styles.overlayLoader, children: [_jsx(ActivityIndicator, { size: "large", color: Colors.primary }), _jsx(Text, { style: styles.overlayText, children: translations["loading"] || "Loading..." })] })), _jsxs(ScrollView, { ref: scrollRef, contentContainerStyle: styles.listContent, showsVerticalScrollIndicator: false, onScroll: (e) => {
|
|
48
|
+
scrollYRef.current = e.nativeEvent.contentOffset.y;
|
|
49
|
+
}, scrollEventThrottle: 16, onContentSizeChange: () => {
|
|
50
|
+
if (scrollYRef.current > 0 && !isAutoScrollingRef.current) {
|
|
51
|
+
scrollRef.current?.scrollTo({ y: scrollYRef.current, animated: false });
|
|
52
|
+
}
|
|
53
|
+
}, children: [_jsxs(View, { onLayout: (e) => { formHeightRef.current = e.nativeEvent.layout.height; }, children: [headerComponent, isInitialLoad && _jsx(FlightsSkeleton, { translations: translations }), showNoResultsFirstSearch && renderNoResults(false), showNoResultsAfterFilters && renderNoResults(true)] }), hasResults && results.map((item, index) => (_jsx(FlightCard, { item: item, loading: loading, dictionaries: dictionaries, airlines: airlines, sessionId: sessionId, translations: translations, lang: lang, currencySign: currencySign, onSelect: onFlightSelect }, `${item.id || index}-${item.totalPrice}-${item.durationTime}`))), hasResults && renderFooter()] })] }));
|
|
54
|
+
};
|
|
55
|
+
const styles = StyleSheet.create({
|
|
56
|
+
container: {
|
|
57
|
+
flex: 1,
|
|
58
|
+
position: "relative",
|
|
59
|
+
},
|
|
60
|
+
overlayLoader: {
|
|
61
|
+
position: "absolute",
|
|
62
|
+
top: 0,
|
|
63
|
+
left: 0,
|
|
64
|
+
right: 0,
|
|
65
|
+
bottom: 0,
|
|
66
|
+
backgroundColor: "rgba(255,255,255,0.7)",
|
|
67
|
+
zIndex: 10,
|
|
68
|
+
justifyContent: "center",
|
|
69
|
+
alignItems: "center",
|
|
70
|
+
},
|
|
71
|
+
overlayText: {
|
|
72
|
+
marginTop: Spacing.sm,
|
|
73
|
+
fontSize: FontSize.md,
|
|
74
|
+
color: Colors.textSecondary,
|
|
75
|
+
},
|
|
76
|
+
listContent: {
|
|
77
|
+
paddingBottom: Spacing.lg,
|
|
78
|
+
},
|
|
79
|
+
noResultsContainer: {
|
|
80
|
+
padding: Spacing.xxl,
|
|
81
|
+
alignItems: "center",
|
|
82
|
+
},
|
|
83
|
+
noResultsTitle: {
|
|
84
|
+
fontSize: FontSize.xl,
|
|
85
|
+
fontWeight: "600",
|
|
86
|
+
color: Colors.text,
|
|
87
|
+
marginBottom: Spacing.md,
|
|
88
|
+
textAlign: "center",
|
|
89
|
+
},
|
|
90
|
+
noResultsContent: {
|
|
91
|
+
alignItems: "flex-start",
|
|
92
|
+
},
|
|
93
|
+
noResultsHint: {
|
|
94
|
+
fontSize: FontSize.md,
|
|
95
|
+
color: Colors.textSecondary,
|
|
96
|
+
marginBottom: Spacing.sm,
|
|
97
|
+
},
|
|
98
|
+
noResultsOption: {
|
|
99
|
+
fontSize: FontSize.md,
|
|
100
|
+
color: Colors.textSecondary,
|
|
101
|
+
marginBottom: Spacing.xs,
|
|
102
|
+
paddingLeft: Spacing.sm,
|
|
103
|
+
},
|
|
104
|
+
paginationWrapper: {
|
|
105
|
+
paddingVertical: Spacing.lg,
|
|
106
|
+
alignItems: "center",
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
export default FlightResults;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type AirportDictionary = {
|
|
3
|
+
[code: string]: {
|
|
4
|
+
title: string;
|
|
5
|
+
titleEn: string;
|
|
6
|
+
city?: {
|
|
7
|
+
title?: string;
|
|
8
|
+
titleEn?: string;
|
|
9
|
+
};
|
|
10
|
+
country?: {
|
|
11
|
+
title?: string;
|
|
12
|
+
titleEn?: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
type Segment = {
|
|
17
|
+
duration: string;
|
|
18
|
+
departure: {
|
|
19
|
+
iata_code: string;
|
|
20
|
+
at: string;
|
|
21
|
+
};
|
|
22
|
+
arrival: {
|
|
23
|
+
iata_code: string;
|
|
24
|
+
at: string;
|
|
25
|
+
};
|
|
26
|
+
transfer_duration?: string;
|
|
27
|
+
};
|
|
28
|
+
type FlightSegmentsProps = {
|
|
29
|
+
segments: Segment[];
|
|
30
|
+
dictionaries?: {
|
|
31
|
+
airports?: AirportDictionary;
|
|
32
|
+
};
|
|
33
|
+
lang: string;
|
|
34
|
+
translations: Record<string, string>;
|
|
35
|
+
onShowTooltip?: (label: string, x: number, y: number, w: number, h: number) => void;
|
|
36
|
+
onDismissTooltip?: () => void;
|
|
37
|
+
activeTooltip?: string | null;
|
|
38
|
+
};
|
|
39
|
+
declare const FlightSegments: React.FC<FlightSegmentsProps>;
|
|
40
|
+
export default FlightSegments;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRef } from "react";
|
|
3
|
+
import { View, Text, TouchableOpacity, StyleSheet } from "react-native";
|
|
4
|
+
import { Colors, Spacing, FontSize, BorderRadius } from "../../../../theme/colors";
|
|
5
|
+
const TooltipTouchable = ({ label, onShow, onDismiss, active, children, style }) => {
|
|
6
|
+
const ref = useRef(null);
|
|
7
|
+
const handlePress = () => {
|
|
8
|
+
if (!onShow)
|
|
9
|
+
return;
|
|
10
|
+
if (active) {
|
|
11
|
+
onDismiss?.();
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
ref.current?.measureInWindow((x, y, w, h) => {
|
|
15
|
+
onShow(label, x, y, w, h);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
return (_jsx(View, { ref: ref, collapsable: false, style: style, children: _jsx(TouchableOpacity, { onPress: handlePress, activeOpacity: 0.7, children: children }) }));
|
|
20
|
+
};
|
|
21
|
+
const FlightSegments = ({ segments, dictionaries, lang, translations, onShowTooltip, onDismissTooltip, activeTooltip, }) => {
|
|
22
|
+
if (!segments?.length)
|
|
23
|
+
return null;
|
|
24
|
+
const airports = dictionaries?.airports || {};
|
|
25
|
+
const totalMinutes = segments.reduce((sum, seg, i) => {
|
|
26
|
+
const [h, m] = seg.duration.split(":").map(Number);
|
|
27
|
+
let minutes = h * 60 + m;
|
|
28
|
+
const next = segments[i + 1];
|
|
29
|
+
if (next) {
|
|
30
|
+
let transferMinutes = 0;
|
|
31
|
+
if (next.transfer_duration) {
|
|
32
|
+
const [th, tm] = next.transfer_duration.split(":").map(Number);
|
|
33
|
+
transferMinutes = th * 60 + tm;
|
|
34
|
+
}
|
|
35
|
+
else if (seg.arrival?.iata_code === next.departure?.iata_code) {
|
|
36
|
+
const diff = (new Date(next.departure.at).getTime() -
|
|
37
|
+
new Date(seg.arrival.at).getTime()) /
|
|
38
|
+
60000;
|
|
39
|
+
transferMinutes = diff > 0 ? diff : 60;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
transferMinutes = 60;
|
|
43
|
+
}
|
|
44
|
+
minutes += transferMinutes;
|
|
45
|
+
}
|
|
46
|
+
return sum + minutes;
|
|
47
|
+
}, 0);
|
|
48
|
+
const allCodes = [];
|
|
49
|
+
segments.forEach((seg, i) => {
|
|
50
|
+
if (i === 0)
|
|
51
|
+
allCodes.push(seg.departure?.iata_code);
|
|
52
|
+
allCodes.push(seg.arrival?.iata_code);
|
|
53
|
+
});
|
|
54
|
+
const hLabel = translations["hours_label"] || "h";
|
|
55
|
+
const mLabel = translations["minutes_label"] || "m";
|
|
56
|
+
const formatMin = (min) => {
|
|
57
|
+
const hh = Math.floor(min / 60);
|
|
58
|
+
const mm = min % 60;
|
|
59
|
+
return `${hh}${hLabel} ${mm.toString().padStart(2, "0")}${mLabel}`;
|
|
60
|
+
};
|
|
61
|
+
const getAirportName = (code) => {
|
|
62
|
+
const ap = airports[code];
|
|
63
|
+
if (!ap)
|
|
64
|
+
return code;
|
|
65
|
+
const name = lang === "en" ? ap.titleEn || ap.title : ap.title;
|
|
66
|
+
const city = lang === "en"
|
|
67
|
+
? ap.city?.titleEn || ap.city?.title || ""
|
|
68
|
+
: ap.city?.title || "";
|
|
69
|
+
return city ? `${name}, ${city}` : name;
|
|
70
|
+
};
|
|
71
|
+
const barItems = [];
|
|
72
|
+
segments.forEach((segment, index) => {
|
|
73
|
+
const [h, m] = segment.duration.split(":").map(Number);
|
|
74
|
+
const segMinutes = h * 60 + m;
|
|
75
|
+
const arrival = segment.arrival?.iata_code;
|
|
76
|
+
const next = segments[index + 1];
|
|
77
|
+
const isTransfer = !!next;
|
|
78
|
+
let transferMinutes = 0;
|
|
79
|
+
if (isTransfer && next) {
|
|
80
|
+
if (next.transfer_duration) {
|
|
81
|
+
const [th, tm] = next.transfer_duration.split(":").map(Number);
|
|
82
|
+
transferMinutes = th * 60 + tm;
|
|
83
|
+
}
|
|
84
|
+
else if (arrival === next.departure?.iata_code) {
|
|
85
|
+
const diff = (new Date(next.departure.at).getTime() -
|
|
86
|
+
new Date(segment.arrival.at).getTime()) /
|
|
87
|
+
60000;
|
|
88
|
+
transferMinutes = diff > 0 ? diff : 60;
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
transferMinutes = 60;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
const segFlex = totalMinutes > 0 ? segMinutes / totalMinutes : 1;
|
|
95
|
+
const layoverFlex = isTransfer && totalMinutes > 0 ? transferMinutes / totalMinutes : 0;
|
|
96
|
+
const flightTooltip = `${translations["in_flight"] || "In flight"}: ${formatMin(segMinutes)}`;
|
|
97
|
+
barItems.push({ type: "flight", flex: segFlex, tooltip: flightTooltip });
|
|
98
|
+
if (isTransfer) {
|
|
99
|
+
const arrName = getAirportName(arrival);
|
|
100
|
+
const transferTooltip = `${translations["transfer"] || "Transfer"} ${formatMin(transferMinutes)}, ${arrName}`;
|
|
101
|
+
barItems.push({ type: "layover", flex: layoverFlex, tooltip: transferTooltip });
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
const firstCode = allCodes[0];
|
|
105
|
+
const lastCode = allCodes[allCodes.length - 1];
|
|
106
|
+
const middleCodes = allCodes.slice(1, -1);
|
|
107
|
+
const getIataTooltip = (code, type) => {
|
|
108
|
+
const ap = airports[code];
|
|
109
|
+
if (!ap)
|
|
110
|
+
return code;
|
|
111
|
+
const name = lang === "en" ? ap.titleEn || ap.title : ap.title;
|
|
112
|
+
const city = lang === "en"
|
|
113
|
+
? ap.city?.titleEn || ap.city?.title || ""
|
|
114
|
+
: ap.city?.title || "";
|
|
115
|
+
const prefix = type === "dep"
|
|
116
|
+
? translations["departure_from"] || "Departure from"
|
|
117
|
+
: translations["arrival_to"] || "Arrival to";
|
|
118
|
+
return city ? `${prefix} ${name}, ${city}` : `${prefix} ${name}`;
|
|
119
|
+
};
|
|
120
|
+
return (_jsxs(View, { style: styles.container, children: [_jsx(View, { style: styles.barsRow, children: barItems.map((item, i) => (_jsx(TooltipTouchable, { label: item.tooltip, onShow: onShowTooltip, onDismiss: onDismissTooltip, active: activeTooltip === item.tooltip, style: [
|
|
121
|
+
item.type === "flight" ? styles.flightBar : styles.layoverBar,
|
|
122
|
+
{ flex: item.flex },
|
|
123
|
+
], children: _jsx(View, { style: { height: 14 } }) }, i))) }), _jsxs(View, { style: styles.labelsRow, children: [_jsx(TooltipTouchable, { label: getIataTooltip(firstCode, "dep"), onShow: onShowTooltip, onDismiss: onDismissTooltip, active: activeTooltip === getIataTooltip(firstCode, "dep"), children: _jsx(Text, { style: styles.airportLabel, numberOfLines: 1, children: firstCode }) }), middleCodes.map((code, i) => (_jsx(TooltipTouchable, { label: getAirportName(code), onShow: onShowTooltip, onDismiss: onDismissTooltip, active: activeTooltip === getAirportName(code), children: _jsx(Text, { style: [styles.airportLabel, styles.airportLabelCenter], numberOfLines: 1, children: code }) }, i))), _jsx(TooltipTouchable, { label: getIataTooltip(lastCode, "arr"), onShow: onShowTooltip, onDismiss: onDismissTooltip, active: activeTooltip === getIataTooltip(lastCode, "arr"), children: _jsx(Text, { style: [styles.airportLabel, styles.airportLabelEnd], numberOfLines: 1, children: lastCode }) })] })] }));
|
|
124
|
+
};
|
|
125
|
+
const styles = StyleSheet.create({
|
|
126
|
+
container: {
|
|
127
|
+
width: "100%",
|
|
128
|
+
marginVertical: Spacing.xs,
|
|
129
|
+
},
|
|
130
|
+
barsRow: {
|
|
131
|
+
flexDirection: "row",
|
|
132
|
+
alignItems: "center",
|
|
133
|
+
gap: 1,
|
|
134
|
+
},
|
|
135
|
+
flightBar: {
|
|
136
|
+
height: 4,
|
|
137
|
+
borderRadius: BorderRadius.sm,
|
|
138
|
+
backgroundColor: "#B5B5C2",
|
|
139
|
+
justifyContent: "center",
|
|
140
|
+
},
|
|
141
|
+
layoverBar: {
|
|
142
|
+
height: 1,
|
|
143
|
+
backgroundColor: "#B5B5C2",
|
|
144
|
+
justifyContent: "center",
|
|
145
|
+
},
|
|
146
|
+
labelsRow: {
|
|
147
|
+
flexDirection: "row",
|
|
148
|
+
justifyContent: "space-between",
|
|
149
|
+
marginTop: Spacing.xs,
|
|
150
|
+
},
|
|
151
|
+
airportLabel: {
|
|
152
|
+
fontSize: FontSize.xs,
|
|
153
|
+
color: Colors.primary,
|
|
154
|
+
},
|
|
155
|
+
airportLabelCenter: {
|
|
156
|
+
textAlign: "center",
|
|
157
|
+
},
|
|
158
|
+
airportLabelEnd: {
|
|
159
|
+
textAlign: "right",
|
|
160
|
+
},
|
|
161
|
+
});
|
|
162
|
+
export default FlightSegments;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { View, StyleSheet } from "react-native";
|
|
3
|
+
import { Skeleton } from "../../../../components/ui/Skeleton";
|
|
4
|
+
import { Colors, Spacing, BorderRadius } from "../../../../theme/colors";
|
|
5
|
+
const FlightsSkeleton = () => {
|
|
6
|
+
return (_jsx(View, { style: styles.container, children: [1, 2, 3, 4].map((i) => (_jsxs(View, { style: styles.card, children: [_jsxs(View, { style: styles.headerRow, children: [_jsx(Skeleton, { width: 32, height: 32, borderRadius: BorderRadius.full }), _jsx(Skeleton, { width: 100, height: 16, style: { marginLeft: Spacing.sm } })] }), _jsxs(View, { style: styles.routeRow, children: [_jsxs(View, { style: styles.timeCol, children: [_jsx(Skeleton, { width: 50, height: 20 }), _jsx(Skeleton, { width: 60, height: 12, style: { marginTop: Spacing.xs } })] }), _jsxs(View, { style: styles.timelineCol, children: [_jsx(Skeleton, { width: "100%", height: 3 }), _jsx(Skeleton, { width: 80, height: 12, style: { marginTop: Spacing.xs, alignSelf: "center" } })] }), _jsxs(View, { style: [styles.timeCol, styles.timeColRight], children: [_jsx(Skeleton, { width: 50, height: 20 }), _jsx(Skeleton, { width: 60, height: 12, style: { marginTop: Spacing.xs } })] })] }), _jsxs(View, { style: [styles.routeRow, { marginTop: Spacing.md }], children: [_jsxs(View, { style: styles.timeCol, children: [_jsx(Skeleton, { width: 50, height: 20 }), _jsx(Skeleton, { width: 60, height: 12, style: { marginTop: Spacing.xs } })] }), _jsx(View, { style: styles.timelineCol, children: _jsx(Skeleton, { width: "100%", height: 3 }) }), _jsxs(View, { style: [styles.timeCol, styles.timeColRight], children: [_jsx(Skeleton, { width: 50, height: 20 }), _jsx(Skeleton, { width: 60, height: 12, style: { marginTop: Spacing.xs } })] })] }), _jsxs(View, { style: styles.priceRow, children: [_jsx(Skeleton, { width: 80, height: 14 }), _jsx(Skeleton, { width: "100%", height: 44, borderRadius: BorderRadius.md, style: { marginTop: Spacing.sm } })] })] }, i))) }));
|
|
7
|
+
};
|
|
8
|
+
const styles = StyleSheet.create({
|
|
9
|
+
container: {
|
|
10
|
+
paddingHorizontal: Spacing.lg,
|
|
11
|
+
},
|
|
12
|
+
card: {
|
|
13
|
+
backgroundColor: Colors.surface,
|
|
14
|
+
borderRadius: BorderRadius.lg,
|
|
15
|
+
padding: Spacing.lg,
|
|
16
|
+
marginBottom: Spacing.md,
|
|
17
|
+
shadowColor: Colors.black,
|
|
18
|
+
shadowOffset: { width: 0, height: 2 },
|
|
19
|
+
shadowOpacity: 0.05,
|
|
20
|
+
shadowRadius: 4,
|
|
21
|
+
elevation: 2,
|
|
22
|
+
},
|
|
23
|
+
headerRow: {
|
|
24
|
+
flexDirection: "row",
|
|
25
|
+
alignItems: "center",
|
|
26
|
+
marginBottom: Spacing.lg,
|
|
27
|
+
},
|
|
28
|
+
routeRow: {
|
|
29
|
+
flexDirection: "row",
|
|
30
|
+
alignItems: "flex-start",
|
|
31
|
+
},
|
|
32
|
+
timeCol: {
|
|
33
|
+
width: 70,
|
|
34
|
+
},
|
|
35
|
+
timeColRight: {
|
|
36
|
+
alignItems: "flex-end",
|
|
37
|
+
},
|
|
38
|
+
timelineCol: {
|
|
39
|
+
flex: 1,
|
|
40
|
+
paddingHorizontal: Spacing.sm,
|
|
41
|
+
justifyContent: "center",
|
|
42
|
+
paddingTop: Spacing.sm,
|
|
43
|
+
},
|
|
44
|
+
priceRow: {
|
|
45
|
+
borderTopWidth: 1,
|
|
46
|
+
borderTopColor: Colors.borderLight,
|
|
47
|
+
paddingTop: Spacing.md,
|
|
48
|
+
marginTop: Spacing.lg,
|
|
49
|
+
alignItems: "center",
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
export default FlightsSkeleton;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type LoaderType = "flights" | "cars" | "hotels";
|
|
3
|
+
type ProvidersLoaderProps = {
|
|
4
|
+
active: boolean;
|
|
5
|
+
type?: LoaderType;
|
|
6
|
+
translations: Record<string, string>;
|
|
7
|
+
};
|
|
8
|
+
declare const ProvidersLoader: React.FC<ProvidersLoaderProps>;
|
|
9
|
+
export default ProvidersLoader;
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState, useRef } from "react";
|
|
3
|
+
import { View, Text, Animated, StyleSheet } from "react-native";
|
|
4
|
+
import { Colors, Spacing, FontSize, BorderRadius } from "../../../../theme/colors";
|
|
5
|
+
const AIRLINES = [
|
|
6
|
+
"Lufthansa",
|
|
7
|
+
"Swiss International Air Lines",
|
|
8
|
+
"Austrian Airlines",
|
|
9
|
+
"Air France",
|
|
10
|
+
"KLM Royal Dutch Airlines",
|
|
11
|
+
"British Airways",
|
|
12
|
+
"Finnair",
|
|
13
|
+
"SAS Scandinavian Airlines",
|
|
14
|
+
"Iberia",
|
|
15
|
+
"LOT Polish Airlines",
|
|
16
|
+
"TAP Air Portugal",
|
|
17
|
+
"Brussels Airlines",
|
|
18
|
+
"Norwegian Air Shuttle",
|
|
19
|
+
"easyJet",
|
|
20
|
+
"Ryanair",
|
|
21
|
+
"Qatar Airways",
|
|
22
|
+
"Emirates",
|
|
23
|
+
"Etihad Airways",
|
|
24
|
+
"United Airlines",
|
|
25
|
+
"American Airlines",
|
|
26
|
+
"Delta Air Lines",
|
|
27
|
+
"Air Canada",
|
|
28
|
+
];
|
|
29
|
+
const CAR_RENTALS = [
|
|
30
|
+
"Hertz",
|
|
31
|
+
"Avis",
|
|
32
|
+
"Europcar",
|
|
33
|
+
"Sixt",
|
|
34
|
+
"Enterprise",
|
|
35
|
+
"Budget",
|
|
36
|
+
"Alamo",
|
|
37
|
+
"National Car Rental",
|
|
38
|
+
"Thrifty",
|
|
39
|
+
"Dollar Rent A Car",
|
|
40
|
+
"Fox Rent A Car",
|
|
41
|
+
"Green Motion",
|
|
42
|
+
"Goldcar",
|
|
43
|
+
"Firefly",
|
|
44
|
+
"Locauto",
|
|
45
|
+
"Keddy",
|
|
46
|
+
"InterRent",
|
|
47
|
+
"OK Mobility",
|
|
48
|
+
"Rentmotors",
|
|
49
|
+
"AddCar",
|
|
50
|
+
];
|
|
51
|
+
const HOTEL_BRANDS = [
|
|
52
|
+
"Hilton Hotels",
|
|
53
|
+
"Marriott",
|
|
54
|
+
"Hyatt",
|
|
55
|
+
"Accor",
|
|
56
|
+
"IHG Hotels & Resorts",
|
|
57
|
+
"Radisson Blu",
|
|
58
|
+
"Best Western",
|
|
59
|
+
"Sheraton",
|
|
60
|
+
"Holiday Inn",
|
|
61
|
+
"Novotel",
|
|
62
|
+
"Crowne Plaza",
|
|
63
|
+
"Mercure",
|
|
64
|
+
"DoubleTree",
|
|
65
|
+
"Pullman",
|
|
66
|
+
"Courtyard by Marriott",
|
|
67
|
+
"Four Seasons",
|
|
68
|
+
"Ritz-Carlton",
|
|
69
|
+
"InterContinental",
|
|
70
|
+
"Sofitel",
|
|
71
|
+
"NH Hotels",
|
|
72
|
+
];
|
|
73
|
+
function shuffleArray(arr) {
|
|
74
|
+
const a = arr.slice();
|
|
75
|
+
for (let i = a.length - 1; i > 0; i--) {
|
|
76
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
77
|
+
[a[i], a[j]] = [a[j], a[i]];
|
|
78
|
+
}
|
|
79
|
+
return a;
|
|
80
|
+
}
|
|
81
|
+
const ProvidersLoader = ({ active, type = "flights", translations, }) => {
|
|
82
|
+
const configMap = {
|
|
83
|
+
flights: {
|
|
84
|
+
title: translations["loader_flights_title"] || "Searching flights",
|
|
85
|
+
subtitlePrefix: translations["loader_flights_prefix"] || "in",
|
|
86
|
+
list: AIRLINES,
|
|
87
|
+
initialCount: 39,
|
|
88
|
+
},
|
|
89
|
+
cars: {
|
|
90
|
+
title: translations["loader_cars_title"] || "Finding cars",
|
|
91
|
+
subtitlePrefix: translations["loader_cars_prefix"] || "at",
|
|
92
|
+
list: CAR_RENTALS,
|
|
93
|
+
initialCount: 24,
|
|
94
|
+
},
|
|
95
|
+
hotels: {
|
|
96
|
+
title: translations["loader_hotels_title"] || "Searching hotels",
|
|
97
|
+
subtitlePrefix: translations["loader_hotels_prefix"] || "in",
|
|
98
|
+
list: HOTEL_BRANDS,
|
|
99
|
+
initialCount: 52,
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
const config = configMap[type];
|
|
103
|
+
const [index, setIndex] = useState(0);
|
|
104
|
+
const [progress, setProgress] = useState(0);
|
|
105
|
+
const [counter, setCounter] = useState(config.initialCount);
|
|
106
|
+
const [names, setNames] = useState(() => shuffleArray(config.list));
|
|
107
|
+
const [visible, setVisible] = useState(false);
|
|
108
|
+
const fadeAnim = useRef(new Animated.Value(0)).current;
|
|
109
|
+
const progressAnim = useRef(new Animated.Value(0)).current;
|
|
110
|
+
const nameOpacity = useRef(new Animated.Value(1)).current;
|
|
111
|
+
const progressTimerRef = useRef(null);
|
|
112
|
+
const rotateTimerRef = useRef(null);
|
|
113
|
+
const counterTimerRef = useRef(null);
|
|
114
|
+
useEffect(() => {
|
|
115
|
+
if (active) {
|
|
116
|
+
setVisible(true);
|
|
117
|
+
startTimers();
|
|
118
|
+
Animated.timing(fadeAnim, {
|
|
119
|
+
toValue: 1,
|
|
120
|
+
duration: 300,
|
|
121
|
+
useNativeDriver: true,
|
|
122
|
+
}).start();
|
|
123
|
+
}
|
|
124
|
+
else if (visible) {
|
|
125
|
+
clearTimers();
|
|
126
|
+
setProgress(100);
|
|
127
|
+
progressAnim.setValue(1);
|
|
128
|
+
Animated.timing(fadeAnim, {
|
|
129
|
+
toValue: 0,
|
|
130
|
+
duration: 600,
|
|
131
|
+
useNativeDriver: true,
|
|
132
|
+
}).start(() => setVisible(false));
|
|
133
|
+
}
|
|
134
|
+
return () => clearTimers();
|
|
135
|
+
}, [active]);
|
|
136
|
+
const startTimers = () => {
|
|
137
|
+
clearTimers();
|
|
138
|
+
setProgress(0);
|
|
139
|
+
setCounter(config.initialCount);
|
|
140
|
+
setNames(shuffleArray(config.list));
|
|
141
|
+
progressAnim.setValue(0);
|
|
142
|
+
progressTimerRef.current = setInterval(() => {
|
|
143
|
+
setProgress((p) => {
|
|
144
|
+
const next = p < 95 ? p + 0.6 : p;
|
|
145
|
+
progressAnim.setValue(next / 100);
|
|
146
|
+
return next;
|
|
147
|
+
});
|
|
148
|
+
}, 200);
|
|
149
|
+
rotateTimerRef.current = setInterval(() => {
|
|
150
|
+
Animated.sequence([
|
|
151
|
+
Animated.timing(nameOpacity, {
|
|
152
|
+
toValue: 0,
|
|
153
|
+
duration: 200,
|
|
154
|
+
useNativeDriver: true,
|
|
155
|
+
}),
|
|
156
|
+
Animated.timing(nameOpacity, {
|
|
157
|
+
toValue: 1,
|
|
158
|
+
duration: 200,
|
|
159
|
+
useNativeDriver: true,
|
|
160
|
+
}),
|
|
161
|
+
]).start();
|
|
162
|
+
setIndex((i) => (i + 1) % config.list.length);
|
|
163
|
+
}, 1800);
|
|
164
|
+
counterTimerRef.current = setInterval(() => {
|
|
165
|
+
setCounter((c) => (c > 0 ? c - 1 : 0));
|
|
166
|
+
}, 1000);
|
|
167
|
+
};
|
|
168
|
+
const clearTimers = () => {
|
|
169
|
+
if (progressTimerRef.current)
|
|
170
|
+
clearInterval(progressTimerRef.current);
|
|
171
|
+
if (rotateTimerRef.current)
|
|
172
|
+
clearInterval(rotateTimerRef.current);
|
|
173
|
+
if (counterTimerRef.current)
|
|
174
|
+
clearInterval(counterTimerRef.current);
|
|
175
|
+
};
|
|
176
|
+
if (!visible)
|
|
177
|
+
return null;
|
|
178
|
+
const progressWidth = progressAnim.interpolate({
|
|
179
|
+
inputRange: [0, 1],
|
|
180
|
+
outputRange: ["0%", "100%"],
|
|
181
|
+
});
|
|
182
|
+
return (_jsx(Animated.View, { style: [styles.container, { opacity: fadeAnim }], children: _jsxs(View, { style: styles.content, children: [_jsxs(View, { style: styles.headerRow, children: [_jsx(View, { style: styles.counterBadge, children: _jsx(Text, { style: styles.counterText, children: counter }) }), _jsxs(View, { style: styles.textBlock, children: [_jsx(Text, { style: styles.title, children: config.title }), _jsxs(Animated.Text, { style: [styles.subtitle, { opacity: nameOpacity }], children: [config.subtitlePrefix, " ", names[index], "..."] })] })] }), _jsx(View, { style: styles.progressBackground, children: _jsx(Animated.View, { style: [styles.progressBar, { width: progressWidth }] }) })] }) }));
|
|
183
|
+
};
|
|
184
|
+
const styles = StyleSheet.create({
|
|
185
|
+
container: {
|
|
186
|
+
backgroundColor: Colors.surface,
|
|
187
|
+
borderRadius: BorderRadius.lg,
|
|
188
|
+
marginHorizontal: Spacing.lg,
|
|
189
|
+
marginVertical: Spacing.md,
|
|
190
|
+
padding: Spacing.lg,
|
|
191
|
+
shadowColor: Colors.black,
|
|
192
|
+
shadowOffset: { width: 0, height: 2 },
|
|
193
|
+
shadowOpacity: 0.1,
|
|
194
|
+
shadowRadius: 8,
|
|
195
|
+
elevation: 4,
|
|
196
|
+
},
|
|
197
|
+
content: {},
|
|
198
|
+
headerRow: {
|
|
199
|
+
flexDirection: "row",
|
|
200
|
+
alignItems: "center",
|
|
201
|
+
marginBottom: Spacing.lg,
|
|
202
|
+
},
|
|
203
|
+
counterBadge: {
|
|
204
|
+
width: 48,
|
|
205
|
+
height: 48,
|
|
206
|
+
borderRadius: BorderRadius.full,
|
|
207
|
+
backgroundColor: Colors.primaryLight,
|
|
208
|
+
justifyContent: "center",
|
|
209
|
+
alignItems: "center",
|
|
210
|
+
marginRight: Spacing.md,
|
|
211
|
+
},
|
|
212
|
+
counterText: {
|
|
213
|
+
fontSize: FontSize.xl,
|
|
214
|
+
fontWeight: "700",
|
|
215
|
+
color: Colors.primary,
|
|
216
|
+
},
|
|
217
|
+
textBlock: {
|
|
218
|
+
flex: 1,
|
|
219
|
+
},
|
|
220
|
+
title: {
|
|
221
|
+
fontSize: FontSize.lg,
|
|
222
|
+
fontWeight: "600",
|
|
223
|
+
color: Colors.text,
|
|
224
|
+
},
|
|
225
|
+
subtitle: {
|
|
226
|
+
fontSize: FontSize.md,
|
|
227
|
+
color: Colors.textSecondary,
|
|
228
|
+
marginTop: 2,
|
|
229
|
+
},
|
|
230
|
+
progressBackground: {
|
|
231
|
+
height: 6,
|
|
232
|
+
backgroundColor: Colors.borderLight,
|
|
233
|
+
borderRadius: BorderRadius.full,
|
|
234
|
+
overflow: "hidden",
|
|
235
|
+
},
|
|
236
|
+
progressBar: {
|
|
237
|
+
height: 6,
|
|
238
|
+
backgroundColor: Colors.primary,
|
|
239
|
+
borderRadius: BorderRadius.full,
|
|
240
|
+
},
|
|
241
|
+
});
|
|
242
|
+
export default ProvidersLoader;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "../flight/DatePicker";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "../flight/DatePicker";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type Room = {
|
|
3
|
+
adults: number;
|
|
4
|
+
children: number;
|
|
5
|
+
childrenAges: number[];
|
|
6
|
+
};
|
|
7
|
+
type GuestSelectorProps = {
|
|
8
|
+
value?: Room[];
|
|
9
|
+
onChange: (rooms: Room[]) => void;
|
|
10
|
+
translations: Record<string, string>;
|
|
11
|
+
};
|
|
12
|
+
declare const GuestSelector: React.FC<GuestSelectorProps>;
|
|
13
|
+
export default GuestSelector;
|