ordering-ui-react-native 0.18.38 → 0.18.39

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