ordering-ui-react-native 0.18.38 → 0.18.40-test

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 (35) hide show
  1. package/package.json +1 -1
  2. package/themes/business/src/components/DriverMap/index.tsx +1 -1
  3. package/themes/business/src/components/OrderSummary/index.tsx +120 -124
  4. package/themes/original/src/components/AddressForm/index.tsx +7 -4
  5. package/themes/original/src/components/AddressList/index.tsx +1 -1
  6. package/themes/original/src/components/BusinessBasicInformation/index.tsx +18 -3
  7. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +0 -3
  8. package/themes/original/src/components/BusinessController/index.tsx +3 -3
  9. package/themes/original/src/components/BusinessListingSearch/index.tsx +331 -276
  10. package/themes/original/src/components/BusinessProductsList/index.tsx +3 -3
  11. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  12. package/themes/original/src/components/BusinessProductsListing/index.tsx +49 -8
  13. package/themes/original/src/components/CartContent/index.tsx +56 -14
  14. package/themes/original/src/components/CartContent/styles.tsx +4 -0
  15. package/themes/original/src/components/Checkout/index.tsx +6 -5
  16. package/themes/original/src/components/GoogleMap/index.tsx +11 -2
  17. package/themes/original/src/components/LoginForm/index.tsx +15 -14
  18. package/themes/original/src/components/MultiCheckout/index.tsx +6 -5
  19. package/themes/original/src/components/MyOrders/index.tsx +14 -1
  20. package/themes/original/src/components/NavBar/index.tsx +9 -4
  21. package/themes/original/src/components/OrderSummary/index.tsx +4 -2
  22. package/themes/original/src/components/OrdersOption/index.tsx +3 -1
  23. package/themes/original/src/components/ProductForm/index.tsx +23 -11
  24. package/themes/original/src/components/ProductOptionSubOption/index.tsx +7 -5
  25. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +2 -2
  26. package/themes/original/src/components/SignupForm/index.tsx +14 -14
  27. package/themes/original/src/components/SingleOrderCard/index.tsx +7 -1
  28. package/themes/original/src/components/StripeElementsForm/index.tsx +17 -16
  29. package/themes/original/src/components/UserFormDetails/index.tsx +34 -5
  30. package/themes/original/src/components/UserProfile/index.tsx +2 -20
  31. package/themes/original/src/components/UserProfileForm/index.tsx +7 -2
  32. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  33. package/themes/original/src/components/Wallets/index.tsx +4 -4
  34. package/themes/original/src/types/index.tsx +2 -2
  35. package/themes/original/src/utils/index.tsx +11 -0
@@ -3,7 +3,7 @@ import { useLanguage, BusinessSearchList, useOrder, useUtils, showToast, ToastTy
3
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
8
  import { NotFoundSource } from '../NotFoundSource'
9
9
  import { SingleProductCard } from '../SingleProductCard'
@@ -30,6 +30,10 @@ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
30
30
  import { BusinessSearchParams } from '../../types'
31
31
  import { useIsFocused } from '@react-navigation/native';
32
32
  import { MaxSectionItem } from './MaxSectionItem'
33
+ import { IOScrollView } from 'react-native-intersection-observer'
34
+
35
+ const PIXELS_TO_SCROLL = 1000
36
+
33
37
  export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
34
38
  const {
35
39
  navigation,
@@ -67,6 +71,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
67
71
  ]
68
72
 
69
73
  const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
74
+ const hideBrowse = theme?.bar_menu?.components?.browse?.hidden
70
75
 
71
76
  const priceList = [
72
77
  { level: '1', content: '$' },
@@ -90,6 +95,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
90
95
  },
91
96
  searchInput: {
92
97
  fontSize: 12,
98
+ height: 44
93
99
  },
94
100
  productsContainer: {
95
101
  marginTop: 20
@@ -207,6 +213,18 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
207
213
  })
208
214
  }
209
215
 
