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