ordering-ui-react-native 0.17.89 → 0.17.90-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 (216) hide show
  1. package/package.json +8 -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 +1 -21
  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 +5 -0
  13. package/themes/business/index.tsx +2 -0
  14. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +37 -27
  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/Otp/index.tsx +31 -3
  22. package/themes/business/src/components/LoginForm/index.tsx +15 -22
  23. package/themes/business/src/components/MapView/index.tsx +14 -10
  24. package/themes/business/src/components/MessagesOption/index.tsx +20 -93
  25. package/themes/business/src/components/NewOrderNotification/index.tsx +123 -96
  26. package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
  27. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  28. package/themes/business/src/components/OrderDetails/Delivery.tsx +202 -12
  29. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +84 -37
  30. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +81 -66
  31. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +200 -0
  32. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  33. package/themes/business/src/components/OrderMessage/index.tsx +19 -18
  34. package/themes/business/src/components/OrderSummary/index.tsx +114 -123
  35. package/themes/business/src/components/OrdersOption/index.tsx +22 -22
  36. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
  37. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  38. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +17 -12
  39. package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
  40. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  41. package/themes/business/src/components/PreviousOrders/index.tsx +198 -221
  42. package/themes/business/src/components/ProductItemAccordion/index.tsx +7 -1
  43. package/themes/business/src/components/ReviewCustomer/index.tsx +18 -13
  44. package/themes/business/src/components/StoresList/index.tsx +3 -4
  45. package/themes/business/src/components/UserProfileForm/index.tsx +14 -15
  46. package/themes/business/src/components/shared/OModal.tsx +16 -9
  47. package/themes/business/src/types/index.tsx +25 -10
  48. package/themes/business/src/utils/index.tsx +29 -2
  49. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  50. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  51. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  52. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  53. package/themes/kiosk/src/components/Intro/index.tsx +16 -1
  54. package/themes/kiosk/src/components/LoginForm/index.tsx +7 -9
  55. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  56. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  57. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  58. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +2 -2
  59. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  60. package/themes/original/index.tsx +1 -1
  61. package/themes/original/src/components/AddressDetails/index.tsx +19 -3
  62. package/themes/original/src/components/AddressForm/index.tsx +35 -17
  63. package/themes/original/src/components/AddressList/index.tsx +5 -8
  64. package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
  65. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  66. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  67. package/themes/original/src/components/BusinessBasicInformation/index.tsx +73 -37
  68. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +10 -12
  69. package/themes/original/src/components/BusinessController/index.tsx +35 -44
  70. package/themes/original/src/components/BusinessController/styles.tsx +12 -5
  71. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  72. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  73. package/themes/original/src/components/BusinessInformation/index.tsx +140 -85
  74. package/themes/original/src/components/BusinessItemAccordion/index.tsx +15 -20
  75. package/themes/original/src/components/BusinessListingSearch/index.tsx +347 -336
  76. package/themes/original/src/components/BusinessListingSearch/styles.tsx +0 -18
  77. package/themes/original/src/components/BusinessPreorder/index.tsx +103 -19
  78. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -2
  79. package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
  80. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  81. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  82. package/themes/original/src/components/BusinessProductsListing/index.tsx +663 -556
  83. package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -3
  84. package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
  85. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  86. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  87. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  88. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +38 -405
  89. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  90. package/themes/original/src/components/Cart/index.tsx +60 -51
  91. package/themes/original/src/components/CartContent/index.tsx +102 -58
  92. package/themes/original/src/components/CartContent/styles.tsx +6 -6
  93. package/themes/original/src/components/Checkout/index.tsx +280 -35
  94. package/themes/original/src/components/CitiesControl/index.tsx +1 -1
  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 +1 -5
  99. package/themes/original/src/components/GPSButton/index.tsx +6 -4
  100. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  101. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +42 -5
  102. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +2 -0
  103. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +86 -10
  104. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  105. package/themes/original/src/components/GoogleMap/index.tsx +63 -7
  106. package/themes/original/src/components/Home/index.tsx +13 -4
  107. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  108. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  109. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -25
  110. package/themes/original/src/components/LoginForm/index.tsx +64 -34
  111. package/themes/original/src/components/LottieAnimation/index.tsx +88 -63
  112. package/themes/original/src/components/MessageListing/index.tsx +9 -2
  113. package/themes/original/src/components/Messages/index.tsx +15 -4
  114. package/themes/original/src/components/MomentOption/index.tsx +193 -92
  115. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  116. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +162 -50
  117. package/themes/original/src/components/MultiCheckout/index.tsx +385 -46
  118. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  119. package/themes/original/src/components/MultiOrdersDetails/index.tsx +23 -19
  120. package/themes/original/src/components/MyOrders/index.tsx +25 -16
  121. package/themes/original/src/components/NavBar/index.tsx +20 -13
  122. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  123. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  124. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +21 -5
  125. package/themes/original/src/components/OrderDetails/index.tsx +50 -38
  126. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  127. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  128. package/themes/original/src/components/OrderProgress/index.tsx +34 -25
  129. package/themes/original/src/components/OrderSummary/index.tsx +83 -57
  130. package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
  131. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +14 -14
  132. package/themes/original/src/components/OrdersOption/index.tsx +59 -48
  133. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  134. package/themes/original/src/components/PageBanner/index.tsx +65 -29
  135. package/themes/original/src/components/PageBanner/styles.tsx +0 -3
  136. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
  137. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  138. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  139. package/themes/original/src/components/PaymentOptions/index.tsx +100 -34
  140. package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
  141. package/themes/original/src/components/ProductForm/index.tsx +87 -31
  142. package/themes/original/src/components/ProductForm/styles.tsx +3 -3
  143. package/themes/original/src/components/ProductItemAccordion/index.tsx +8 -6
  144. package/themes/original/src/components/ProductOptionSubOption/index.tsx +49 -20
  145. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
  146. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  147. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
  148. package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
  149. package/themes/original/src/components/Promotions/index.tsx +2 -2
  150. package/themes/original/src/components/Promotions/styles.tsx +3 -1
  151. package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
  152. package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
  153. package/themes/original/src/components/ServiceForm/index.tsx +63 -20
  154. package/themes/original/src/components/Sessions/styles.tsx +1 -0
  155. package/themes/original/src/components/SignupForm/index.tsx +43 -27
  156. package/themes/original/src/components/SingleOrderCard/index.tsx +42 -19
  157. package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
  158. package/themes/original/src/components/SingleProductCard/index.tsx +14 -11
  159. package/themes/original/src/components/SingleProductCard/styles.tsx +8 -3
  160. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  161. package/themes/original/src/components/StripeCardsList/index.tsx +61 -5
  162. package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
  163. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  164. package/themes/original/src/components/UpsellingProducts/index.tsx +5 -10
  165. package/themes/original/src/components/UserDetails/index.tsx +3 -1
  166. package/themes/original/src/components/UserFormDetails/index.tsx +78 -9
  167. package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
  168. package/themes/original/src/components/UserProfile/index.tsx +8 -26
  169. package/themes/original/src/components/UserProfileForm/index.tsx +30 -31
  170. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  171. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  172. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  173. package/themes/original/src/components/Wallets/index.tsx +52 -62
  174. package/themes/original/src/components/Wallets/styles.tsx +2 -4
  175. package/themes/original/src/components/shared/OButton.tsx +3 -3
  176. package/themes/original/src/components/shared/OInput.tsx +4 -5
  177. package/themes/original/src/components/shared/OModal.tsx +3 -3
  178. package/themes/original/src/types/index.tsx +37 -10
  179. package/themes/original/src/utils/index.tsx +185 -13
  180. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  181. package/src/navigators/BottomNavigator.tsx +0 -117
  182. package/src/navigators/CheckoutNavigator.tsx +0 -66
  183. package/src/navigators/HomeNavigator.tsx +0 -202
  184. package/src/navigators/NavigationRef.tsx +0 -7
  185. package/src/navigators/RootNavigator.tsx +0 -269
  186. package/src/pages/Account.tsx +0 -34
  187. package/src/pages/AddressForm.tsx +0 -62
  188. package/src/pages/AddressList.tsx +0 -24
  189. package/src/pages/BusinessProductsList.tsx +0 -81
  190. package/src/pages/BusinessesListing.tsx +0 -43
  191. package/src/pages/CartList.tsx +0 -49
  192. package/src/pages/Checkout.tsx +0 -101
  193. package/src/pages/ForgotPassword.tsx +0 -24
  194. package/src/pages/Help.tsx +0 -23
  195. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  196. package/src/pages/HelpGuide.tsx +0 -23
  197. package/src/pages/HelpOrder.tsx +0 -23
  198. package/src/pages/Home.tsx +0 -36
  199. package/src/pages/IntroductoryTutorial.tsx +0 -170
  200. package/src/pages/Login.tsx +0 -47
  201. package/src/pages/MomentOption.tsx +0 -30
  202. package/src/pages/MultiCheckout.tsx +0 -31
  203. package/src/pages/MultiOrdersDetails.tsx +0 -27
  204. package/src/pages/MyOrders.tsx +0 -40
  205. package/src/pages/NetworkError.tsx +0 -24
  206. package/src/pages/NotFound.tsx +0 -22
  207. package/src/pages/OrderDetails.tsx +0 -25
  208. package/src/pages/ProductDetails.tsx +0 -55
  209. package/src/pages/Profile.tsx +0 -36
  210. package/src/pages/ReviewDriver.tsx +0 -30
  211. package/src/pages/ReviewOrder.tsx +0 -32
  212. package/src/pages/ReviewProducts.tsx +0 -30
  213. package/src/pages/Sessions.tsx +0 -22
  214. package/src/pages/Signup.tsx +0 -53
  215. package/src/pages/SpinnerLoader.tsx +0 -10
  216. 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();
