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