ordering-ui-react-native 0.15.29 → 0.15.30-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.
- package/package.json +4 -2
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessController/index.tsx +8 -2
- package/src/components/BusinessTypeFilter/index.tsx +4 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +23 -3
- package/src/components/DriverTips/index.tsx +11 -6
- package/src/components/LanguageSelector/index.tsx +7 -2
- package/src/components/LoginForm/index.tsx +3 -1
- package/src/components/OrderDetails/index.tsx +2 -2
- package/src/components/PaymentOptions/index.tsx +9 -16
- package/src/components/PaymentOptionsWebView/index.tsx +123 -124
- package/src/components/SignupForm/index.tsx +3 -1
- package/src/components/SingleProductCard/index.tsx +16 -4
- package/src/components/StripeElementsForm/index.tsx +27 -48
- package/src/components/UpsellingProducts/index.tsx +1 -1
- package/src/components/UserProfileForm/index.tsx +63 -6
- package/src/components/UserProfileForm/styles.tsx +8 -0
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OModal.tsx +1 -1
- package/src/config.json +0 -2
- package/src/hooks/useCountdownTimer.tsx +26 -0
- package/src/navigators/HomeNavigator.tsx +6 -0
- package/src/pages/BusinessProductsList.tsx +1 -0
- package/src/pages/BusinessesListing.tsx +1 -1
- package/src/pages/Checkout.tsx +1 -1
- package/src/pages/Sessions.tsx +22 -0
- package/src/types/index.tsx +5 -11
- package/src/utils/index.tsx +68 -1
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
- package/themes/business/src/components/Chat/index.tsx +38 -86
- package/themes/business/src/components/DriverMap/index.tsx +6 -5
- package/themes/business/src/components/Home/index.tsx +128 -55
- package/themes/business/src/components/Home/styles.tsx +8 -1
- package/themes/business/src/components/LoginForm/index.tsx +89 -2
- package/themes/business/src/components/LoginForm/styles.tsx +6 -0
- package/themes/business/src/components/LogoutButton/index.tsx +1 -1
- package/themes/business/src/components/NewOrderNotification/index.tsx +79 -105
- package/themes/business/src/components/OrderDetails/Business.tsx +2 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +32 -15
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +151 -89
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +91 -17
- package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
- package/themes/business/src/components/OrdersListManager/index.tsx +874 -0
- package/themes/business/src/components/OrdersListManager/styles.tsx +123 -0
- package/themes/business/src/components/OrdersListManager/utils.tsx +216 -0
- package/themes/business/src/components/OrdersOption/index.tsx +58 -51
- package/themes/business/src/components/PreviousOrders/index.tsx +75 -22
- package/themes/business/src/components/shared/OModal.tsx +1 -1
- package/themes/business/src/types/index.tsx +5 -1
- package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/kiosk/src/components/Cart/index.tsx +98 -24
- package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
- package/themes/kiosk/src/components/CartBottomSheet/index.tsx +1 -1
- package/themes/kiosk/src/components/CartBottomSheet/styles.tsx +1 -1
- package/themes/kiosk/src/components/CartContent/index.tsx +13 -3
- package/themes/kiosk/src/components/CartItem/index.tsx +20 -8
- package/themes/kiosk/src/components/CustomerName/index.tsx +89 -88
- package/themes/kiosk/src/components/Intro/index.tsx +13 -13
- package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderDetails/index.tsx +136 -41
- package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
- package/themes/kiosk/src/components/OrderSummary/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
- package/themes/kiosk/src/components/ProductForm/index.tsx +174 -125
- package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
- package/themes/kiosk/src/components/ProductOption/index.tsx +1 -0
- package/themes/kiosk/src/components/ProductOption/styles.tsx +1 -0
- package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/kiosk/src/types/index.d.ts +2 -0
- package/themes/original/index.tsx +178 -1
- package/themes/original/src/components/AddressForm/index.tsx +15 -10
- package/themes/original/src/components/AddressList/index.tsx +56 -18
- package/themes/original/src/components/AppleLogin/index.tsx +117 -78
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +96 -45
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
- package/themes/original/src/components/BusinessController/index.tsx +52 -22
- package/themes/original/src/components/BusinessController/styles.tsx +22 -0
- package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
- package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
- package/themes/original/src/components/BusinessListingSearch/index.tsx +121 -7
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +14 -1
- package/themes/original/src/components/BusinessMenuList/index.tsx +11 -4
- package/themes/original/src/components/BusinessPreorder/index.tsx +142 -122
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +9 -7
- package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
- package/themes/original/src/components/BusinessProductsList/index.tsx +132 -35
- package/themes/original/src/components/BusinessProductsList/styles.tsx +29 -2
- package/themes/original/src/components/BusinessProductsListing/index.tsx +118 -37
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
- package/themes/original/src/components/BusinessReviews/index.tsx +4 -25
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
- package/themes/original/src/components/BusinessesListing/index.tsx +74 -70
- package/themes/original/src/components/Cart/index.tsx +21 -17
- package/themes/original/src/components/CartContent/index.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +59 -48
- package/themes/original/src/components/DriverTips/index.tsx +17 -12
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
- package/themes/original/src/components/GPSButton/index.tsx +15 -8
- package/themes/original/src/components/GoogleMap/index.tsx +1 -0
- package/themes/original/src/components/Help/index.tsx +21 -4
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +97 -89
- package/themes/original/src/components/Home/index.tsx +1 -1
- package/themes/original/src/components/LastOrders/index.tsx +12 -1
- package/themes/original/src/components/LoginForm/Otp/index.tsx +90 -0
- package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
- package/themes/original/src/components/LoginForm/index.tsx +394 -155
- package/themes/original/src/components/LoginForm/styles.tsx +7 -4
- package/themes/original/src/components/LogoutButton/index.tsx +7 -1
- package/themes/original/src/components/MessageListing/index.tsx +10 -1
- package/themes/original/src/components/Messages/index.tsx +34 -25
- package/themes/original/src/components/Messages/styles.tsx +1 -3
- package/themes/original/src/components/MomentOption/index.tsx +10 -1
- package/themes/original/src/components/MomentOption/styles.tsx +1 -1
- package/themes/original/src/components/OrderDetails/index.tsx +56 -33
- package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
- package/themes/original/src/components/OrderProgress/index.tsx +4 -4
- package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
- package/themes/original/src/components/OrderSummary/index.tsx +3 -3
- package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
- package/themes/original/src/components/OrdersOption/index.tsx +55 -58
- package/themes/original/src/components/OrdersOption/styles.tsx +0 -6
- package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +22 -24
- package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
- package/themes/original/src/components/PaymentOptions/index.tsx +9 -21
- package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
- package/themes/original/src/components/PreviousOrders/index.tsx +16 -14
- package/themes/original/src/components/ProductForm/index.tsx +76 -61
- package/themes/original/src/components/ProductForm/styles.tsx +2 -2
- package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
- package/themes/original/src/components/Promotions/index.tsx +250 -0
- package/themes/original/src/components/Promotions/styles.tsx +60 -0
- package/themes/original/src/components/ReviewOrder/index.tsx +10 -9
- package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
- package/themes/original/src/components/SearchBar/index.tsx +4 -1
- package/themes/original/src/components/Sessions/index.tsx +160 -0
- package/themes/original/src/components/Sessions/styles.tsx +15 -0
- package/themes/original/src/components/SignupForm/index.tsx +9 -4
- package/themes/original/src/components/SingleProductCard/index.tsx +47 -21
- package/themes/original/src/components/SingleProductCard/styles.tsx +28 -1
- package/themes/original/src/components/StripeElementsForm/index.tsx +55 -74
- package/themes/original/src/components/TaxInformation/index.tsx +10 -4
- package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
- package/themes/original/src/components/UserDetails/index.tsx +4 -95
- package/themes/original/src/components/UserFormDetails/index.tsx +34 -24
- package/themes/original/src/components/UserProfile/index.tsx +62 -14
- package/themes/original/src/components/UserProfileForm/index.tsx +20 -18
- package/themes/original/src/components/UserVerification/index.tsx +178 -192
- package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
- package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
- package/themes/original/src/components/Wallets/index.tsx +76 -9
- package/themes/original/src/components/Wallets/styles.tsx +21 -0
- package/themes/original/src/components/shared/HeaderTitle.tsx +21 -0
- package/themes/original/src/components/shared/OModal.tsx +1 -1
- package/themes/original/src/components/shared/index.tsx +2 -0
- package/themes/original/src/config/constants.tsx +6 -6
- package/themes/original/src/types/index.tsx +68 -6
- package/themes/original/src/utils/index.tsx +28 -2
- package/themes/single-business/src/components/AddressList/index.tsx +1 -1
- package/themes/single-business/src/components/OrderTypeSelector/index.tsx +6 -6
- package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/StripeMethodForm/index.tsx +0 -174
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react'
|
|
2
2
|
import { useLanguage, BusinessSearchList, useOrder, useUtils } from 'ordering-components/native'
|
|
3
|
-
import { ScrollView, StyleSheet, TouchableOpacity, Platform, View } from 'react-native'
|
|
3
|
+
import { ScrollView, StyleSheet, TouchableOpacity, Platform, View, Dimensions } from 'react-native'
|
|
4
4
|
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
5
5
|
import { useTheme } from 'styled-components/native'
|
|
6
6
|
import { OButton, OIcon, OModal, OText } from '../shared'
|
|
@@ -22,15 +22,18 @@ import {
|
|
|
22
22
|
ProgressContentWrapper,
|
|
23
23
|
ProgressBar,
|
|
24
24
|
TagsContainer,
|
|
25
|
-
SortContainer
|
|
25
|
+
SortContainer,
|
|
26
|
+
BrandContainer,
|
|
27
|
+
BrandItem,
|
|
28
|
+
PriceFilterWrapper
|
|
26
29
|
} from './styles'
|
|
27
30
|
import FastImage from 'react-native-fast-image'
|
|
28
31
|
import { convertHoursToMinutes } from '../../utils'
|
|
29
32
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
|
|
30
33
|
import { BusinessSearchParams } from '../../types'
|
|
31
34
|
|
|
32
|
-
export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
33
35
|
|
|
36
|
+
export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
34
37
|
const {
|
|
35
38
|
navigation,
|
|
36
39
|
businessesSearchList,
|
|
@@ -42,9 +45,11 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
42
45
|
handleChangeFilters,
|
|
43
46
|
filters,
|
|
44
47
|
businessTypes,
|
|
45
|
-
setFilters
|
|
48
|
+
setFilters,
|
|
49
|
+
brandList
|
|
46
50
|
} = props
|
|
47
|
-
|
|
51
|
+
|
|
52
|
+
const screenHeight = Dimensions.get('window').height;
|
|
48
53
|
const theme = useTheme()
|
|
49
54
|
const [orderState] = useOrder()
|
|
50
55
|
const { top } = useSafeAreaInsets();
|
|
@@ -63,11 +68,24 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
63
68
|
{ text: t('PICKUP_TIME', 'Pickup time'), value: 'pickup_time' }
|
|
64
69
|
]
|
|
65
70
|
|
|
71
|
+
const priceList = [
|
|
72
|
+
{ level: '1', content: '$' },
|
|
73
|
+
{ level: '2', content: '$$' },
|
|
74
|
+
{ level: '3', content: '$$$' },
|
|
75
|
+
{ level: '4', content: '$$$$' },
|
|
76
|
+
{ level: '5', content: '$$$$$' }
|
|
77
|
+
]
|
|
78
|
+
|
|
66
79
|
const styles = StyleSheet.create({
|
|
67
80
|
container: {
|
|
68
81
|
paddingHorizontal: 40,
|
|
69
82
|
width: '100%'
|
|
70
83
|
},
|
|
84
|
+
filterContainer: {
|
|
85
|
+
maxHeight: screenHeight - 150,
|
|
86
|
+
paddingHorizontal: 40,
|
|
87
|
+
width: '100%'
|
|
88
|
+
},
|
|
71
89
|
searchInput: {
|
|
72
90
|
fontSize: 10,
|
|
73
91
|
},
|
|
@@ -84,6 +102,12 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
84
102
|
flexWrap: 'wrap',
|
|
85
103
|
justifyContent: 'center'
|
|
86
104
|
},
|
|
105
|
+
priceContainer: {
|
|
106
|
+
width: '100%',
|
|
107
|
+
flexDirection: 'row',
|
|
108
|
+
flexWrap: 'wrap',
|
|
109
|
+
justifyContent: 'space-between'
|
|
110
|
+
},
|
|
87
111
|
categoryStyle: {
|
|
88
112
|
marginRight: 10,
|
|
89
113
|
marginTop: 10,
|
|
@@ -95,6 +119,16 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
95
119
|
height: 28,
|
|
96
120
|
borderWidth: 0
|
|
97
121
|
},
|
|
122
|
+
priceItem: {
|
|
123
|
+
marginRight: 10,
|
|
124
|
+
marginTop: 10,
|
|
125
|
+
borderRadius: 50,
|
|
126
|
+
paddingVertical: 4,
|
|
127
|
+
paddingLeft: 5,
|
|
128
|
+
paddingRight: 5,
|
|
129
|
+
height: 27,
|
|
130
|
+
borderWidth: 0
|
|
131
|
+
},
|
|
98
132
|
applyButton: {
|
|
99
133
|
paddingHorizontal: 40,
|
|
100
134
|
width: '100%',
|
|
@@ -107,7 +141,7 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
107
141
|
}
|
|
108
142
|
|
|
109
143
|
const handleCloseFilters = () => {
|
|
110
|
-
setFilters({ business_types: [], orderBy: 'default' })
|
|
144
|
+
setFilters({ business_types: [], orderBy: 'default', franchise_ids: [], price_level: null })
|
|
111
145
|
setOpenFilters(false)
|
|
112
146
|
}
|
|
113
147
|
|
|
@@ -126,6 +160,18 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
126
160
|
}
|
|
127
161
|
}
|
|
128
162
|
|
|
163
|
+
const handleChangeBrandFilter = (brandId: number) => {
|
|
164
|
+
let franchiseIds = [...filters?.franchise_ids]
|
|
165
|
+
if (filters?.franchise_ids?.includes(brandId)) franchiseIds = filters?.franchise_ids?.filter((item: any) => item !== brandId)
|
|
166
|
+
else franchiseIds.push(brandId)
|
|
167
|
+
handleChangeFilters && handleChangeFilters('franchise_ids', franchiseIds)
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const handleChangePriceRange = (value: string) => {
|
|
171
|
+
if (value === filters?.price_level) handleChangeFilters('price_level', null)
|
|
172
|
+
else handleChangeFilters('price_level', value)
|
|
173
|
+
}
|
|
174
|
+
|
|
129
175
|
const handleApplyFilters = () => {
|
|
130
176
|
handleSearchbusinessAndProducts(true)
|
|
131
177
|
setOpenFilters(false)
|
|
@@ -137,6 +183,10 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
137
183
|
}
|
|
138
184
|
}, [filters, openFilters])
|
|
139
185
|
|
|
186
|
+
useEffect(() => {
|
|
187
|
+
handleSearchbusinessAndProducts(true)
|
|
188
|
+
}, [])
|
|
189
|
+
|
|
140
190
|
const MaxSectionItem = ({ title, options, filter }: any) => {
|
|
141
191
|
const parseValue = (option: number) => {
|
|
142
192
|
return filter === 'max_distance'
|
|
@@ -384,7 +434,7 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
384
434
|
onCancel={() => handleCloseFilters()}
|
|
385
435
|
onClose={() => handleCloseFilters()}
|
|
386
436
|
>
|
|
387
|
-
<ScrollView style={styles.
|
|
437
|
+
<ScrollView style={styles.filterContainer}>
|
|
388
438
|
<OText
|
|
389
439
|
size={20}
|
|
390
440
|
mBottom={15}
|
|
@@ -411,6 +461,70 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
411
461
|
</TouchableOpacity>
|
|
412
462
|
))}
|
|
413
463
|
</SortContainer>
|
|
464
|
+
<BrandContainer>
|
|
465
|
+
<OText
|
|
466
|
+
size={16}
|
|
467
|
+
weight='bold'
|
|
468
|
+
lineHeight={24}
|
|
469
|
+
style={{ marginBottom: 10 }}
|
|
470
|
+
>
|
|
471
|
+
{t('BRANDS', 'Brands')}
|
|
472
|
+
</OText>
|
|
473
|
+
{!brandList?.loading && !brandList?.error && brandList?.brands?.length > 0 && (
|
|
474
|
+
<ScrollView
|
|
475
|
+
style={{ maxHeight: 300, marginBottom: 10 }}
|
|
476
|
+
showsVerticalScrollIndicator={true}
|
|
477
|
+
nestedScrollEnabled={true}
|
|
478
|
+
>
|
|
479
|
+
{brandList?.brands.map((brand: any, i: number) => brand?.enabled && (
|
|
480
|
+
<BrandItem
|
|
481
|
+
key={i}
|
|
482
|
+
onPress={() => handleChangeBrandFilter(brand?.id)}
|
|
483
|
+
>
|
|
484
|
+
<OText
|
|
485
|
+
size={14}
|
|
486
|
+
weight={'400'}
|
|
487
|
+
lineHeight={24}
|
|
488
|
+
>
|
|
489
|
+
{brand?.name}
|
|
490
|
+
</OText>
|
|
491
|
+
{filters?.franchise_ids?.includes(brand?.id) && (
|
|
492
|
+
<AntDesignIcon
|
|
493
|
+
name='check'
|
|
494
|
+
color={theme.colors.success500}
|
|
495
|
+
size={16}
|
|
496
|
+
/>
|
|
497
|
+
)}
|
|
498
|
+
</BrandItem>
|
|
499
|
+
))}
|
|
500
|
+
</ScrollView>
|
|
501
|
+
)}
|
|
502
|
+
{!brandList?.loading && ((brandList?.brands?.filter((brand: any) => brand?.enabled))?.length === 0) && (
|
|
503
|
+
<OText size={14} weight='400'>{t('NO_RESULTS_FOUND', 'Sorry, no results found')}</OText>
|
|
504
|
+
)}
|
|
505
|
+
</BrandContainer>
|
|
506
|
+
<PriceFilterWrapper>
|
|
507
|
+
<OText
|
|
508
|
+
size={16}
|
|
509
|
+
weight='bold'
|
|
510
|
+
lineHeight={24}
|
|
511
|
+
style={{ marginBottom: 5 }}
|
|
512
|
+
>
|
|
513
|
+
{t('PRICE_RANGE', 'Price range')}
|
|
514
|
+
</OText>
|
|
515
|
+
<View style={styles.priceContainer}>
|
|
516
|
+
{priceList.map((price: any, i: number) => (
|
|
517
|
+
<OButton
|
|
518
|
+
key={i}
|
|
519
|
+
bgColor={(filters?.price_level === price?.level) ? theme.colors.primary : theme.colors.backgroundGray200}
|
|
520
|
+
onClick={() => handleChangePriceRange(price?.level)}
|
|
521
|
+
text={`${price.content} ${(filters?.price_level === price?.level) ? ' X' : ''}`}
|
|
522
|
+
style={styles.priceItem}
|
|
523
|
+
textStyle={{ fontSize: 10, color: (filters?.price_level === price?.level) ? theme.colors.backgroundLight : theme.colors.textNormal }}
|
|
524
|
+
/>
|
|
525
|
+
))}
|
|
526
|
+
</View>
|
|
527
|
+
</PriceFilterWrapper>
|
|
414
528
|
{orderState?.options?.type === 1 && (
|
|
415
529
|
<MaxSectionItem
|
|
416
530
|
title={t('MAX_DELIVERY_FEE', 'Max delivery fee')}
|
|
@@ -68,9 +68,22 @@ export const ProgressContentWrapper = styled.View`
|
|
|
68
68
|
`
|
|
69
69
|
|
|
70
70
|
export const TagsContainer = styled.View`
|
|
71
|
-
|
|
71
|
+
padding-bottom: 10px;
|
|
72
72
|
`
|
|
73
73
|
|
|
74
74
|
export const SortContainer = styled.View`
|
|
75
75
|
margin-bottom: 10px;
|
|
76
76
|
`
|
|
77
|
+
|
|
78
|
+
export const BrandContainer = styled.View``
|
|
79
|
+
|
|
80
|
+
export const BrandItem = styled.TouchableOpacity`
|
|
81
|
+
flex-direction: row;
|
|
82
|
+
justify-content: space-between;
|
|
83
|
+
margin-bottom: 4px;
|
|
84
|
+
align-items: center;
|
|
85
|
+
`
|
|
86
|
+
|
|
87
|
+
export const PriceFilterWrapper = styled.View`
|
|
88
|
+
margin-bottom: 20px;
|
|
89
|
+
`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react'
|
|
1
|
+
import React, { useEffect } from 'react'
|
|
2
2
|
import { useLanguage, BusinessMenuListing } from 'ordering-components/native'
|
|
3
3
|
import { OText } from '../shared'
|
|
4
4
|
import { BusinessMenuListParams } from '../../types'
|
|
@@ -19,7 +19,7 @@ const BusinessMenuListUI = (props: BusinessMenuListParams) => {
|
|
|
19
19
|
|
|
20
20
|
const [, t] = useLanguage()
|
|
21
21
|
const theme = useTheme()
|
|
22
|
-
const {top} = useSafeAreaInsets()
|
|
22
|
+
const { top } = useSafeAreaInsets()
|
|
23
23
|
|
|
24
24
|
const styles = StyleSheet.create({
|
|
25
25
|
container: {
|
|
@@ -36,7 +36,7 @@ const BusinessMenuListUI = (props: BusinessMenuListParams) => {
|
|
|
36
36
|
height: 44,
|
|
37
37
|
width: '100%'
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
})
|
|
40
40
|
|
|
41
41
|
const dropDownIcon = () => {
|
|
42
42
|
return (
|
|
@@ -48,12 +48,18 @@ const BusinessMenuListUI = (props: BusinessMenuListParams) => {
|
|
|
48
48
|
)
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (!businessMenuList?.loading && businessMenuList?.menus?.length === 1){
|
|
53
|
+
setMenu(businessMenuList?.menus[0])
|
|
54
|
+
}
|
|
55
|
+
}, [businessMenuList?.menus])
|
|
56
|
+
|
|
51
57
|
return (
|
|
52
58
|
<>
|
|
53
59
|
{businessMenuList.loading ? (
|
|
54
60
|
<Placeholder Animation={Fade}>
|
|
55
61
|
<View>
|
|
56
|
-
<PlaceholderLine height={44}/>
|
|
62
|
+
<PlaceholderLine height={44} />
|
|
57
63
|
</View>
|
|
58
64
|
</Placeholder>
|
|
59
65
|
) : (
|
|
@@ -67,6 +73,7 @@ const BusinessMenuListUI = (props: BusinessMenuListParams) => {
|
|
|
67
73
|
onSelect={(selectedItem, index) => {
|
|
68
74
|
setMenu(selectedItem)
|
|
69
75
|
}}
|
|
76
|
+
defaultValue={businessMenuList?.menus?.length === 1 && businessMenuList?.menus[0]}
|
|
70
77
|
buttonTextAfterSelection={(selectedItem, index) => {
|
|
71
78
|
return selectedItem.name
|
|
72
79
|
}}
|
|
@@ -51,7 +51,9 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
|
|
|
51
51
|
const [selectDate, setSelectedDate] = useState<any>(null)
|
|
52
52
|
const [datesWhitelist, setDateWhitelist] = useState<any>([{ start: null, end: null }])
|
|
53
53
|
const [isEnabled, setIsEnabled] = useState(false)
|
|
54
|
-
const {top} = useSafeAreaInsets()
|
|
54
|
+
const { top } = useSafeAreaInsets()
|
|
55
|
+
const showOrderTime = (selectedPreorderType === 1 && Object.keys(menu)?.length > 0) || selectedPreorderType === 0
|
|
56
|
+
const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
|
|
55
57
|
const styles = StyleSheet.create({
|
|
56
58
|
container: {
|
|
57
59
|
height: windowHeight,
|
|
@@ -142,7 +144,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
|
|
|
142
144
|
|
|
143
145
|
const validateSelectedDate = (curdate: any, menu: any) => {
|
|
144
146
|
const day = moment(curdate).format('d')
|
|
145
|
-
setIsEnabled(menu?.schedule[day]?.enabled || false)
|
|
147
|
+
setIsEnabled(menu?.schedule?.[day]?.enabled || false)
|
|
146
148
|
}
|
|
147
149
|
|
|
148
150
|
const getTimes = (curdate: any, menu: any) => {
|
|
@@ -300,60 +302,62 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
|
|
|
300
302
|
/>
|
|
301
303
|
</View>
|
|
302
304
|
</BusinessInfoWrapper>
|
|
303
|
-
|
|
304
|
-
<
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
305
|
+
{isPreOrderSetting && (
|
|
306
|
+
<PreorderTypeWrapper>
|
|
307
|
+
<OText
|
|
308
|
+
size={16}
|
|
309
|
+
style={{
|
|
310
|
+
fontWeight: '600',
|
|
311
|
+
lineHeight: 24,
|
|
312
|
+
marginBottom: 12
|
|
313
|
+
}}
|
|
314
|
+
>
|
|
315
|
+
{t('PREORDER_TYPE', 'Preorder type')}
|
|
316
|
+
</OText>
|
|
317
|
+
<SelectDropdown
|
|
318
|
+
defaultValueByIndex={selectedPreorderType}
|
|
319
|
+
data={preorderTypeList}
|
|
320
|
+
// disabled={orderState.loading}
|
|
321
|
+
onSelect={(selectedItem, index) => {
|
|
322
|
+
setSelectedPreorderType(index)
|
|
323
|
+
}}
|
|
324
|
+
buttonTextAfterSelection={(selectedItem, index) => {
|
|
325
|
+
return selectedItem.name
|
|
326
|
+
}}
|
|
327
|
+
rowTextForSelection={(item, index) => {
|
|
328
|
+
return item.name
|
|
329
|
+
}}
|
|
330
|
+
buttonStyle={styles.selectOption}
|
|
331
|
+
buttonTextStyle={{
|
|
332
|
+
color: theme.colors.disabled,
|
|
333
|
+
fontSize: 14,
|
|
334
|
+
textAlign: 'left',
|
|
335
|
+
marginHorizontal: 0
|
|
336
|
+
}}
|
|
337
|
+
dropdownStyle={{
|
|
338
|
+
borderRadius: 8,
|
|
339
|
+
borderColor: theme.colors.lightGray,
|
|
340
|
+
marginTop: Platform.OS === 'ios' ? 12 : -top
|
|
341
|
+
}}
|
|
342
|
+
rowStyle={{
|
|
343
|
+
borderBottomColor: theme.colors.backgroundGray100,
|
|
344
|
+
backgroundColor: theme.colors.backgroundGray100,
|
|
345
|
+
height: 40,
|
|
346
|
+
flexDirection: 'column',
|
|
347
|
+
alignItems: 'flex-start',
|
|
348
|
+
paddingTop: 8,
|
|
349
|
+
paddingHorizontal: 14
|
|
350
|
+
}}
|
|
351
|
+
rowTextStyle={{
|
|
352
|
+
color: theme.colors.disabled,
|
|
353
|
+
fontSize: 14,
|
|
354
|
+
marginHorizontal: 0
|
|
355
|
+
}}
|
|
356
|
+
renderDropdownIcon={() => dropDownIcon()}
|
|
357
|
+
dropdownOverlayColor='transparent'
|
|
358
|
+
/>
|
|
359
|
+
</PreorderTypeWrapper>
|
|
360
|
+
)}
|
|
357
361
|
{selectedPreorderType === 1 && (
|
|
358
362
|
<MenuWrapper>
|
|
359
363
|
<OText
|
|
@@ -373,78 +377,94 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
|
|
|
373
377
|
/>
|
|
374
378
|
</MenuWrapper>
|
|
375
379
|
)}
|
|
376
|
-
|
|
380
|
+
{isPreOrderSetting && showOrderTime && (
|
|
381
|
+
<OrderTimeWrapper>
|
|
382
|
+
<OText
|
|
383
|
+
size={16}
|
|
384
|
+
style={{
|
|
385
|
+
fontWeight: '600',
|
|
386
|
+
lineHeight: 24
|
|
387
|
+
}}
|
|
388
|
+
>
|
|
389
|
+
{t('ORDER_TIME', 'Order time')}
|
|
390
|
+
</OText>
|
|
391
|
+
<View style={{ flex: 1 }}>
|
|
392
|
+
{selectDate && datesWhitelist[0]?.start !== null && (
|
|
393
|
+
<CalendarStrip
|
|
394
|
+
scrollable
|
|
395
|
+
style={styles.calendar}
|
|
396
|
+
calendarHeaderContainerStyle={styles.calendarHeaderContainer}
|
|
397
|
+
calendarHeaderStyle={styles.calendarHeader}
|
|
398
|
+
dateNumberStyle={styles.dateNumber}
|
|
399
|
+
dateNameStyle={styles.dateName}
|
|
400
|
+
iconContainer={{ flex: 0.1 }}
|
|
401
|
+
highlightDateNameStyle={styles.highlightDateName}
|
|
402
|
+
highlightDateNumberStyle={styles.highlightDateNumber}
|
|
403
|
+
dayContainerStyle={{ height: '100%' }}
|
|
404
|
+
highlightDateContainerStyle={{ height: '100%' }}
|
|
405
|
+
calendarHeaderFormat='MMMM, YYYY'
|
|
406
|
+
iconStyle={{ borderWidth: 1 }}
|
|
407
|
+
selectedDate={selectDate}
|
|
408
|
+
datesWhitelist={datesWhitelist}
|
|
409
|
+
disabledDateNameStyle={styles.disabledDateName}
|
|
410
|
+
disabledDateNumberStyle={styles.disabledDateNumber}
|
|
411
|
+
disabledDateOpacity={0.6}
|
|
412
|
+
onDateSelected={(date) => onSelectDate(date)}
|
|
413
|
+
leftSelector={<LeftSelector />}
|
|
414
|
+
rightSelector={<RightSelector />}
|
|
415
|
+
/>
|
|
416
|
+
)}
|
|
417
|
+
</View>
|
|
418
|
+
<TimeListWrapper nestedScrollEnabled={true}>
|
|
419
|
+
{(isEnabled && timeList?.length > 0) ? (
|
|
420
|
+
<TimeContentWrapper>
|
|
421
|
+
{timeList.map((time: any, i: number) => (
|
|
422
|
+
<TouchableOpacity key={i} onPress={() => handleChangeTime(time.value)}>
|
|
423
|
+
<TimeItem active={timeSelected === time.value}>
|
|
424
|
+
<OText
|
|
425
|
+
size={14}
|
|
426
|
+
color={timeSelected === time.value ? theme.colors.primary : theme.colors.textNormal}
|
|
427
|
+
style={{
|
|
428
|
+
lineHeight: 24
|
|
429
|
+
}}
|
|
430
|
+
>{time.text}</OText>
|
|
431
|
+
</TimeItem>
|
|
432
|
+
</TouchableOpacity>
|
|
433
|
+
))}
|
|
434
|
+
{timeList.length % 3 === 2 && (
|
|
435
|
+
<TimeItem style={{ backgroundColor: 'transparent' }} />
|
|
436
|
+
)}
|
|
437
|
+
</TimeContentWrapper>
|
|
438
|
+
) : (
|
|
439
|
+
<OText
|
|
440
|
+
size={16}
|
|
441
|
+
style={{
|
|
442
|
+
fontWeight: '600',
|
|
443
|
+
lineHeight: 24,
|
|
444
|
+
marginBottom: 12,
|
|
445
|
+
textAlign: 'center'
|
|
446
|
+
}}
|
|
447
|
+
>
|
|
448
|
+
{t('ERROR_ADD_PRODUCT_BUSINESS_CLOSED', 'The business is closed at the moment')}
|
|
449
|
+
</OText>
|
|
450
|
+
)}
|
|
451
|
+
</TimeListWrapper>
|
|
452
|
+
</OrderTimeWrapper>
|
|
453
|
+
)}
|
|
454
|
+
{!isPreOrderSetting && (
|
|
377
455
|
<OText
|
|
378
456
|
size={16}
|
|
379
457
|
style={{
|
|
380
458
|
fontWeight: '600',
|
|
381
|
-
lineHeight: 24
|
|
459
|
+
lineHeight: 24,
|
|
460
|
+
marginTop: 30,
|
|
461
|
+
marginBottom: 12,
|
|
462
|
+
textAlign: 'center'
|
|
382
463
|
}}
|
|
383
|
-
|
|
384
|
-
{t('
|
|
464
|
+
>
|
|
465
|
+
{t('ERROR_ADD_PRODUCT_BUSINESS_CLOSED', 'The business is closed at the moment')}
|
|
385
466
|
</OText>
|
|
386
|
-
|
|
387
|
-
{selectDate && datesWhitelist[0]?.start !== null && (
|
|
388
|
-
<CalendarStrip
|
|
389
|
-
scrollable
|
|
390
|
-
style={styles.calendar}
|
|
391
|
-
calendarHeaderContainerStyle={styles.calendarHeaderContainer}
|
|
392
|
-
calendarHeaderStyle={styles.calendarHeader}
|
|
393
|
-
dateNumberStyle={styles.dateNumber}
|
|
394
|
-
dateNameStyle={styles.dateName}
|
|
395
|
-
iconContainer={{ flex: 0.1 }}
|
|
396
|
-
highlightDateNameStyle={styles.highlightDateName}
|
|
397
|
-
highlightDateNumberStyle={styles.highlightDateNumber}
|
|
398
|
-
dayContainerStyle={{ height: '100%' }}
|
|
399
|
-
highlightDateContainerStyle={{ height: '100%' }}
|
|
400
|
-
calendarHeaderFormat='MMMM, YYYY'
|
|
401
|
-
iconStyle={{ borderWidth: 1 }}
|
|
402
|
-
selectedDate={selectDate}
|
|
403
|
-
datesWhitelist={datesWhitelist}
|
|
404
|
-
disabledDateNameStyle={styles.disabledDateName}
|
|
405
|
-
disabledDateNumberStyle={styles.disabledDateNumber}
|
|
406
|
-
disabledDateOpacity={0.6}
|
|
407
|
-
onDateSelected={(date) => onSelectDate(date)}
|
|
408
|
-
leftSelector={<LeftSelector />}
|
|
409
|
-
rightSelector={<RightSelector />}
|
|
410
|
-
/>
|
|
411
|
-
)}
|
|
412
|
-
</View>
|
|
413
|
-
<TimeListWrapper nestedScrollEnabled={true}>
|
|
414
|
-
{(isEnabled && timeList?.length > 0) ? (
|
|
415
|
-
<TimeContentWrapper>
|
|
416
|
-
{timeList.map((time: any, i: number) => (
|
|
417
|
-
<TouchableOpacity key={i} onPress={() => handleChangeTime(time.value)}>
|
|
418
|
-
<TimeItem active={timeSelected === time.value}>
|
|
419
|
-
<OText
|
|
420
|
-
size={14}
|
|
421
|
-
color={timeSelected === time.value ? theme.colors.primary : theme.colors.textNormal}
|
|
422
|
-
style={{
|
|
423
|
-
lineHeight: 24
|
|
424
|
-
}}
|
|
425
|
-
>{time.text}</OText>
|
|
426
|
-
</TimeItem>
|
|
427
|
-
</TouchableOpacity>
|
|
428
|
-
))}
|
|
429
|
-
{timeList.length % 3 === 2 && (
|
|
430
|
-
<TimeItem style={{ backgroundColor: 'transparent' }} />
|
|
431
|
-
)}
|
|
432
|
-
</TimeContentWrapper>
|
|
433
|
-
) : (
|
|
434
|
-
<OText
|
|
435
|
-
size={16}
|
|
436
|
-
style={{
|
|
437
|
-
fontWeight: '600',
|
|
438
|
-
lineHeight: 24,
|
|
439
|
-
marginBottom: 12,
|
|
440
|
-
textAlign: 'center'
|
|
441
|
-
}}
|
|
442
|
-
>
|
|
443
|
-
{t('ERROR_ADD_PRODUCT_BUSINESS_CLOSED', 'The business is closed at the moment')}
|
|
444
|
-
</OText>
|
|
445
|
-
)}
|
|
446
|
-
</TimeListWrapper>
|
|
447
|
-
</OrderTimeWrapper>
|
|
467
|
+
)}
|
|
448
468
|
<OButton
|
|
449
469
|
text={t('GO_TO_MENU', 'Go to menu')}
|
|
450
470
|
textStyle={{ color: 'white' }}
|
|
@@ -44,11 +44,11 @@ const BusinessProductsCategoriesUI = (props: any) => {
|
|
|
44
44
|
borderTopStartRadius: 4,
|
|
45
45
|
borderTopEndRadius: 4,
|
|
46
46
|
backgroundColor: theme.colors.textPrimary,
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
},
|
|
48
|
+
tabDeactived: {
|
|
49
49
|
marginTop: 10,
|
|
50
50
|
height: 4
|
|
51
|
-
|
|
51
|
+
}
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
const handleCategoryScroll = (category: any) => {
|
|
@@ -57,12 +57,12 @@ const BusinessProductsCategoriesUI = (props: any) => {
|
|
|
57
57
|
|
|
58
58
|
if (!lazyLoadProductsRecommended) {
|
|
59
59
|
if (category?.id) {
|
|
60
|
-
scrollViewRef.current.scrollTo({
|
|
60
|
+
scrollViewRef?.current?.scrollTo && scrollViewRef.current.scrollTo({
|
|
61
61
|
y: categoriesLayout[`cat_${category?.id}`]?.y + productListLayout?.y - 70,
|
|
62
62
|
animated: true
|
|
63
63
|
})
|
|
64
64
|
} else {
|
|
65
|
-
scrollViewRef.current.scrollTo({
|
|
65
|
+
scrollViewRef?.current?.scrollTo && scrollViewRef.current.scrollTo({
|
|
66
66
|
y: productListLayout?.y - 70,
|
|
67
67
|
animated: true
|
|
68
68
|
})
|
|
@@ -111,8 +111,10 @@ const BusinessProductsCategoriesUI = (props: any) => {
|
|
|
111
111
|
categories.length &&
|
|
112
112
|
categories.map((category: any) => (
|
|
113
113
|
<Tab
|
|
114
|
-
key={category.
|
|
115
|
-
onPress={() =>
|
|
114
|
+
key={category.id}
|
|
115
|
+
onPress={() => requestAnimationFrame(() => {
|
|
116
|
+
handleCategoryScroll(category)
|
|
117
|
+
})}
|
|
116
118
|
style={[
|
|
117
119
|
category.id === 'featured' && !featured && styles.featuredStyle,
|
|
118
120
|
{
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { OModal, OText, OIcon } from '../../shared'
|
|
3
|
+
import { ScrollView } from 'react-native'
|
|
4
|
+
import { useUtils } from 'ordering-components/native'
|
|
5
|
+
|
|
6
|
+
interface CategoryDescriptionParams {
|
|
7
|
+
openDescription?: {name: string, image: string, description: string} | null,
|
|
8
|
+
setOpenDescription: any;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function categoryDescriptionPropsAreEqual(prev : any, next : any) {
|
|
12
|
+
return prev.openDescription === next.openDescription
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const CategoryDescription = (props : CategoryDescriptionParams) => {
|
|
16
|
+
const [{ optimizeImage }] = useUtils()
|
|
17
|
+
return (
|
|
18
|
+
<OModal
|
|
19
|
+
open={!!props.openDescription}
|
|
20
|
+
onClose={() => props.setOpenDescription(null)}
|
|
21
|
+
styleContainerCloseButton={{
|
|
22
|
+
marginLeft: -30,
|
|
23
|
+
width: 55,
|
|
24
|
+
height: 55,
|
|
25
|
+
marginTop: 2
|
|
26
|
+
}}
|
|
27
|
+
>
|
|
28
|
+
<OText size={20} style={{ paddingLeft: 70, paddingRight: 20, bottom: 25 }}>{props.openDescription?.name}</OText>
|
|
29
|
+
<ScrollView style={{ padding: 20 }}>
|
|
30
|
+
{!!props.openDescription?.image && (
|
|
31
|
+
<OIcon
|
|
32
|
+
url={optimizeImage(props.openDescription?.image, 'h_100,c_limit')}
|
|
33
|
+
width={240}
|
|
34
|
+
height={240}
|
|
35
|
+
style={{ borderRadius: 7.6 }}
|
|
36
|
+
/>
|
|
37
|
+
)}
|
|
38
|
+
<OText mBottom={60}>{props.openDescription?.description}</OText>
|
|
39
|
+
</ScrollView>
|
|
40
|
+
</OModal>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const CategoryDescriptionMemoized = React.memo(CategoryDescription,categoryDescriptionPropsAreEqual)
|