@@ -76,7 +72,8 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
76
72
  { text: t('PICKUP_TIME', 'Pickup time'), value: 'pickup_time' }
77
73
  ]
78
74
 
79
- const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
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,346 +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, ...Platform.OS === 'ios' ? {} : { paddingBottom: 4 } }}
244
- placeholder={`${t('SEARCH_BUSINESSES', 'Search Businesses')} / ${t('TYPE_AT_LEAST_3_CHARACTERS', 'type at least 3 characters')}`}
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
- {
251
- noResults && (
252
- <View>
253
- <NotFoundSource
254
- content={t('NOT_FOUND_BUSINESSES', 'No businesses to delivery / pick up at this address, please change filters or change address.')}
255
- />
256
- </View>
257
- )
258
- }
259
- {businessesSearchList.businesses?.length > 0 && termValue?.length === 0 && (
260
- <MyOrders
261
- hideOrders
262
- businessesSearchList={businessesSearchList}
263
- onNavigationRedirect={onNavigationRedirect}
264
- BusinessControllerSkeletons={BusinessControllerSkeletons}
265
- businessPaginationProps={paginationProps}
266
- franchiseId={brandId}
267
- hideBackBtn
268
- titleStyle={{
269
- paddingHorizontal: 0,
270
- marginTop: 0,
271
- marginLeft: 0
272
- }}
273
- />
274
- )}
275
-
276
- <OptionTitle isBusinessesSearchList={!!businessesSearchList}>
277
- <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10}>
278
- {t('BUSINESSES', 'Businesses')}
279
- </OText>
280
- </OptionTitle>
281
- <ScrollView horizontal showsHorizontalScrollIndicator={false}>
282
- {businessesSearchList.businesses?.length > 0 && businessesSearchList.businesses.map((business: any, i: number) => (
283
- <View
284
- 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}
285
268
  style={{
286
- width: screenWidth - 120,
287
- 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,
288
278
  }}
289
- >
290
- <BusinessController
291
- business={business}
292
- isBusinessOpen={business.open}
293
- enableIntersection={false}
294
- handleCustomClick={() => onBusinessClick(business)}
295
- handleUpdateBusinessList={handleUpdateBusinessList}
296
- orderType={orderState?.options?.type}
297
- />
298
- </View>
299
- ))}
300
- {!businessesSearchList.loading && paginationProps?.totalPages && paginationProps?.currentPage < paginationProps?.totalPages && (
301
- <LoadMoreBusinessContainer>
302
- <OButton
303
- bgColor='transparent'
304
- borderColor={theme.colors.primary}
305
- onClick={() => handleSearchbusinessAndProducts()}
306
- text={t('LOAD_MORE_BUSINESS', 'Load more business')}
307
- textStyle={{ color: theme.colors.primary }}
308
- />
309
- </LoadMoreBusinessContainer>
310
- )}
311
- {businessesSearchList.loading && (
312
- <BusinessControllerSkeletons paginationProps={paginationProps} />
279
+ onClick={() => props.navigation.goBack()}
280
+ icon={AntDesignIcon}
281
+ iconProps={{
282
+ name: 'arrowleft',
283
+ size: 26
284
+ }}
285
+ />
313
286
  )}
