ordering-ui-react-native 0.18.2 → 0.18.3-release
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +9 -7
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessInformation/index.tsx +10 -9
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/OrderCreating/index.tsx +0 -20
- package/src/components/PaymentOptionsWebView/index.tsx +29 -8
- package/src/components/PhoneInputNumber/index.tsx +6 -2
- package/src/components/StripeMethodForm/index.tsx +136 -102
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OToast.tsx +3 -2
- package/src/types/index.tsx +5 -0
- package/src/utils/index.tsx +7 -2
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +36 -26
- package/themes/business/src/components/BusinessController/index.tsx +19 -17
- package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
- package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
- package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
- package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
- package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
- package/themes/business/src/components/Chat/index.tsx +163 -123
- package/themes/business/src/components/DriverMap/index.tsx +17 -6
- package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
- package/themes/business/src/components/FloatingButton/index.tsx +34 -31
- package/themes/business/src/components/GoogleMap/index.tsx +58 -57
- package/themes/business/src/components/LoginForm/index.tsx +5 -2
- package/themes/business/src/components/MapView/index.tsx +14 -10
- package/themes/business/src/components/MessagesOption/index.tsx +22 -94
- package/themes/business/src/components/NewOrderNotification/index.tsx +123 -96
- package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
- package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +205 -12
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +67 -39
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +47 -23
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +9 -4
- package/themes/business/src/components/OrderMessage/index.tsx +1 -1
- package/themes/business/src/components/OrderSummary/index.tsx +114 -123
- package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
- package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
- package/themes/business/src/components/OrdersOption/index.tsx +43 -32
- package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
- package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +21 -29
- package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
- package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
- package/themes/business/src/components/PreviousOrders/index.tsx +193 -221
- package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
- package/themes/business/src/components/ReviewCustomer/index.tsx +3 -1
- package/themes/business/src/components/SearchBar/index.tsx +2 -1
- package/themes/business/src/components/StoresList/index.tsx +6 -5
- package/themes/business/src/components/UserProfileForm/index.tsx +14 -15
- package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
- package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
- package/themes/business/src/components/shared/OModal.tsx +16 -9
- package/themes/business/src/types/index.tsx +8 -0
- package/themes/business/src/utils/index.tsx +4 -4
- package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
- package/themes/kiosk/src/components/Intro/index.tsx +16 -1
- package/themes/kiosk/src/components/LoginForm/index.tsx +7 -5
- package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
- package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +2 -2
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/original/index.tsx +7 -3
- package/themes/original/src/components/AddressDetails/index.tsx +19 -3
- package/themes/original/src/components/AddressForm/index.tsx +33 -15
- package/themes/original/src/components/AddressForm/styles.tsx +1 -1
- package/themes/original/src/components/AddressList/index.tsx +5 -8
- package/themes/original/src/components/AddressList/styles.tsx +4 -4
- package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +74 -38
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +11 -13
- package/themes/original/src/components/BusinessController/index.tsx +35 -44
- package/themes/original/src/components/BusinessController/styles.tsx +12 -5
- package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
- package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
- package/themes/original/src/components/BusinessInformation/index.tsx +140 -85
- package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +25 -26
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
- package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
- package/themes/original/src/components/BusinessListingSearch/index.tsx +133 -438
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -19
- package/themes/original/src/components/BusinessPreorder/index.tsx +105 -22
- package/themes/original/src/components/BusinessPreorder/styles.tsx +14 -0
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -3
- package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
- package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
- package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
- package/themes/original/src/components/BusinessProductsListing/index.tsx +162 -39
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +4 -5
- package/themes/original/src/components/BusinessReviews/index.tsx +4 -2
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +37 -404
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +49 -47
- package/themes/original/src/components/CartContent/index.tsx +99 -38
- package/themes/original/src/components/CartContent/styles.tsx +6 -6
- package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +324 -43
- package/themes/original/src/components/Checkout/styles.tsx +17 -0
- package/themes/original/src/components/CitiesControl/index.tsx +1 -1
- package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
- package/themes/original/src/components/CouponControl/index.tsx +10 -3
- package/themes/original/src/components/DatePicker/index.tsx +17 -0
- package/themes/original/src/components/DatePicker/styles.tsx +20 -0
- package/themes/original/src/components/DriverTips/index.tsx +6 -3
- package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
- package/themes/original/src/components/Favorite/index.tsx +4 -9
- package/themes/original/src/components/Favorite/styles.tsx +0 -2
- package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
- package/themes/original/src/components/GPSButton/index.tsx +7 -5
- package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +42 -5
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +3 -1
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +84 -8
- package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
- package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
- package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
- package/themes/original/src/components/GoogleMap/index.tsx +63 -7
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
- package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
- package/themes/original/src/components/Home/index.tsx +14 -5
- package/themes/original/src/components/LastOrder/index.tsx +2 -1
- package/themes/original/src/components/LastOrders/index.tsx +2 -1
- package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -25
- package/themes/original/src/components/LoginForm/index.tsx +64 -34
- package/themes/original/src/components/LottieAnimation/index.tsx +88 -63
- package/themes/original/src/components/MessageListing/index.tsx +9 -2
- package/themes/original/src/components/Messages/index.tsx +15 -4
- package/themes/original/src/components/Messages/styles.tsx +1 -1
- package/themes/original/src/components/MomentOption/index.tsx +9 -10
- package/themes/original/src/components/MomentSelector/index.tsx +1 -1
- package/themes/original/src/components/MultiCart/index.tsx +1 -1
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +161 -49
- package/themes/original/src/components/MultiCheckout/index.tsx +348 -70
- package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +2 -2
- package/themes/original/src/components/MyOrders/index.tsx +16 -5
- package/themes/original/src/components/NavBar/index.tsx +20 -13
- package/themes/original/src/components/NetworkError/index.tsx +2 -3
- package/themes/original/src/components/NetworkError/styles.tsx +2 -2
- package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
- package/themes/original/src/components/Notifications/index.tsx +4 -8
- package/themes/original/src/components/Notifications/styles.tsx +0 -1
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +22 -6
- package/themes/original/src/components/OrderDetails/index.tsx +721 -670
- package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
- package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
- package/themes/original/src/components/OrderProgress/index.tsx +34 -25
- package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
- package/themes/original/src/components/OrderSummary/index.tsx +62 -57
- package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +13 -13
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
- package/themes/original/src/components/OrdersOption/index.tsx +44 -21
- package/themes/original/src/components/OrdersOption/styles.tsx +2 -2
- package/themes/original/src/components/PageBanner/index.tsx +65 -29
- package/themes/original/src/components/PageBanner/styles.tsx +0 -3
- package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
- package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +100 -34
- package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
- package/themes/original/src/components/ProductForm/ActionButton.tsx +120 -0
- package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
- package/themes/original/src/components/ProductForm/index.tsx +106 -170
- package/themes/original/src/components/ProductForm/styles.tsx +3 -3
- package/themes/original/src/components/ProductItemAccordion/index.tsx +13 -6
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +49 -20
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
- package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
- package/themes/original/src/components/Promotions/index.tsx +6 -6
- package/themes/original/src/components/Promotions/styles.tsx +3 -3
- package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
- package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
- package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
- package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
- package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
- package/themes/original/src/components/ServiceForm/index.tsx +2 -2
- package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
- package/themes/original/src/components/SignupForm/index.tsx +27 -16
- package/themes/original/src/components/SingleOrderCard/index.tsx +44 -20
- package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
- package/themes/original/src/components/SingleProductCard/index.tsx +13 -10
- package/themes/original/src/components/SingleProductCard/styles.tsx +8 -3
- package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
- package/themes/original/src/components/StripeCardsList/index.tsx +61 -5
- package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
- package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
- package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
- package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +86 -0
- package/themes/original/src/components/UpsellingProducts/index.tsx +16 -205
- package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
- package/themes/original/src/components/UserDetails/index.tsx +3 -1
- package/themes/original/src/components/UserFormDetails/index.tsx +100 -22
- package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
- package/themes/original/src/components/UserProfile/index.tsx +8 -26
- package/themes/original/src/components/UserProfileForm/index.tsx +30 -31
- package/themes/original/src/components/UserVerification/index.tsx +55 -50
- package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
- package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
- package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
- package/themes/original/src/components/Wallets/index.tsx +48 -60
- package/themes/original/src/components/Wallets/styles.tsx +3 -4
- package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
- package/themes/original/src/components/shared/OButton.tsx +3 -3
- package/themes/original/src/components/shared/OInput.tsx +4 -5
- package/themes/original/src/components/shared/OModal.tsx +15 -17
- package/themes/original/src/layouts/Container.tsx +5 -3
- package/themes/original/src/types/index.tsx +28 -6
- package/themes/original/src/utils/index.tsx +180 -13
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
- package/src/navigators/BottomNavigator.tsx +0 -117
- package/src/navigators/CheckoutNavigator.tsx +0 -66
- package/src/navigators/HomeNavigator.tsx +0 -202
- package/src/navigators/NavigationRef.tsx +0 -7
- package/src/navigators/RootNavigator.tsx +0 -269
- package/src/pages/Account.tsx +0 -34
- package/src/pages/AddressForm.tsx +0 -62
- package/src/pages/AddressList.tsx +0 -24
- package/src/pages/BusinessProductsList.tsx +0 -81
- package/src/pages/BusinessesListing.tsx +0 -43
- package/src/pages/CartList.tsx +0 -49
- package/src/pages/Checkout.tsx +0 -101
- package/src/pages/ForgotPassword.tsx +0 -24
- package/src/pages/Help.tsx +0 -23
- package/src/pages/HelpAccountAndPayment.tsx +0 -23
- package/src/pages/HelpGuide.tsx +0 -23
- package/src/pages/HelpOrder.tsx +0 -23
- package/src/pages/Home.tsx +0 -36
- package/src/pages/IntroductoryTutorial.tsx +0 -170
- package/src/pages/Login.tsx +0 -47
- package/src/pages/MomentOption.tsx +0 -30
- package/src/pages/MultiCheckout.tsx +0 -31
- package/src/pages/MultiOrdersDetails.tsx +0 -27
- package/src/pages/MyOrders.tsx +0 -40
- package/src/pages/NetworkError.tsx +0 -24
- package/src/pages/NotFound.tsx +0 -22
- package/src/pages/OrderDetails.tsx +0 -25
- package/src/pages/ProductDetails.tsx +0 -55
- package/src/pages/Profile.tsx +0 -36
- package/src/pages/ReviewDriver.tsx +0 -30
- package/src/pages/ReviewOrder.tsx +0 -32
- package/src/pages/ReviewProducts.tsx +0 -30
- package/src/pages/Sessions.tsx +0 -22
- package/src/pages/Signup.tsx +0 -53
- package/src/pages/SpinnerLoader.tsx +0 -10
- package/src/pages/Splash.tsx +0 -21
|
@@ -1,41 +1,28 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react'
|
|
2
|
-
import { useLanguage, BusinessSearchList, useOrder, useUtils, showToast, ToastType } from 'ordering-components/native'
|
|
3
|
-
import { ScrollView, StyleSheet,
|
|
4
|
-
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
2
|
+
import { useLanguage, BusinessSearchList, useOrder, useUtils, useEvent, showToast, ToastType } from 'ordering-components/native'
|
|
3
|
+
import { ScrollView, StyleSheet, Dimensions, FlatList } from 'react-native'
|
|
5
4
|
import { useTheme } from 'styled-components/native'
|
|
6
|
-
import { OButton,
|
|
7
|
-
|
|
8
|
-
import { BusinessController } from '../BusinessController'
|
|
9
|
-
import { NotFoundSource } from '../NotFoundSource'
|
|
5
|
+
import { OButton, OText } from '../shared'
|
|
6
|
+
|
|
10
7
|
import { SingleProductCard } from '../SingleProductCard'
|
|
11
|
-
import AntDesignIcon from 'react-native-vector-icons/AntDesign'
|
|
12
8
|
import {
|
|
13
|
-
SearchWrapper,
|
|
14
|
-
WrapHeader,
|
|
15
|
-
ProductsList,
|
|
16
9
|
SingleBusinessSearch,
|
|
17
10
|
BusinessInfo,
|
|
18
11
|
BusinessInfoItem,
|
|
19
12
|
Metadata,
|
|
20
13
|
SingleBusinessContainer,
|
|
21
|
-
LoadMoreBusinessContainer,
|
|
22
|
-
TagsContainer,
|
|
23
|
-
SortContainer,
|
|
24
|
-
BrandContainer,
|
|
25
|
-
BrandItem,
|
|
26
|
-
PriceFilterWrapper,
|
|
27
|
-
OptionTitle,
|
|
28
14
|
BContainer,
|
|
29
|
-
WrapperButtons
|
|
30
15
|
} from './styles'
|
|
31
16
|
import FastImage from 'react-native-fast-image'
|
|
32
17
|
import { convertHoursToMinutes } from '../../utils'
|
|
33
|
-
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
|
|
34
18
|
import { BusinessSearchParams } from '../../types'
|
|
35
|
-
import { MyOrders } from '../MyOrders'
|
|
36
19
|
import { useIsFocused } from '@react-navigation/native';
|
|
37
|
-
|
|
38
|
-
import {
|
|
20
|
+
|
|
21
|
+
import { BusinessSearchHeader } from './BusinessSearchHeader'
|
|
22
|
+
import { BusinessSearchFooter } from './BusinessSearchFooter'
|
|
23
|
+
|
|
24
|
+
const PIXELS_TO_SCROLL = 1000
|
|
25
|
+
|
|
39
26
|
export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
|
|
40
27
|
const {
|
|
41
28
|
navigation,
|
|
@@ -43,104 +30,30 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
|
|
|
43
30
|
onBusinessClick,
|
|
44
31
|
handleChangeTermValue,
|
|
45
32
|
termValue,
|
|
46
|
-
paginationProps,
|
|
47
33
|
handleSearchbusinessAndProducts,
|
|
48
34
|
handleChangeFilters,
|
|
49
35
|
filters,
|
|
50
36
|
businessTypes,
|
|
51
37
|
setFilters,
|
|
52
38
|
brandList,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
handleUpdateProducts,
|
|
56
|
-
brandId
|
|
39
|
+
paginationProps,
|
|
40
|
+
handleUpdateProducts
|
|
57
41
|
} = props
|
|
58
42
|
|
|
59
|
-
const screenHeight = Dimensions.get('window').height;
|
|
60
43
|
const screenWidth = Dimensions.get('window').width;
|
|
61
44
|
const theme = useTheme()
|
|
62
45
|
const [orderState] = useOrder()
|
|
63
|
-
const
|
|
46
|
+
const [events] = useEvent()
|
|
64
47
|
const [, t] = useLanguage()
|
|
65
48
|
const [{ parsePrice, parseDistance, optimizeImage }] = useUtils();
|
|
66
49
|
|
|
67
50
|
const [openFilters, setOpenFilters] = useState(false)
|
|
68
|
-
const noResults = (!businessesSearchList.loading && !businessesSearchList.lengthError && businessesSearchList?.businesses?.length === 0)
|
|
69
|
-
const maxDeliveryFeeOptions = [15, 25, 35, 'default']
|
|
70
|
-
// const maxProductPriceOptions = [5, 10, 15, 'default']
|
|
71
|
-
const maxDistanceOptions = [1000, 2000, 5000, 'default']
|
|
72
|
-
const maxTimeOptions = [5, 15, 30, 'default']
|
|
73
|
-
const sortItems = [
|
|
74
|
-
{ text: t('PICKED_FOR_YOU', 'Picked for you (default)'), value: 'distance' },
|
|
75
|
-
{ text: t('DELIVERY_TIME', 'Delivery time'), value: 'delivery_time' },
|
|
76
|
-
{ text: t('PICKUP_TIME', 'Pickup time'), value: 'pickup_time' }
|
|
77
|
-
]
|
|
78
|
-
|
|
79
|
-
const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
80
|
-
|
|
81
|
-
const priceList = [
|
|
82
|
-
{ level: '1', content: '$' },
|
|
83
|
-
{ level: '2', content: '$$' },
|
|
84
|
-
{ level: '3', content: '$$$' },
|
|
85
|
-
{ level: '4', content: '$$$$' },
|
|
86
|
-
{ level: '5', content: '$$$$$' }
|
|
87
|
-
]
|
|
88
51
|
|
|
89
52
|
const isFocused = useIsFocused();
|
|
90
53
|
|
|
91
54
|
const styles = StyleSheet.create({
|
|
92
|
-
container: {
|
|
93
|
-
paddingHorizontal: 40,
|
|
94
|
-
width: '100%'
|
|
95
|
-
},
|
|
96
|
-
filterContainer: {
|
|
97
|
-
maxHeight: screenHeight - 150,
|
|
98
|
-
paddingHorizontal: 40,
|
|
99
|
-
width: '100%'
|
|
100
|
-
},
|
|
101
|
-
searchInput: {
|
|
102
|
-
fontSize: 12,
|
|
103
|
-
},
|
|
104
55
|
productsContainer: {
|
|
105
56
|
marginTop: 20
|
|
106
|
-
},
|
|
107
|
-
businessTypesContainer: {
|
|
108
|
-
width: '100%',
|
|
109
|
-
flexDirection: 'row',
|
|
110
|
-
flexWrap: 'wrap',
|
|
111
|
-
justifyContent: 'center'
|
|
112
|
-
},
|
|
113
|
-
priceContainer: {
|
|
114
|
-
width: '100%',
|
|
115
|
-
flexDirection: 'row',
|
|
116
|
-
flexWrap: 'wrap',
|
|
117
|
-
justifyContent: 'space-between'
|
|
118
|
-
},
|
|
119
|
-
categoryStyle: {
|
|
120
|
-
marginRight: 10,
|
|
121
|
-
marginTop: 10,
|
|
122
|
-
borderRadius: 50,
|
|
123
|
-
paddingHorizontal: 10,
|
|
124
|
-
paddingVertical: 4,
|
|
125
|
-
paddingLeft: 0,
|
|
126
|
-
paddingRight: 0,
|
|
127
|
-
height: 28,
|
|
128
|
-
borderWidth: 0
|
|
129
|
-
},
|
|
130
|
-
priceItem: {
|
|
131
|
-
marginRight: 10,
|
|
132
|
-
marginTop: 10,
|
|
133
|
-
borderRadius: 50,
|
|
134
|
-
paddingVertical: 4,
|
|
135
|
-
paddingLeft: 5,
|
|
136
|
-
paddingRight: 5,
|
|
137
|
-
height: 27,
|
|
138
|
-
borderWidth: 0
|
|
139
|
-
},
|
|
140
|
-
applyButton: {
|
|
141
|
-
paddingHorizontal: 10,
|
|
142
|
-
width: '100%',
|
|
143
|
-
marginTop: 20
|
|
144
57
|
}
|
|
145
58
|
});
|
|
146
59
|
|
|
@@ -217,6 +130,25 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
|
|
|
217
130
|
})
|
|
218
131
|
}
|
|
219
132
|
|
|
133
|
+
const handleScroll = ({ nativeEvent }: any) => {
|
|
134
|
+
const y = nativeEvent.contentOffset.y;
|
|
135
|
+
const height = nativeEvent.contentSize.height;
|
|
136
|
+
const hasMore = !(
|
|
137
|
+
paginationProps.totalPages === paginationProps.currentPage
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
if (y + PIXELS_TO_SCROLL > height && !businessesSearchList.loading && hasMore && businessesSearchList?.businesses?.length > 0) {
|
|
141
|
+
handleSearchbusinessAndProducts();
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const onChangeTermValue = (query: any) => {
|
|
146
|
+
handleChangeTermValue(query)
|
|
147
|
+
if (query) {
|
|
148
|
+
events.emit('products_searched', query)
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
220
152
|
useEffect(() => {
|
|
221
153
|
if (filters.business_types?.length === 0 && filters.orderBy === 'default' && Object.keys(filters)?.length === 2 && !openFilters) {
|
|
222
154
|
handleSearchbusinessAndProducts(true)
|
|
@@ -233,351 +165,114 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
|
|
|
233
165
|
}, [isFocused])
|
|
234
166
|
|
|
235
167
|
return (
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
<SearchBar
|
|
241
|
-
lazyLoad
|
|
242
|
-
{...(isChewLayout && { height: 55 })}
|
|
243
|
-
inputStyle={{ ...styles.searchInput }}
|
|
244
|
-
placeholder={t('SEARCH_BUSINESSES', 'Search Businesses')}
|
|
245
|
-
onSearch={(val: string) => handleChangeTermValue(val)}
|
|
246
|
-
value={termValue}
|
|
247
|
-
iconCustomRight={<AntDesignIcon name='filter' size={16} style={{ bottom: 2 }} onPress={() => handleOpenfilters()} />}
|
|
248
|
-
/>
|
|
249
|
-
</SearchWrapper>
|
|
250
|
-
<OText size={12} lineHeight={20} color={theme.colors.textThird} mLeft={5}>
|
|
251
|
-
{t('TYPE_AT_LEAST_3_CHARACTERS', 'Type at least 3 characters')}
|
|
252
|
-
</OText>
|
|
253
|
-
{
|
|
254
|
-
noResults && (
|
|
255
|
-
<View>
|
|
256
|
-
<NotFoundSource
|
|
257
|
-
content={t('NOT_FOUND_BUSINESSES', 'No businesses to delivery / pick up at this address, please change filters or change address.')}
|
|
258
|
-
/>
|
|
259
|
-
</View>
|
|
260
|
-
)
|
|
261
|
-
}
|
|
262
|
-
{businessesSearchList.businesses?.length > 0 && termValue?.length === 0 && (
|
|
263
|
-
<MyOrders
|
|
264
|
-
hideOrders
|
|
168
|
+
<>
|
|
169
|
+
<FlatList
|
|
170
|
+
data={businessesSearchList.businesses?.filter((business: any) => business?.categories?.length > 0)}
|
|
171
|
+
ListFooterComponent={<BusinessSearchFooter
|
|
265
172
|
businessesSearchList={businessesSearchList}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
{
|
|
288
|
-
<
|
|
289
|
-
|
|
290
|
-
style={{
|
|
291
|
-
width: screenWidth - 120,
|
|
292
|
-
marginRight: (businessesSearchList.loading || i !== businessesSearchList.businesses?.length - 1) ? 20 : 0
|
|
293
|
-
}}
|
|
173
|
+
handleCloseFilters={handleCloseFilters}
|
|
174
|
+
handleChangeFilters={handleChangeFilters}
|
|
175
|
+
brandList={brandList}
|
|
176
|
+
filters={filters}
|
|
177
|
+
handleChangeBrandFilter={handleChangeBrandFilter}
|
|
178
|
+
handleChangePriceRange={handleChangePriceRange}
|
|
179
|
+
businessTypes={businessTypes}
|
|
180
|
+
handleApplyFilters={handleApplyFilters}
|
|
181
|
+
clearFilters={clearFilters}
|
|
182
|
+
handleChangeActiveBusinessType={handleChangeActiveBusinessType}
|
|
183
|
+
openFilters={openFilters}
|
|
184
|
+
/>}
|
|
185
|
+
ListHeaderComponent={<BusinessSearchHeader
|
|
186
|
+
businessesSearchList={businessesSearchList}
|
|
187
|
+
onChangeTermValue={onChangeTermValue}
|
|
188
|
+
termValue={termValue}
|
|
189
|
+
handleOpenfilters={handleOpenfilters}
|
|
190
|
+
/>}
|
|
191
|
+
onScroll={(e: any) => handleScroll(e)}
|
|
192
|
+
showsVerticalScrollIndicator={false}
|
|
193
|
+
keyExtractor={(business: any, index: number) => `card-${business?.id}-${index}`}
|
|
194
|
+
renderItem={({ item: business }: any) => (
|
|
195
|
+
<BContainer
|
|
196
|
+
style={{ paddingHorizontal: 20, paddingTop: 0, paddingBottom: 0 }}
|
|
294
197
|
>
|
|
295
|
-
<
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
<OButton
|
|
308
|
-
bgColor='transparent'
|
|
309
|
-
borderColor={theme.colors.primary}
|
|
310
|
-
onClick={() => handleSearchbusinessAndProducts()}
|
|
311
|
-
text={t('LOAD_MORE_BUSINESS', 'Load more business')}
|
|
312
|
-
textStyle={{ color: theme.colors.primary }}
|
|
313
|
-
/>
|
|
314
|
-
</LoadMoreBusinessContainer>
|
|
315
|
-
)}
|
|
316
|
-
{businessesSearchList.loading && (
|
|
317
|
-
<BusinessControllerSkeletons paginationProps={paginationProps} />
|
|
318
|
-
)}
|
|
319
|
-
</ScrollView>
|
|
320
|
-
<ProductsList>
|
|
321
|
-
{businessesSearchList.businesses?.filter((business: any) => business?.categories?.length > 0).map((business: any) => (
|
|
322
|
-
<SingleBusinessSearch key={`card-${business?.id}`}>
|
|
323
|
-
<SingleBusinessContainer>
|
|
324
|
-
<BusinessInfo>
|
|
325
|
-
{(business?.logo || theme.images?.dummies?.businessLogo) && (
|
|
326
|
-
<FastImage
|
|
327
|
-
style={{ height: 48, width: 48 }}
|
|
328
|
-
source={{
|
|
329
|
-
uri: optimizeImage(business?.logo, 'h_120,c_limit'),
|
|
330
|
-
priority: FastImage.priority.normal,
|
|
331
|
-
}}
|
|
332
|
-
resizeMode={FastImage.resizeMode.cover}
|
|
333
|
-
/>
|
|
334
|
-
)}
|
|
335
|
-
</BusinessInfo>
|
|
336
|
-
<BusinessInfoItem>
|
|
337
|
-
<OText size={12}>{business?.name}</OText>
|
|
338
|
-
<Metadata>
|
|
339
|
-
{orderState?.options?.type === 1 && (
|
|
340
|
-
<>
|
|
341
|
-
<OText size={10}>{t('DELIVERY_FEE', 'Delivery fee')}{' '}</OText>
|
|
342
|
-
<OText size={10} mRight={3}>
|
|
343
|
-
{business && parsePrice(business?.delivery_price)}
|
|
344
|
-
</OText>
|
|
345
|
-
</>
|
|
198
|
+
<SingleBusinessSearch>
|
|
199
|
+
<SingleBusinessContainer>
|
|
200
|
+
<BusinessInfo>
|
|
201
|
+
{(business?.logo || theme.images?.dummies?.businessLogo) && (
|
|
202
|
+
<FastImage
|
|
203
|
+
style={{ height: 48, width: 48 }}
|
|
204
|
+
source={{
|
|
205
|
+
uri: optimizeImage(business?.logo, 'h_120,c_limit'),
|
|
206
|
+
priority: FastImage.priority.normal,
|
|
207
|
+
}}
|
|
208
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
209
|
+
/>
|
|
346
210
|
)}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
</OText>
|
|
350
|
-
<
|
|
351
|
-
{
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
text={t('GO_TO_STORE', 'Go to store')}
|
|
359
|
-
bgColor='#F5F9FF'
|
|
360
|
-
borderColor='#fff'
|
|
361
|
-
style={{ borderRadius: 50, paddingLeft: 5, paddingRight: 5, height: 20 }}
|
|
362
|
-
/>
|
|
363
|
-
</SingleBusinessContainer>
|
|
364
|
-
<ScrollView horizontal style={styles.productsContainer} contentContainerStyle={{ flexGrow: 1 }}>
|
|
365
|
-
{business?.categories?.map((category: any) => category?.products?.map((product: any, i: number) => (
|
|
366
|
-
<SingleProductCard
|
|
367
|
-
key={product?.id}
|
|
368
|
-
isSoldOut={(product.inventoried && !product.quantity)}
|
|
369
|
-
product={product}
|
|
370
|
-
enableIntersection={false}
|
|
371
|
-
businessId={business?.id}
|
|
372
|
-
onProductClick={(product: any) => onProductClick(business, category?.id, product?.id, product)}
|
|
373
|
-
productAddedToCartLength={0}
|
|
374
|
-
handleUpdateProducts={(productId: number, changes: any) => handleUpdateProducts(productId, category?.id, business?.id, changes)}
|
|
375
|
-
style={{ width: screenWidth - 80, maxWidth: screenWidth - 80, marginRight: 20 }}
|
|
376
|
-
/>
|
|
377
|
-
)))}
|
|
378
|
-
|
|
379
|
-
</ScrollView>
|
|
380
|
-
</SingleBusinessSearch>
|
|
381
|
-
))}
|
|
382
|
-
{businessesSearchList?.loading && (
|
|
383
|
-
<>
|
|
384
|
-
{[...Array(3).keys()].map(
|
|
385
|
-
(item, i) => (
|
|
386
|
-
<View key={`skeleton:${i}`} style={{ width: '100%', marginTop: 20 }}>
|
|
387
|
-
<Placeholder key={i} style={{ paddingHorizontal: 5 }} Animation={Fade}>
|
|
388
|
-
<View style={{ flexDirection: 'row' }}>
|
|
389
|
-
<PlaceholderLine
|
|
390
|
-
width={24}
|
|
391
|
-
height={70}
|
|
392
|
-
style={{ marginRight: 10, marginBottom: 10 }}
|
|
393
|
-
/>
|
|
394
|
-
<Placeholder style={{ paddingVertical: 10 }}>
|
|
395
|
-
<PlaceholderLine width={20} style={{ marginBottom: 25 }} />
|
|
396
|
-
<PlaceholderLine width={60} />
|
|
397
|
-
</Placeholder>
|
|
398
|
-
</View>
|
|
399
|
-
</Placeholder>
|
|
400
|
-
<Placeholder style={{ paddingHorizontal: 5, bottom: 10 }} Animation={Fade}>
|
|
401
|
-
<View style={{ flexDirection: 'row-reverse', overflow: 'hidden' }}>
|
|
402
|
-
<PlaceholderLine
|
|
403
|
-
width={24}
|
|
404
|
-
height={70}
|
|
405
|
-
style={{ marginRight: 10, marginBottom: 5 }}
|
|
406
|
-
/>
|
|
407
|
-
<Placeholder style={{ paddingVertical: 10 }}>
|
|
408
|
-
<PlaceholderLine width={60} height={10} />
|
|
409
|
-
<PlaceholderLine width={50} height={10} />
|
|
410
|
-
<PlaceholderLine width={70} height={10} />
|
|
411
|
-
</Placeholder>
|
|
412
|
-
</View>
|
|
413
|
-
</Placeholder>
|
|
414
|
-
</View>
|
|
415
|
-
),
|
|
416
|
-
)}
|
|
417
|
-
</>
|
|
418
|
-
)}
|
|
419
|
-
</ProductsList>
|
|
420
|
-
<OModal
|
|
421
|
-
open={openFilters}
|
|
422
|
-
onCancel={() => handleCloseFilters()}
|
|
423
|
-
onClose={() => handleCloseFilters()}
|
|
424
|
-
>
|
|
425
|
-
<ScrollView style={styles.filterContainer}>
|
|
426
|
-
<OText
|
|
427
|
-
size={20}
|
|
428
|
-
mBottom={15}
|
|
429
|
-
style={{ marginTop: 10 }}
|
|
430
|
-
>
|
|
431
|
-
{t('FILTER', 'Filter')}
|
|
432
|
-
</OText>
|
|
433
|
-
<SortContainer>
|
|
434
|
-
<OText weight='bold' mBottom={7} size={16}>
|
|
435
|
-
{t('SORT', 'Sort')}
|
|
436
|
-
</OText>
|
|
437
|
-
{sortItems?.filter(item => !(orderState?.options?.type === 1 && item?.value === 'pickup_time') && !(orderState?.options?.type === 2 && item?.value === 'delivery_time'))?.map(item => (
|
|
438
|
-
<TouchableOpacity
|
|
439
|
-
key={item?.value}
|
|
440
|
-
onPress={() => handleChangeFilters('orderBy', item?.value)}
|
|
441
|
-
style={{ marginBottom: 7 }}
|
|
442
|
-
>
|
|
443
|
-
<OText
|
|
444
|
-
weight={filters?.orderBy?.includes(item?.value) ? 'bold' : '500'}
|
|
445
|
-
mBottom={filters?.orderBy?.includes(item?.value) ? 5 : 0}
|
|
446
|
-
>
|
|
447
|
-
{item?.text} {(filters?.orderBy?.includes(item?.value)) && <>{filters?.orderBy?.includes('-') ? <AntDesignIcon name='caretup' /> : <AntDesignIcon name='caretdown' />}</>}
|
|
448
|
-
</OText>
|
|
449
|
-
</TouchableOpacity>
|
|
450
|
-
))}
|
|
451
|
-
</SortContainer>
|
|
452
|
-
<BrandContainer>
|
|
453
|
-
<OText
|
|
454
|
-
size={16}
|
|
455
|
-
weight='bold'
|
|
456
|
-
lineHeight={24}
|
|
457
|
-
style={{ marginBottom: 10 }}
|
|
458
|
-
>
|
|
459
|
-
{t('BRANDS', 'Brands')}
|
|
460
|
-
</OText>
|
|
461
|
-
{!brandList?.loading && !brandList?.error && brandList?.brands?.length > 0 && (
|
|
462
|
-
<ScrollView
|
|
463
|
-
style={{ maxHeight: 300, marginBottom: 10 }}
|
|
464
|
-
showsVerticalScrollIndicator={true}
|
|
465
|
-
nestedScrollEnabled={true}
|
|
466
|
-
>
|
|
467
|
-
{brandList?.brands.map((brand: any, i: number) => brand?.enabled && (
|
|
468
|
-
<BrandItem
|
|
469
|
-
key={i}
|
|
470
|
-
onPress={() => handleChangeBrandFilter(brand?.id)}
|
|
471
|
-
>
|
|
472
|
-
<OText
|
|
473
|
-
size={14}
|
|
474
|
-
weight={'400'}
|
|
475
|
-
lineHeight={24}
|
|
476
|
-
>
|
|
477
|
-
{brand?.name}
|
|
478
|
-
</OText>
|
|
479
|
-
{filters?.franchise_ids?.includes(brand?.id) && (
|
|
480
|
-
<AntDesignIcon
|
|
481
|
-
name='check'
|
|
482
|
-
color={theme.colors.success500}
|
|
483
|
-
size={16}
|
|
484
|
-
/>
|
|
211
|
+
</BusinessInfo>
|
|
212
|
+
<BusinessInfoItem>
|
|
213
|
+
<OText size={12}>{business?.name}</OText>
|
|
214
|
+
<Metadata>
|
|
215
|
+
{orderState?.options?.type === 1 && (
|
|
216
|
+
<>
|
|
217
|
+
<OText size={10}>{t('DELIVERY_FEE', 'Delivery fee')}{' '}</OText>
|
|
218
|
+
<OText size={10} mRight={3}>
|
|
219
|
+
{business && parsePrice(business?.delivery_price)}
|
|
220
|
+
</OText>
|
|
221
|
+
</>
|
|
485
222
|
)}
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
<PriceFilterWrapper>
|
|
495
|
-
<OText
|
|
496
|
-
size={16}
|
|
497
|
-
weight='bold'
|
|
498
|
-
lineHeight={24}
|
|
499
|
-
style={{ marginBottom: 5 }}
|
|
500
|
-
>
|
|
501
|
-
{t('PRICE_RANGE', 'Price range')}
|
|
502
|
-
</OText>
|
|
503
|
-
<View style={styles.priceContainer}>
|
|
504
|
-
{priceList.map((price: any, i: number) => (
|
|
223
|
+
<OText size={10} mRight={3}>
|
|
224
|
+
{convertHoursToMinutes(orderState?.options?.type === 1 ? business?.delivery_time : business?.pickup_time)}
|
|
225
|
+
</OText>
|
|
226
|
+
<OText size={10}>
|
|
227
|
+
{parseDistance(business?.distance)}
|
|
228
|
+
</OText>
|
|
229
|
+
</Metadata>
|
|
230
|
+
</BusinessInfoItem>
|
|
505
231
|
<OButton
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
232
|
+
onClick={() => onBusinessClick(business)}
|
|
233
|
+
textStyle={{ color: theme.colors.primary, fontSize: 10 }}
|
|
234
|
+
text={t('GO_TO_STORE', 'Go to store')}
|
|
235
|
+
style={{
|
|
236
|
+
borderRadius: 23,
|
|
237
|
+
paddingLeft: 10,
|
|
238
|
+
paddingRight: 10,
|
|
239
|
+
height: 23,
|
|
240
|
+
shadowOpacity: 0,
|
|
241
|
+
backgroundColor: theme.colors.primaryContrast,
|
|
242
|
+
borderWidth: 0
|
|
243
|
+
}}
|
|
512
244
|
/>
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
filter='max_eta'
|
|
531
|
-
handleChangeFilters={handleChangeFilters}
|
|
532
|
-
/>
|
|
533
|
-
)}
|
|
534
|
-
<MaxSectionItem
|
|
535
|
-
filters={filters}
|
|
536
|
-
title={t('MAX_DISTANCE', 'Max distance')}
|
|
537
|
-
options={maxDistanceOptions}
|
|
538
|
-
filter='max_distance'
|
|
539
|
-
handleChangeFilters={handleChangeFilters}
|
|
540
|
-
/>
|
|
541
|
-
{businessTypes?.length > 0 && (
|
|
542
|
-
<TagsContainer>
|
|
543
|
-
<OText weight='bold' mBottom={7} size={16}>{t('BUSINESS_CATEGORIES', 'Business categories')}</OText>
|
|
544
|
-
<View style={styles.businessTypesContainer}>
|
|
545
|
-
{businessTypes.map((type: any, i: number) => type.enabled && (
|
|
546
|
-
<OButton
|
|
547
|
-
key={type?.id}
|
|
548
|
-
bgColor={(filters?.business_types?.includes(type?.id) || (type?.id === null && filters?.business_types?.length === 0)) ? theme.colors.primary : theme.colors.backgroundGray200}
|
|
549
|
-
onClick={() => handleChangeActiveBusinessType(type)}
|
|
550
|
-
text={`${t(`BUSINESS_TYPE_${type.name.replace(/\s/g, '_').toUpperCase()}`, type.name)} ${filters?.business_types?.includes(type?.id) ? 'X' : ''}`}
|
|
551
|
-
style={styles.categoryStyle}
|
|
552
|
-
textStyle={{ fontSize: 10, color: (filters?.business_types?.includes(type?.id) || (type?.id === null && filters?.business_types?.length === 0)) ? '#fff' : theme.colors.textNormal }}
|
|
245
|
+
</SingleBusinessContainer>
|
|
246
|
+
<ScrollView horizontal style={styles.productsContainer} contentContainerStyle={{ flexGrow: 1 }}>
|
|
247
|
+
{business?.categories?.map((category: any) => category?.products?.map((product: any, i: number) => (
|
|
248
|
+
<SingleProductCard
|
|
249
|
+
key={product?.id}
|
|
250
|
+
isSoldOut={(product.inventoried && !product.quantity)}
|
|
251
|
+
product={product}
|
|
252
|
+
enableIntersection={false}
|
|
253
|
+
businessId={business?.id}
|
|
254
|
+
onProductClick={(product: any) => onProductClick(business, category?.id, product?.id, product)}
|
|
255
|
+
productAddedToCartLength={0}
|
|
256
|
+
handleUpdateProducts={(productId: number, changes: any) => handleUpdateProducts(productId, category?.id, business?.id, changes)}
|
|
257
|
+
style={{
|
|
258
|
+
width: screenWidth - (category?.products?.length > 1 ? 120 : 80),
|
|
259
|
+
maxWidth: screenWidth - (category?.products?.length > 1 ? 120 : 80),
|
|
260
|
+
marginRight: 20
|
|
261
|
+
}}
|
|
553
262
|
/>
|
|
554
|
-
))}
|
|
555
|
-
</
|
|
556
|
-
</
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
</View>
|
|
568
|
-
<View style={{ width: '50%' }}>
|
|
569
|
-
<OButton
|
|
570
|
-
text={t('CLEAR_FILTERS', 'Clear')}
|
|
571
|
-
bgColor={theme.colors.white}
|
|
572
|
-
borderColor={theme.colors.primary}
|
|
573
|
-
parentStyle={styles.applyButton}
|
|
574
|
-
textStyle={{ color: theme.colors.primary }}
|
|
575
|
-
onClick={() => clearFilters()}
|
|
576
|
-
/>
|
|
577
|
-
</View>
|
|
578
|
-
</WrapperButtons>
|
|
579
|
-
</OModal>
|
|
580
|
-
</BContainer>
|
|
263
|
+
)))}
|
|
264
|
+
</ScrollView>
|
|
265
|
+
</SingleBusinessSearch>
|
|
266
|
+
</BContainer>
|
|
267
|
+
)}
|
|
268
|
+
/>
|
|
269
|
+
{/* <IOScrollView
|
|
270
|
+
onScroll={(e: any) => handleScroll(e)}
|
|
271
|
+
showsVerticalScrollIndicator={false}
|
|
272
|
+
>
|
|
273
|
+
|
|
274
|
+
</IOScrollView> */}
|
|
275
|
+
</>
|
|
581
276
|
)
|
|
582
277
|
}
|
|
583
278
|
|