216
+ const handleScroll = ({ nativeEvent }: any) => {
217
+ const y = nativeEvent.contentOffset.y;
218
+ const height = nativeEvent.contentSize.height;
219
+ const hasMore = !(
220
+ paginationProps.totalPages === paginationProps.currentPage
221
+ );
222
+
223
+ if (y + PIXELS_TO_SCROLL > height && !businessesSearchList.loading && hasMore && businessesSearchList?.businesses?.length > 0) {
224
+ handleSearchbusinessAndProducts();
225
+ }
226
+ };
227
+
210
228
  useEffect(() => {
211
229
  if (filters.business_types?.length === 0 && filters.orderBy === 'default' && Object.keys(filters)?.length === 2 && !openFilters) {
212
230
  handleSearchbusinessAndProducts(true)
@@ -223,297 +241,334 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
223
241
  }, [isFocused])
224
242
 
225
243
  return (
226
- <BContainer
227
- style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}
244
+ <IOScrollView
245
+ onScroll={(e: any) => handleScroll(e)}
246
+ showsVerticalScrollIndicator={false}
228
247
  >
229
- <SearchWrapper>
230
- <SearchBar
231
- lazyLoad
232
- {...(isChewLayout && { height: 55 })}
233
- inputStyle={{ ...styles.searchInput }}
234
- placeholder={t('SEARCH_BUSINESSES', 'Search Businesses')}
235
- onSearch={(val: string) => handleChangeTermValue(val)}
236
- value={termValue}
237
- iconCustomRight={<AntDesignIcon name='filter' size={16} style={{ bottom: 2 }} onPress={() => handleOpenfilters()} />}
238
- />
239
- </SearchWrapper>
240
- <OText size={12} lineHeight={20} color={theme.colors.textThird} mLeft={5}>
241
- {t('TYPE_AT_LEAST_3_CHARACTERS', 'Type at least 3 characters')}
242
- </OText>
243
- {
244
- noResults && (
245
- <View>
246
- <NotFoundSource
247
- content={t('NOT_FOUND_BUSINESSES', 'No businesses to delivery / pick up at this address, please change filters or change address.')}
248
- />
249
- </View>
250
- )
251
- }
252
- <ProductsList>
253
- {businessesSearchList.businesses?.filter((business: any) => business?.categories?.length > 0).map((business: any) => (
254
- <SingleBusinessSearch key={`card-${business?.id}`}>
255
- <SingleBusinessContainer>
256
- <BusinessInfo>
257
- {(business?.logo || theme.images?.dummies?.businessLogo) && (
258
- <FastImage
259
- style={{ height: 48, width: 48 }}
260
- source={{
261
- uri: optimizeImage(business?.logo, 'h_120,c_limit'),
262
- priority: FastImage.priority.normal,
263
- }}
264
- resizeMode={FastImage.resizeMode.cover}
265
- />
266
- )}
267
- </BusinessInfo>
268
- <BusinessInfoItem>
269
- <OText size={12}>{business?.name}</OText>
270
- <Metadata>
271
- {orderState?.options?.type === 1 && (
272
- <>
273
- <OText size={10}>{t('DELIVERY_FEE', 'Delivery fee')}{' '}</OText>
274
- <OText size={10} mRight={3}>
275
- {business && parsePrice(business?.delivery_price)}
276
- </OText>
277
- </>
278
- )}
279
- <OText size={10} mRight={3}>
280
- {convertHoursToMinutes(orderState?.options?.type === 1 ? business?.delivery_time : business?.pickup_time)}
281
- </OText>
282
- <OText size={10}>
283
- {parseDistance(business?.distance)}
284
- </OText>
285
- </Metadata>
286
- </BusinessInfoItem>
287
- <OButton
288
- onClick={() => onBusinessClick(business)}
289
- textStyle={{ color: theme.colors.primary, fontSize: 10 }}
290
- text={t('GO_TO_STORE', 'Go to store')}
291
- bgColor='#F5F9FF'
292
- borderColor='#fff'
293
- style={{ borderRadius: 50, paddingLeft: 5, paddingRight: 5, height: 20 }}
248
+ <View style={{
249
+ width: '100%',
250
+ display: 'flex',
251
+ flexDirection: 'row',
252
+ alignItems: 'center',
253
+ paddingHorizontal: hideBrowse && !isChewLayout ? 40 : 20,
254
+ }}>
255
+ {hideBrowse && !isChewLayout && (
256
+ <OButton
257
+ imgLeftStyle={{ width: 18 }}
258
+ imgRightSrc={null}
259
+ style={{
260
+ borderWidth: 0,
261
+ width: 26,
262
+ height: 26,
263
+ backgroundColor: '#FFF',
264
+ borderColor: '#FFF',
265
+ shadowColor: '#FFF',
266
+ paddingLeft: 0,
267
+ paddingRight: 0,
268
+ marginTop: 50,
269
+ }}
270
+ onClick={() => props.navigation.goBack()}
271
+ icon={AntDesignIcon}
272
+ iconProps={{
273
+ name: 'arrowleft',
274
+ size: 26
275
+ }}
276
+ />
277
+ )}
278
+ <HeaderTitle ph={20} text={t('SEARCH', 'Search')} />
279
+ <AntDesignIcon name='filter' size={18} style={{ marginLeft: 'auto', marginTop: 55, paddingHorizontal: 20 }} onPress={() => handleOpenfilters()} />
280
+ </View>
281
+ <BContainer
282
+ style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}
283
+ >
284
+ <SearchWrapper>
285
+ <SearchBar
286
+ lazyLoad
287
+ {...(isChewLayout && { height: 55 })}
288
+ inputStyle={{ ...styles.searchInput }}
289
+ placeholder={t('SEARCH_BUSINESSES', 'Search Businesses')}
290
+ onSearch={(val: string) => handleChangeTermValue(val)}
291
+ value={termValue}
292
+ />
293
+ </SearchWrapper>
294
+ <OText size={12} lineHeight={20} color={theme.colors.textThird} mLeft={5}>
295
+ {t('TYPE_AT_LEAST_2_CHARACTERS', 'Type at least 2 characters')}
296
+ </OText>
297
+ {
298
+ noResults && (
299
+ <View>
300
+ <NotFoundSource
301
+ content={t('NOT_FOUND_BUSINESSES', 'No businesses to delivery / pick up at this address, please change filters or change address.')}
294
302
  />
295
- </SingleBusinessContainer>
296
- <ScrollView horizontal style={styles.productsContainer} contentContainerStyle={{ flexGrow: 1 }}>
297
- {business?.categories?.map((category: any) => category?.products?.map((product: any, i: number) => (
298
- <SingleProductCard
299
- key={product?.id}
300
- isSoldOut={(product.inventoried && !product.quantity)}
301
- product={product}
302
- enableIntersection={false}
303
- businessId={business?.id}
304
- onProductClick={(product: any) => onProductClick(business, category?.id, product?.id, product)}
305
- productAddedToCartLength={0}
306
- handleUpdateProducts={(productId: number, changes: any) => handleUpdateProducts(productId, category?.id, business?.id, changes)}
307
- style={{
308
- width: screenWidth - (category?.products?.length > 1 ? 120 : 80),
309
- maxWidth: screenWidth - (category?.products?.length > 1 ? 120 : 80),
310
- marginRight: 20
311
- }}
303
+ </View>
304
+ )
305
+ }
306
+ <ProductsList>
307
+ {businessesSearchList.businesses?.filter((business: any) => business?.categories?.length > 0).map((business: any) => (
308
+ <SingleBusinessSearch key={`card-${business?.id}`}>
309
+ <SingleBusinessContainer>
310
+ <BusinessInfo>
311
+ {(business?.logo || theme.images?.dummies?.businessLogo) && (
312
+ <FastImage
313
+ style={{ height: 48, width: 48 }}
314
+ source={{
315
+ uri: optimizeImage(business?.logo, 'h_120,c_limit'),
316
+ priority: FastImage.priority.normal,
317
+ }}
318
+ resizeMode={FastImage.resizeMode.cover}
319
+ />
320
+ )}
321
+ </BusinessInfo>
322
+ <BusinessInfoItem>
323
+ <OText size={12}>{business?.name}</OText>
324
+ <Metadata>
325
+ {orderState?.options?.type === 1 && (
326
+ <>
327
+ <OText size={10}>{t('DELIVERY_FEE', 'Delivery fee')}{' '}</OText>
328
+ <OText size={10} mRight={3}>
329
+ {business && parsePrice(business?.delivery_price)}
330
+ </OText>
331
+ </>
332
+ )}
333
+ <OText size={10} mRight={3}>
334
+ {convertHoursToMinutes(orderState?.options?.type === 1 ? business?.delivery_time : business?.pickup_time)}
335
+ </OText>
336
+ <OText size={10}>
337
+ {parseDistance(business?.distance)}
338
+ </OText>
339
+ </Metadata>
340
+ </BusinessInfoItem>
341
+ <OButton
342
+ onClick={() => onBusinessClick(business)}
343
+ textStyle={{ color: theme.colors.primary, fontSize: 10 }}
344
+ text={t('GO_TO_STORE', 'Go to store')}
345
+ bgColor='#F5F9FF'
346
+ borderColor='#fff'
347
+ style={{ borderRadius: 50, paddingLeft: 5, paddingRight: 5, height: 20 }}
312
348
  />
313
- )))}
349
+ </SingleBusinessContainer>
350
+ <ScrollView horizontal style={styles.productsContainer} contentContainerStyle={{ flexGrow: 1 }}>
351
+ {business?.categories?.map((category: any) => category?.products?.map((product: any, i: number) => (
352
+ <SingleProductCard
353
+ key={product?.id}
354
+ isSoldOut={(product.inventoried && !product.quantity)}
355
+ product={product}
356
+ enableIntersection={false}
357
+ businessId={business?.id}
358
+ onProductClick={(product: any) => onProductClick(business, category?.id, product?.id, product)}
359
+ productAddedToCartLength={0}
360
+ handleUpdateProducts={(productId: number, changes: any) => handleUpdateProducts(productId, category?.id, business?.id, changes)}
361
+ style={{
362
+ width: screenWidth - (category?.products?.length > 1 ? 120 : 80),
363
+ maxWidth: screenWidth - (category?.products?.length > 1 ? 120 : 80),
364
+ marginRight: 20
365
+ }}
366
+ />
367
+ )))}
314
368
 
315
- </ScrollView>
316
- </SingleBusinessSearch>
317
- ))}
318
- {businessesSearchList?.loading && (
319
- <>
320
- {[...Array(3).keys()].map(
321
- (item, i) => (
322
- <View key={`skeleton:${i}`} style={{ width: '100%', marginTop: 20 }}>
323
- <Placeholder key={i} style={{ paddingHorizontal: 5 }} Animation={Fade}>
324
- <View style={{ flexDirection: 'row' }}>
325
- <PlaceholderLine
326
- width={24}
327
- height={70}
328
- style={{ marginRight: 10, marginBottom: 10 }}
329
- />
330
- <Placeholder style={{ paddingVertical: 10 }}>
331
- <PlaceholderLine width={20} style={{ marginBottom: 25 }} />
332
- <PlaceholderLine width={60} />
333
- </Placeholder>
334
- </View>
335
- </Placeholder>
336
- <Placeholder style={{ paddingHorizontal: 5, bottom: 10 }} Animation={Fade}>
337
- <View style={{ flexDirection: 'row-reverse', overflow: 'hidden' }}>
338
- <PlaceholderLine
339
- width={24}
340
- height={70}
341
- style={{ marginRight: 10, marginBottom: 5 }}
342
- />
343
- <Placeholder style={{ paddingVertical: 10 }}>
344
- <PlaceholderLine width={60} height={10} />
345
- <PlaceholderLine width={50} height={10} />
346
- <PlaceholderLine width={70} height={10} />
347
- </Placeholder>
348
- </View>
349
- </Placeholder>
350
- </View>
351
- ),
352
- )}
353
- </>
354
- )}
355
- </ProductsList>
356
- <OModal
357
- open={openFilters}
358
- onCancel={() => handleCloseFilters()}
359
- onClose={() => handleCloseFilters()}
360
- >
361
- <ScrollView style={styles.filterContainer}>
362
- <OText
363
- size={20}
364
- mBottom={15}
365
- style={{ marginTop: 10 }}
366
- >
367
- {t('FILTER', 'Filter')}
368
- </OText>
369
- <SortContainer>
370
- <OText weight='bold' mBottom={7} size={16}>
371
- {t('SORT', 'Sort')}
372
- </OText>
373
- {sortItems?.filter(item => !(orderState?.options?.type === 1 && item?.value === 'pickup_time') && !(orderState?.options?.type === 2 && item?.value === 'delivery_time'))?.map(item => (
374
- <TouchableOpacity
375
- key={item?.value}
376
- onPress={() => handleChangeFilters('orderBy', item?.value)}
377
- style={{ marginBottom: 7 }}
378
- >
379
- <OText
380
- weight={filters?.orderBy?.includes(item?.value) ? 'bold' : '500'}
381
- mBottom={filters?.orderBy?.includes(item?.value) ? 5 : 0}
382
- >
383
- {item?.text} {(filters?.orderBy?.includes(item?.value)) && <>{filters?.orderBy?.includes('-') ? <AntDesignIcon name='caretup' /> : <AntDesignIcon name='caretdown' />}</>}
384
- </OText>
385
- </TouchableOpacity>
386
- ))}
387
- </SortContainer>
388
- <BrandContainer>
369
+ </ScrollView>
370
+ </SingleBusinessSearch>
371
+ ))}
372
+ {businessesSearchList?.loading && (
373
+ <>
374
+ {[...Array(3).keys()].map(
375
+ (item, i) => (
376
+ <View key={`skeleton:${i}`} style={{ width: '100%', marginTop: 20 }}>
377
+ <Placeholder key={i} style={{ paddingHorizontal: 5 }} Animation={Fade}>
378
+ <View style={{ flexDirection: 'row' }}>
379
+ <PlaceholderLine
380
+ width={24}
381
+ height={70}
382
+ style={{ marginRight: 10, marginBottom: 10 }}
383
+ />
384
+ <Placeholder style={{ paddingVertical: 10 }}>
385
+ <PlaceholderLine width={20} style={{ marginBottom: 25 }} />
386
+ <PlaceholderLine width={60} />
387
+ </Placeholder>
388
+ </View>
389
+ </Placeholder>
390
+ <Placeholder style={{ paddingHorizontal: 5, bottom: 10 }} Animation={Fade}>
391
+ <View style={{ flexDirection: 'row-reverse', overflow: 'hidden' }}>
392
+ <PlaceholderLine
393
+ width={24}
394
+ height={70}
395
+ style={{ marginRight: 10, marginBottom: 5 }}
396
+ />
397
+ <Placeholder style={{ paddingVertical: 10 }}>
398
+ <PlaceholderLine width={60} height={10} />
399
+ <PlaceholderLine width={50} height={10} />
400
+ <PlaceholderLine width={70} height={10} />
401
+ </Placeholder>
402
+ </View>
403
+ </Placeholder>
404
+ </View>
405
+ ),
406
+ )}
407
+ </>
408
+ )}
409
+ </ProductsList>
410
+ <OModal
411
+ open={openFilters}
412
+ onCancel={() => handleCloseFilters()}
413
+ onClose={() => handleCloseFilters()}
414
+ >
415
+ <ScrollView style={styles.filterContainer}>
389
416
  <OText