314
- </ScrollView>
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 }}
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.')}
357
311
  />
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={{ 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
+ }}
371
363
  />
372
- )))}
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
+ )))}
373
383
 
374
- </ScrollView>
375
- </SingleBusinessSearch>
376
- ))}
377
- {businessesSearchList?.loading && (
378
- <>
379
- {[...Array(3).keys()].map(
380
- (item, i) => (
381
- <View key={`skeleton:${i}`} style={{ width: '100%', marginTop: 20 }}>
382
- <Placeholder key={i} style={{ paddingHorizontal: 5 }} Animation={Fade}>
383
- <View style={{ flexDirection: 'row' }}>
384
- <PlaceholderLine
385
- width={24}
386
- height={70}
387
- style={{ marginRight: 10, marginBottom: 10 }}
388
- />
389
- <Placeholder style={{ paddingVertical: 10 }}>
390
- <PlaceholderLine width={20} style={{ marginBottom: 25 }} />
391
- <PlaceholderLine width={60} />
392
- </Placeholder>
393
- </View>
394
- </Placeholder>
395
- <Placeholder style={{ paddingHorizontal: 5, bottom: 10 }} Animation={Fade}>
396
- <View style={{ flexDirection: 'row-reverse', overflow: 'hidden' }}>
397
- <PlaceholderLine
398
- width={24}
399
- height={70}
400
- style={{ marginRight: 10, marginBottom: 5 }}
401
- />
402
- <Placeholder style={{ paddingVertical: 10 }}>
403
- <PlaceholderLine width={60} height={10} />
404
- <PlaceholderLine width={50} height={10} />
405
- <PlaceholderLine width={70} height={10} />
406
- </Placeholder>
407
- </View>
408
- </Placeholder>
409
- </View>
410
- ),
411
- )}
412
- </>
413
- )}
414
- </ProductsList>
415
- <OModal
416
- open={openFilters}
417
- onCancel={() => handleCloseFilters()}
418
- onClose={() => handleCloseFilters()}
419
- >
420
- <ScrollView style={styles.filterContainer}>
421
- <OText
422
- size={20}
423
- mBottom={15}
424
- style={{ marginTop: 10 }}
425
- >
426
- {t('FILTER', 'Filter')}
427
- </OText>
428
- <SortContainer>
429
- <OText weight='bold' mBottom={7} size={16}>
430
- {t('SORT', 'Sort')}
431
- </OText>
432
- {sortItems?.filter(item => !(orderState?.options?.type === 1 && item?.value === 'pickup_time') && !(orderState?.options?.type === 2 && item?.value === 'delivery_time'))?.map(item => (
433
- <TouchableOpacity
434
- key={item?.value}
435
- onPress={() => handleChangeFilters('orderBy', item?.value)}
436
- style={{ marginBottom: 7 }}
437
- >
438
- <OText
439
- weight={filters?.orderBy?.includes(item?.value) ? 'bold' : '500'}
440
- mBottom={filters?.orderBy?.includes(item?.value) ? 5 : 0}
441
- >
442
- {item?.text} {(filters?.orderBy?.includes(item?.value)) && <>{filters?.orderBy?.includes('-') ? <AntDesignIcon name='caretup' /> : <AntDesignIcon name='caretdown' />}</>}
443
- </OText>
444
- </TouchableOpacity>
445
- ))}
446
- </SortContainer>
447
- <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}>
448
431
  <OText
449
- size={16}
450
- weight='bold'
451
- lineHeight={24}
452
- style={{ marginBottom: 10 }}
432
+ size={20}
433
+ mBottom={15}
434
+ style={{ marginTop: 10 }}
453
435
  >
454
- {t('BRANDS', 'Brands')}
436
+ {t('FILTER', 'Filter')}
455
437
  </OText>
456
- {!brandList?.loading && !brandList?.error && brandList?.brands?.length > 0 && (
457
- <ScrollView
458
- style={{ maxHeight: 300, marginBottom: 10 }}
459
- showsVerticalScrollIndicator={true}
460
- nestedScrollEnabled={true}
461
- >
462
- {brandList?.brands.map((brand: any, i: number) => brand?.enabled && (
463
- <BrandItem
464
- key={i}
465
- 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}
466
451
  >
467
- <OText
468
- size={14}
469
- weight={'400'}
470
- 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)}
471
476
  >
472
- {brand?.name}
473
- </OText>
474
- {filters?.franchise_ids?.includes(brand?.id) && (
475
- <AntDesignIcon
476
- name='check'
477
- color={theme.colors.success500}
478
- size={16}
479
- />
480
- )}
481
- </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
+ />
482
518
  ))}
483
- </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
+ />
484
529
  )}
485
- {!brandList?.loading && ((brandList?.brands?.filter((brand: any) => brand?.enabled))?.length === 0) && (
486
- <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
+ />
487
538
  )}