390
- size={16}
391
- weight='bold'
392
- lineHeight={24}
393
- style={{ marginBottom: 10 }}
417
+ size={20}
418
+ mBottom={15}
419
+ style={{ marginTop: 10 }}
394
420
  >
395
- {t('BRANDS', 'Brands')}
421
+ {t('FILTER', 'Filter')}
396
422
  </OText>
397
- {!brandList?.loading && !brandList?.error && brandList?.brands?.length > 0 && (
398
- <ScrollView
399
- style={{ maxHeight: 300, marginBottom: 10 }}
400
- showsVerticalScrollIndicator={true}
401
- nestedScrollEnabled={true}
402
- >
403
- {brandList?.brands.map((brand: any, i: number) => brand?.enabled && (
404
- <BrandItem
405
- key={i}
406
- onPress={() => handleChangeBrandFilter(brand?.id)}
423
+ <SortContainer>
424
+ <OText weight='bold' mBottom={7} size={16}>
425
+ {t('SORT', 'Sort')}
426
+ </OText>
427
+ {sortItems?.filter(item => !(orderState?.options?.type === 1 && item?.value === 'pickup_time') && !(orderState?.options?.type === 2 && item?.value === 'delivery_time'))?.map(item => (
428
+ <TouchableOpacity
429
+ key={item?.value}
430
+ onPress={() => handleChangeFilters('orderBy', item?.value)}
431
+ style={{ marginBottom: 7 }}
432
+ >
433
+ <OText
434
+ weight={filters?.orderBy?.includes(item?.value) ? 'bold' : '500'}
435
+ mBottom={filters?.orderBy?.includes(item?.value) ? 5 : 0}
407
436
  >
408
- <OText
409
- size={14}
410
- weight={'400'}
411
- lineHeight={24}
437
+ {item?.text} {(filters?.orderBy?.includes(item?.value)) && <>{filters?.orderBy?.includes('-') ? <AntDesignIcon name='caretup' /> : <AntDesignIcon name='caretdown' />}</>}
438
+ </OText>
439
+ </TouchableOpacity>
440
+ ))}
441
+ </SortContainer>
442
+ <BrandContainer>
443
+ <OText
444
+ size={16}
445
+ weight='bold'
446
+ lineHeight={24}
447
+ style={{ marginBottom: 10 }}
448
+ >
449
+ {t('BRANDS', 'Brands')}
450
+ </OText>
451
+ {!brandList?.loading && !brandList?.error && brandList?.brands?.length > 0 && (
452
+ <ScrollView
453
+ style={{ maxHeight: 300, marginBottom: 10 }}
454
+ showsVerticalScrollIndicator={true}
455
+ nestedScrollEnabled={true}
456
+ >
457
+ {brandList?.brands.map((brand: any, i: number) => brand?.enabled && (
458
+ <BrandItem
459
+ key={i}
460
+ onPress={() => handleChangeBrandFilter(brand?.id)}
412
461
  >
413
- {brand?.name}
414
- </OText>
415
- {filters?.franchise_ids?.includes(brand?.id) && (
416
- <AntDesignIcon
417
- name='check'
418
- color={theme.colors.success500}
419
- size={16}
420
- />
421
- )}
422
- </BrandItem>
462
+ <OText
463
+ size={14}
464
+ weight={'400'}
465
+ lineHeight={24}
466
+ >
467
+ {brand?.name}
468
+ </OText>
469
+ {filters?.franchise_ids?.includes(brand?.id) && (
470
+ <AntDesignIcon
471
+ name='check'
472
+ color={theme.colors.success500}
473
+ size={16}
474
+ />
475
+ )}
476
+ </BrandItem>
477
+ ))}
478
+ </ScrollView>
479
+ )}
480
+ {!brandList?.loading && ((brandList?.brands?.filter((brand: any) => brand?.enabled))?.length === 0) && (
481
+ <OText size={14} weight='400'>{t('NO_RESULTS_FOUND', 'Sorry, no results found')}</OText>
482
+ )}
483
+ </BrandContainer>
484
+ <PriceFilterWrapper>
485
+ <OText
486
+ size={16}
487
+ weight='bold'
488
+ lineHeight={24}
489
+ style={{ marginBottom: 5 }}
490
+ >
491
+ {t('PRICE_RANGE', 'Price range')}
492
+ </OText>
493
+ <View style={styles.priceContainer}>
494
+ {priceList.map((price: any, i: number) => (
495
+ <OButton
496
+ key={i}
497
+ bgColor={(filters?.price_level === price?.level) ? theme.colors.primary : theme.colors.backgroundGray200}
498
+ onClick={() => handleChangePriceRange(price?.level)}
499
+ text={`${price.content} ${(filters?.price_level === price?.level) ? ' X' : ''}`}
500
+ style={styles.priceItem}
501
+ textStyle={{ fontSize: 10, color: (filters?.price_level === price?.level) ? theme.colors.backgroundLight : theme.colors.textNormal }}
502
+ />
423
503
  ))}
424
- </ScrollView>
504
+ </View>
505
+ </PriceFilterWrapper>
506
+ {orderState?.options?.type === 1 && (
507
+ <MaxSectionItem
508
+ filters={filters}
509
+ title={t('MAX_DELIVERY_FEE', 'Max delivery fee')}
510
+ options={maxDeliveryFeeOptions}
511
+ filter='max_delivery_price'
512
+ handleChangeFilters={handleChangeFilters}
513
+ />
425
514
  )}
426
- {!brandList?.loading && ((brandList?.brands?.filter((brand: any) => brand?.enabled))?.length === 0) && (
427
- <OText size={14} weight='400'>{t('NO_RESULTS_FOUND', 'Sorry, no results found')}</OText>
515
+ {[1, 2].includes(orderState?.options?.type) && (
516
+ <MaxSectionItem
517
+ filters={filters}
518
+ title={orderState?.options?.type === 1 ? t('MAX_DELIVERY_TIME', 'Max delivery time') : t('MAX_PICKUP_TIME', 'Max pickup time')}
519
+ options={maxTimeOptions}
520
+ filter='max_eta'
521
+ handleChangeFilters={handleChangeFilters}
522
+ />
428
523
  )}
429
- </BrandContainer>
430
- <PriceFilterWrapper>
431
- <OText
432
- size={16}
433
- weight='bold'
434
- lineHeight={24}
435
- style={{ marginBottom: 5 }}
436
- >
437
- {t('PRICE_RANGE', 'Price range')}
438
- </OText>
439
- <View style={styles.priceContainer}>
440
- {priceList.map((price: any, i: number) => (
441
- <OButton
442
- key={i}
443
- bgColor={(filters?.price_level === price?.level) ? theme.colors.primary : theme.colors.backgroundGray200}
444
- onClick={() => handleChangePriceRange(price?.level)}
445
- text={`${price.content} ${(filters?.price_level === price?.level) ? ' X' : ''}`}
446
- style={styles.priceItem}
447
- textStyle={{ fontSize: 10, color: (filters?.price_level === price?.level) ? theme.colors.backgroundLight : theme.colors.textNormal }}
448
- />
449
- ))}
450
- </View>
451
- </PriceFilterWrapper>
452
- {orderState?.options?.type === 1 && (
453
- <MaxSectionItem
454
- filters={filters}
455
- title={t('MAX_DELIVERY_FEE', 'Max delivery fee')}
456
- options={maxDeliveryFeeOptions}
457
- filter='max_delivery_price'
458
- handleChangeFilters={handleChangeFilters}
459
- />
460
- )}
461
- {[1, 2].includes(orderState?.options?.type) && (
462
524
  <MaxSectionItem
463
525
  filters={filters}
464
- title={orderState?.options?.type === 1 ? t('MAX_DELIVERY_TIME', 'Max delivery time') : t('MAX_PICKUP_TIME', 'Max pickup time')}
465
- options={maxTimeOptions}
466
- filter='max_eta'
526
+ title={t('MAX_DISTANCE', 'Max distance')}
527
+ options={maxDistanceOptions}
528
+ filter='max_distance'
467
529
  handleChangeFilters={handleChangeFilters}
468
530
  />
469
- )}
470
- <MaxSectionItem
471
- filters={filters}
472
- title={t('MAX_DISTANCE', 'Max distance')}
473
- options={maxDistanceOptions}
474
- filter='max_distance'
475
- handleChangeFilters={handleChangeFilters}
476
- />
477
- {businessTypes?.length > 0 && (
478
- <TagsContainer>
479
- <OText weight='bold' mBottom={7} size={16}>{t('BUSINESS_CATEGORIES', 'Business categories')}</OText>
480
- <View style={styles.businessTypesContainer}>
481
- {businessTypes.map((type: any, i: number) => type.enabled && (
482
- <OButton
483
- key={type?.id}
484
- bgColor={(filters?.business_types?.includes(type?.id) || (type?.id === null && filters?.business_types?.length === 0)) ? theme.colors.primary : theme.colors.backgroundGray200}
485
- onClick={() => handleChangeActiveBusinessType(type)}
486
- text={`${t(`BUSINESS_TYPE_${type.name.replace(/\s/g, '_').toUpperCase()}`, type.name)} ${filters?.business_types?.includes(type?.id) ? 'X' : ''}`}
487
- style={styles.categoryStyle}
488
- textStyle={{ fontSize: 10, color: (filters?.business_types?.includes(type?.id) || (type?.id === null && filters?.business_types?.length === 0)) ? '#fff' : theme.colors.textNormal }}
489
- />
490
- ))}
491
- </View>
492
- </TagsContainer>
493
- )}
494
- </ScrollView>
495
- <WrapperButtons>
496
- <View style={{ width: '50%' }}>
497
- <OButton
498
- text={t('APPLY', 'Apply')}
499
- parentStyle={styles.applyButton}
500
- textStyle={{ color: '#fff' }}
501
- onClick={() => handleApplyFilters()}
502
- />
503
- </View>
504
- <View style={{ width: '50%' }}>
505
- <OButton
506
- text={t('CLEAR_FILTERS', 'Clear')}
507
- bgColor={theme.colors.white}
508
- borderColor={theme.colors.primary}
509
- parentStyle={styles.applyButton}
510
- textStyle={{ color: theme.colors.primary }}
511
- onClick={() => clearFilters()}
512
- />
513
- </View>
514
- </WrapperButtons>
515
- </OModal>
516
- </BContainer>
531
+ {businessTypes?.length > 0 && (
532
+ <TagsContainer>
533
+ <OText weight='bold' mBottom={7} size={16}>{t('BUSINESS_CATEGORIES', 'Business categories')}</OText>
534
+ <View style={styles.businessTypesContainer}>
535
+ {businessTypes.map((type: any, i: number) => type.enabled && (
536
+ <OButton
537
+ key={type?.id}
538
+ bgColor={(filters?.business_types?.includes(type?.id) || (type?.id === null && filters?.business_types?.length === 0)) ? theme.colors.primary : theme.colors.backgroundGray200}
539
+ onClick={() => handleChangeActiveBusinessType(type)}
540
+ text={`${t(`BUSINESS_TYPE_${type.name.replace(/\s/g, '_').toUpperCase()}`, type.name)} ${filters?.business_types?.includes(type?.id) ? 'X' : ''}`}
541
+ style={styles.categoryStyle}
542
+ textStyle={{ fontSize: 10, color: (filters?.business_types?.includes(type?.id) || (type?.id === null && filters?.business_types?.length === 0)) ? '#fff' : theme.colors.textNormal }}
543
+ />
544
+ ))}
545
+ </View>
546
+ </TagsContainer>
547
+ )}
548
+ </ScrollView>
549
+ <WrapperButtons>
550
+ <View style={{ width: '50%' }}>
551
+ <OButton
552
+ text={t('APPLY', 'Apply')}
553
+ parentStyle={styles.applyButton}
554
+ textStyle={{ color: '#fff' }}
555
+ onClick={() => handleApplyFilters()}
556
+ />
557
+ </View>
558
+ <View style={{ width: '50%' }}>
559
+ <OButton
560
+ text={t('CLEAR_FILTERS', 'Clear')}
561
+ bgColor={theme.colors.white}
562
+ borderColor={theme.colors.primary}
563
+ parentStyle={styles.applyButton}
564
+ textStyle={{ color: theme.colors.primary }}
565
+ onClick={() => clearFilters()}
566
+ />
567
+ </View>
568
+ </WrapperButtons>
569
+ </OModal>
570
+ </BContainer>
571
+ </IOScrollView>
517
572
  )
518
573
  }
519
574