488
- </BrandContainer>
489
- <PriceFilterWrapper>
490
- <OText
491
- size={16}
492
- weight='bold'
493
- lineHeight={24}
494
- style={{ marginBottom: 5 }}
495
- >
496
- {t('PRICE_RANGE', 'Price range')}
497
- </OText>
498
- <View style={styles.priceContainer}>
499
- {priceList.map((price: any, i: number) => (
500
- <OButton
501
- key={i}
502
- bgColor={(filters?.price_level === price?.level) ? theme.colors.primary : theme.colors.backgroundGray200}
503
- onClick={() => handleChangePriceRange(price?.level)}
504
- text={`${price.content} ${(filters?.price_level === price?.level) ? ' X' : ''}`}
505
- style={styles.priceItem}
506
- textStyle={{ fontSize: 10, color: (filters?.price_level === price?.level) ? theme.colors.backgroundLight : theme.colors.textNormal }}
507
- />
508
- ))}
509
- </View>
510
- </PriceFilterWrapper>
511
- {orderState?.options?.type === 1 && (
512
- <MaxSectionItem
513
- filters={filters}
514
- title={t('MAX_DELIVERY_FEE', 'Max delivery fee')}
515
- options={maxDeliveryFeeOptions}
516
- filter='max_delivery_price'
517
- handleChangeFilters={handleChangeFilters}
518
- />
519
- )}
520
- {[1, 2].includes(orderState?.options?.type) && (
521
539
  <MaxSectionItem
522
540
  filters={filters}
523
- title={orderState?.options?.type === 1 ? t('MAX_DELIVERY_TIME', 'Max delivery time') : t('MAX_PICKUP_TIME', 'Max pickup time')}
524
- options={maxTimeOptions}
525
- filter='max_eta'
541
+ title={t('MAX_DISTANCE', 'Max distance')}
542
+ options={maxDistanceOptions}
543
+ filter='max_distance'
526
544
  handleChangeFilters={handleChangeFilters}
527
545
  />
528
- )}
529
- <MaxSectionItem
530
- filters={filters}
531
- title={t('MAX_DISTANCE', 'Max distance')}
532
- options={maxDistanceOptions}
533
- filter='max_distance'
534
- handleChangeFilters={handleChangeFilters}
535
- />
536
- {businessTypes?.length > 0 && (
537
- <TagsContainer>
538
- <OText weight='bold' mBottom={7} size={16}>{t('BUSINESS_CATEGORIES', 'Business categories')}</OText>
539
- <View style={styles.businessTypesContainer}>
540
- {businessTypes.map((type: any, i: number) => type.enabled && (
541
- <OButton
542
- key={type?.id}
543
- bgColor={(filters?.business_types?.includes(type?.id) || (type?.id === null && filters?.business_types?.length === 0)) ? theme.colors.primary : theme.colors.backgroundGray200}
544
- onClick={() => handleChangeActiveBusinessType(type)}
545
- text={`${t(`BUSINESS_TYPE_${type.name.replace(/\s/g, '_').toUpperCase()}`, type.name)} ${filters?.business_types?.includes(type?.id) ? 'X' : ''}`}
546
- style={styles.categoryStyle}
547
- textStyle={{ fontSize: 10, color: (filters?.business_types?.includes(type?.id) || (type?.id === null && filters?.business_types?.length === 0)) ? '#fff' : theme.colors.textNormal }}
548
- />
549
- ))}
550
- </View>
551
- </TagsContainer>
552
- )}
553
- </ScrollView>
554
- <WrapperButtons>
555
- <View style={{ width: '50%' }}>
556
- <OButton
557
- text={t('APPLY', 'Apply')}
558
- parentStyle={styles.applyButton}
559
- textStyle={{ color: '#fff' }}
560
- onClick={() => handleApplyFilters()}
561
- />
562
- </View>
563
- <View style={{ width: '50%' }}>
564
- <OButton
565
- text={t('CLEAR_FILTERS', 'Clear')}
566
- bgColor={theme.colors.white}
567
- borderColor={theme.colors.primary}
568
- parentStyle={styles.applyButton}
569
- textStyle={{ color: theme.colors.primary }}
570
- onClick={() => clearFilters()}
571
- />
572
- </View>
573
- </WrapperButtons>
574
- </OModal>
575
- </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>
576
587
  )
577
588
  }
578
589