ordering-ui-react-native 0.21.55-test → 0.21.57-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.
- package/package.json +2 -2
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +12 -0
- package/themes/kiosk/src/components/LoginForm/index.tsx +7 -4
- package/themes/original/src/components/BusinessInformation/index.tsx +0 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +22 -402
- package/themes/original/src/components/Checkout/index.tsx +5 -1
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +1 -1
- package/themes/original/src/components/LastOrder/index.tsx +2 -1
- package/themes/original/src/components/LastOrders/index.tsx +2 -1
- package/themes/original/src/components/MultiCheckout/index.tsx +138 -16
- package/themes/original/src/components/OrderProgress/index.tsx +2 -1
- package/themes/original/src/components/PaymentOptions/index.tsx +3 -1
- package/themes/original/src/components/ProductForm/index.tsx +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ordering-ui-react-native",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.57-test",
|
|
4
4
|
"description": "Reusable components made in react native",
|
|
5
5
|
"main": "src/index.tsx",
|
|
6
6
|
"author": "ordering.inc",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"react-native-signature-canvas": "^4.3.0",
|
|
112
112
|
"react-native-snap-carousel": "^3.9.1",
|
|
113
113
|
"react-native-sound": "^0.11.1",
|
|
114
|
-
"react-native-star-io10": "^1.
|
|
114
|
+
"react-native-star-io10": "^1.1.0",
|
|
115
115
|
"react-native-swipe-gestures": "^1.0.5",
|
|
116
116
|
"react-native-swiper": "^1.6.0",
|
|
117
117
|
"react-native-tracking-transparency": "^0.1.1",
|
|
@@ -295,6 +295,18 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
295
295
|
<OText size={13}>{t(order?.paymethod?.gateway?.toUpperCase(), order?.paymethod?.name)}</OText>
|
|
296
296
|
)}
|
|
297
297
|
</OText>
|
|
298
|
+
{order?.spot_number && (
|
|
299
|
+
<OText size={13}>
|
|
300
|
+
<OText size={13} weight='bold'>
|
|
301
|
+
{`${order?.delivery_type === 3
|
|
302
|
+
? t('EATIN_SPOT_NUMBER', 'Table number')
|
|
303
|
+
: order?.delivery_type === 5
|
|
304
|
+
? t('DRIVE_THRU_SPOT_NUMBER', 'Drive thru lane')
|
|
305
|
+
: t('CURBSIDE_SPOT_NUMBER', 'Spot number')}: `}
|
|
306
|
+
</OText>
|
|
307
|
+
{order.spot_number}
|
|
308
|
+
</OText>
|
|
309
|
+
)}
|
|
298
310
|
</>
|
|
299
311
|
)}
|
|
300
312
|
</OrderHeader>
|
|
@@ -52,7 +52,7 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
52
52
|
} = props;
|
|
53
53
|
|
|
54
54
|
const theme = useTheme()
|
|
55
|
-
const [{ configs }] = useConfig()
|
|
55
|
+
const [{ configs }, { refreshConfigs }] = useConfig()
|
|
56
56
|
const [ordering, { setOrdering }] = useApi();
|
|
57
57
|
const [, { showToast }] = useToast();
|
|
58
58
|
const [, t] = useLanguage();
|
|
@@ -347,13 +347,16 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
347
347
|
project: projectName
|
|
348
348
|
})
|
|
349
349
|
}
|
|
350
|
-
if (isDeviceLoginEnabled) {
|
|
351
|
-
props.handleChangeTab('device_code')
|
|
352
|
-
}
|
|
353
350
|
}, 1500)
|
|
354
351
|
return () => clearTimeout(projectInputTimeout);
|
|
355
352
|
}, [projectName, isDeviceLoginEnabled])
|
|
356
353
|
|
|
354
|
+
useEffect(() => {
|
|
355
|
+
if (ordering?.project) {
|
|
356
|
+
refreshConfigs()
|
|
357
|
+
}
|
|
358
|
+
}, [ordering?.project])
|
|
359
|
+
|
|
357
360
|
const logo = (
|
|
358
361
|
<LogoWrapper>
|
|
359
362
|
<OIcon src={theme.images.logos.logotype} style={styles.logo} />
|
|
@@ -106,7 +106,6 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
|
|
|
106
106
|
location={businessLocation.location}
|
|
107
107
|
markerTitle={businessState?.business?.name}
|
|
108
108
|
businessZones={businessState?.business?.zones}
|
|
109
|
-
delta={30}
|
|
110
109
|
/>
|
|
111
110
|
</WrapBusinessMap>
|
|
112
111
|
)}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { ListWrapper } from './styles'
|
|
3
|
+
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
|
|
4
|
+
import { View } from 'react-native'
|
|
5
|
+
|
|
6
|
+
export const FlatListBusinessListFooter = (props : any) => {
|
|
7
|
+
const {
|
|
8
|
+
businessesList,
|
|
9
|
+
paginationProps,
|
|
10
|
+
isChewLayout
|
|
11
|
+
} = props
|
|
12
|
+
return (
|
|
13
|
+
<>
|
|
14
|
+
<ListWrapper style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}>
|
|
15
|
+
{(businessesList.loading || !businessesList?.fetched) && (
|
|
16
|
+
<>
|
|
17
|
+
{[
|
|
18
|
+
...Array(
|
|
19
|
+
paginationProps.nextPageItems
|
|
20
|
+
? paginationProps.nextPageItems
|
|
21
|
+
: 8,
|
|
22
|
+
).keys(),
|
|
23
|
+
].map((item, i) => (
|
|
24
|
+
<Placeholder
|
|
25
|
+
Animation={Fade}
|
|
26
|
+
key={i}
|
|
27
|
+
style={{ marginBottom: 20 }}>
|
|
28
|
+
<View style={{ width: '100%' }}>
|
|
29
|
+
<PlaceholderLine
|
|
30
|
+
height={200}
|
|
31
|
+
style={{ marginBottom: 20, borderRadius: 25 }}
|
|
32
|
+
/>
|
|
33
|
+
<View style={{ paddingHorizontal: 10 }}>
|
|
34
|
+
<View
|
|
35
|
+
style={{
|
|
36
|
+
flexDirection: 'row',
|
|
37
|
+
justifyContent: 'space-between',
|
|
38
|
+
}}>
|
|
39
|
+
<PlaceholderLine
|
|
40
|
+
height={25}
|
|
41
|
+
width={40}
|
|
42
|
+
style={{ marginBottom: 10 }}
|
|
43
|
+
/>
|
|
44
|
+
<PlaceholderLine
|
|
45
|
+
height={25}
|
|
46
|
+
width={20}
|
|
47
|
+
style={{ marginBottom: 10 }}
|
|
48
|
+
/>
|
|
49
|
+
</View>
|
|
50
|
+
<PlaceholderLine
|
|
51
|
+
height={20}
|
|
52
|
+
width={30}
|
|
53
|
+
style={{ marginBottom: 10 }}
|
|
54
|
+
/>
|
|
55
|
+
<PlaceholderLine
|
|
56
|
+
height={20}
|
|
57
|
+
width={80}
|
|
58
|
+
style={{ marginBottom: 10 }}
|
|
59
|
+
/>
|
|
60
|
+
</View>
|
|
61
|
+
</View>
|
|
62
|
+
</Placeholder>
|
|
63
|
+
))}
|
|
64
|
+
</>
|
|
65
|
+
)}
|
|
66
|
+
</ListWrapper>
|
|
67
|
+
</>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {
|
|
3
|
+
useLanguage,
|
|
4
|
+
useSession,
|
|
5
|
+
useOrder,
|
|
6
|
+
useConfig,
|
|
7
|
+
useUtils
|
|
8
|
+
} from 'ordering-components/native';
|
|
9
|
+
import { Platform, ScrollView, StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
10
|
+
import { OIcon, OModal, OText } from '../../../shared'
|
|
11
|
+
import { useTheme } from 'styled-components/native';
|
|
12
|
+
import { OrderProgress } from '../../../OrderProgress';
|
|
13
|
+
import { useIsFocused } from '@react-navigation/native';
|
|
14
|
+
import {
|
|
15
|
+
Search,
|
|
16
|
+
OrderControlContainer,
|
|
17
|
+
AddressInput,
|
|
18
|
+
WrapMomentOption,
|
|
19
|
+
HeaderWrapper,
|
|
20
|
+
ListWrapper,
|
|
21
|
+
FeaturedWrapper,
|
|
22
|
+
FarAwayMessage,
|
|
23
|
+
AddressInputContainer,
|
|
24
|
+
PreorderInput,
|
|
25
|
+
OrderTypesContainer
|
|
26
|
+
} from './styles';
|
|
27
|
+
import { BusinessFeaturedController } from '../../../BusinessFeaturedController';
|
|
28
|
+
import { HighestRatedBusinesses } from '../../../HighestRatedBusinesses';
|
|
29
|
+
import { PageBanner } from '../../../PageBanner';
|
|
30
|
+
import { NotFoundSource } from '../../../NotFoundSource';
|
|
31
|
+
import { BusinessTypeFilter } from '../../../BusinessTypeFilter';
|
|
32
|
+
import { OrderTypeSelector } from '../../../OrderTypeSelector';
|
|
33
|
+
import { getTypesText } from '../../../../utils';
|
|
34
|
+
|
|
35
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
36
|
+
import Ionicons from 'react-native-vector-icons/Ionicons'
|
|
37
|
+
import { CitiesControl } from '../../../CitiesControl';
|
|
38
|
+
|
|
39
|
+
export const FlatListBusinessListHeader = (props: any) => {
|
|
40
|
+
const {
|
|
41
|
+
navigation,
|
|
42
|
+
businessesList,
|
|
43
|
+
handleChangeBusinessType,
|
|
44
|
+
handleBusinessClick,
|
|
45
|
+
businessId,
|
|
46
|
+
isGuestUser,
|
|
47
|
+
citiesState,
|
|
48
|
+
enabledPoweredByOrdering,
|
|
49
|
+
orderTypeValue,
|
|
50
|
+
setIsOpenCities,
|
|
51
|
+
allCitiesDisabled,
|
|
52
|
+
featuredBusiness,
|
|
53
|
+
favoriteIds,
|
|
54
|
+
setFavoriteIds,
|
|
55
|
+
setOrderTypeValue,
|
|
56
|
+
isFarAway,
|
|
57
|
+
isOpenCities,
|
|
58
|
+
handleChangeCity
|
|
59
|
+
} = props
|
|
60
|
+
|
|
61
|
+
const theme = useTheme()
|
|
62
|
+
const [{ user, auth }] = useSession()
|
|
63
|
+
const [orderState] = useOrder()
|
|
64
|
+
const [{ configs }] = useConfig()
|
|
65
|
+
const isFocused = useIsFocused()
|
|
66
|
+
const [, t] = useLanguage()
|
|
67
|
+
const [{ parseDate }] = useUtils();
|
|
68
|
+
const { top } = useSafeAreaInsets();
|
|
69
|
+
|
|
70
|
+
const hideCities = (theme?.business_listing_view?.components?.cities?.hidden || orderState?.options?.type !== 2 || allCitiesDisabled) ?? true
|
|
71
|
+
const hideHero = theme?.business_listing_view?.components?.business_hero?.hidden
|
|
72
|
+
const hidePreviousOrders = theme?.business_listing_view?.components?.previous_orders_block?.hidden
|
|
73
|
+
const hideHighestBusiness = theme?.business_listing_view?.components?.highest_rated_business_block?.hidden
|
|
74
|
+
const isAllCategoriesHidden = theme?.business_listing_view?.components?.categories?.hidden
|
|
75
|
+
const bgHeader = theme?.business_listing_view?.components?.business_hero?.components?.image
|
|
76
|
+
const bgHeaderHeight = theme?.business_listing_view?.components?.business_hero?.components?.style?.height
|
|
77
|
+
const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
78
|
+
|
|
79
|
+
const chewOrderTypes = [{ name: t('DELIVERY', 'Delivery').toUpperCase(), value: 1 }, { name: t('PICKUP', 'Pickup').toUpperCase(), value: 2 }]
|
|
80
|
+
const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
|
|
81
|
+
const isPreorderEnabled = (configs?.preorder_status_enabled?.value === '1' || configs?.preorder_status_enabled?.value === 'true') &&
|
|
82
|
+
Number(configs?.max_days_preorder?.value) > 0
|
|
83
|
+
const configTypes =
|
|
84
|
+
configs?.order_types_allowed?.value
|
|
85
|
+
.split('|')
|
|
86
|
+
.map((value: any) => Number(value)) || [];
|
|
87
|
+
|
|
88
|
+
const styles = StyleSheet.create({
|
|
89
|
+
container: {
|
|
90
|
+
marginBottom: 0,
|
|
91
|
+
},
|
|
92
|
+
welcome: {
|
|
93
|
+
flex: 1,
|
|
94
|
+
flexDirection: 'row',
|
|
95
|
+
},
|
|
96
|
+
inputStyle: {
|
|
97
|
+
backgroundColor: theme.colors.inputDisabled,
|
|
98
|
+
flex: 1,
|
|
99
|
+
},
|
|
100
|
+
wrapperOrderOptions: {
|
|
101
|
+
width: '100%',
|
|
102
|
+
flexDirection: 'row',
|
|
103
|
+
justifyContent: 'center',
|
|
104
|
+
marginBottom: 10,
|
|
105
|
+
zIndex: 100,
|
|
106
|
+
},
|
|
107
|
+
borderStyle: {
|
|
108
|
+
borderColor: theme.colors.backgroundGray,
|
|
109
|
+
borderWidth: 1,
|
|
110
|
+
borderRadius: 10,
|
|
111
|
+
},
|
|
112
|
+
searchInput: {
|
|
113
|
+
fontSize: 16,
|
|
114
|
+
backgroundColor: theme.colors.white,
|
|
115
|
+
paddingLeft: 10,
|
|
116
|
+
paddingTop: 7
|
|
117
|
+
},
|
|
118
|
+
iconStyle: {
|
|
119
|
+
fontSize: 18,
|
|
120
|
+
color: theme.colors.warning5,
|
|
121
|
+
marginRight: 8
|
|
122
|
+
},
|
|
123
|
+
farAwayMsg: {
|
|
124
|
+
paddingVertical: 6,
|
|
125
|
+
paddingHorizontal: 20
|
|
126
|
+
},
|
|
127
|
+
inputContainerStyles: {
|
|
128
|
+
backgroundColor: theme.colors.white,
|
|
129
|
+
borderColor: theme.colors.backgroundGray,
|
|
130
|
+
borderWidth: 1,
|
|
131
|
+
},
|
|
132
|
+
buttonCityStyle: {
|
|
133
|
+
backgroundColor: theme.colors.white,
|
|
134
|
+
borderColor: theme.colors.backgroundGray,
|
|
135
|
+
borderRadius: 8,
|
|
136
|
+
marginHorizontal: 40,
|
|
137
|
+
minHeight: 45,
|
|
138
|
+
paddingVertical: 5,
|
|
139
|
+
paddingHorizontal: 20,
|
|
140
|
+
borderWidth: 1,
|
|
141
|
+
justifyContent: 'center'
|
|
142
|
+
},
|
|
143
|
+
businessSkeleton: {
|
|
144
|
+
borderRadius: 8,
|
|
145
|
+
marginRight: 20,
|
|
146
|
+
width: 56,
|
|
147
|
+
height: 56
|
|
148
|
+
},
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
const handleMomentClick = () => {
|
|
152
|
+
if (isPreorderEnabled) {
|
|
153
|
+
navigation.navigate('MomentOption')
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return (
|
|
158
|
+
<>
|
|
159
|
+
{enabledPoweredByOrdering && auth && (
|
|
160
|
+
<View style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', top: 20 }}>
|
|
161
|
+
<OText>
|
|
162
|
+
Powered By Ordering.co
|
|
163
|
+
</OText>
|
|
164
|
+
</View>
|
|
165
|
+
)}
|
|
166
|
+
<View style={{
|
|
167
|
+
height: !isPreOrderSetting && isChewLayout ? 150 : isChewLayout ? 200 : isFarAway ? 150 : 100,
|
|
168
|
+
marginTop: isChewLayout ? 0 : Platform.OS == 'ios' ? 0 : 50,
|
|
169
|
+
backgroundColor: isChewLayout ? theme?.colors?.chew : theme.colors?.white
|
|
170
|
+
}}
|
|
171
|
+
>
|
|
172
|
+
{isChewLayout && (
|
|
173
|
+
<View style={{ marginTop: 30, paddingHorizontal: 30, flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
174
|
+
<OText size={24} weight={700} color={theme.colors?.white}>
|
|
175
|
+
{t('WELCOME', 'Welcome')} {user?.name}
|
|
176
|
+
</OText>
|
|
177
|
+
</View>
|
|
178
|
+
)}
|
|
179
|
+
<Search isChewLayout={isChewLayout}>
|
|
180
|
+
<AddressInput
|
|
181
|
+
isChewLayout={isChewLayout}
|
|
182
|
+
onPress={() =>
|
|
183
|
+
auth
|
|
184
|
+
? navigation.navigate('AddressList', { isFromBusinesses: true })
|
|
185
|
+
: navigation.navigate('AddressForm', {
|
|
186
|
+
address: orderState.options?.address,
|
|
187
|
+
isFromBusinesses: true,
|
|
188
|
+
isGuestUser: isGuestUser
|
|
189
|
+
})
|
|
190
|
+
}>
|
|
191
|
+
<AddressInputContainer isChewLayout={isChewLayout}>
|
|
192
|
+
<OIcon
|
|
193
|
+
src={theme.images.general.pin}
|
|
194
|
+
color={theme.colors.disabled}
|
|
195
|
+
width={16}
|
|
196
|
+
style={{ marginRight: isChewLayout ? 0 : 10 }}
|
|
197
|
+
/>
|
|
198
|
+
<OText size={12} numberOfLines={1} style={{ flex: 1 }}>
|
|
199
|
+
{orderState?.options?.address?.address || t('WHAT_IS_YOUR_ADDRESS', 'What\'s your address?')}
|
|
200
|
+
</OText>
|
|
201
|
+
{!isChewLayout && (
|
|
202
|
+
<OIcon
|
|
203
|
+
src={theme.images.general.arrow_down}
|
|
204
|
+
width={10}
|
|
205
|
+
style={{ marginStart: 8 }}
|
|
206
|
+
/>
|
|
207
|
+
)}
|
|
208
|
+
</AddressInputContainer>
|
|
209
|
+
</AddressInput>
|
|
210
|
+
</Search>
|
|
211
|
+
{isFarAway && !isChewLayout && (
|
|
212
|
+
<FarAwayMessage style={styles.farAwayMsg}>
|
|
213
|
+
<Ionicons name='md-warning-outline' style={styles.iconStyle} />
|
|
214
|
+
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'You are far from this address')}</OText>
|
|
215
|
+
</FarAwayMessage>
|
|
216
|
+
)}
|
|
217
|
+
{!isChewLayout ? (
|
|
218
|
+
<OrderControlContainer>
|
|
219
|
+
<View style={styles.wrapperOrderOptions}>
|
|
220
|
+
{isPreOrderSetting && (
|
|
221
|
+
<WrapMomentOption
|
|
222
|
+
onPress={() => handleMomentClick()}>
|
|
223
|
+
<OText
|
|
224
|
+
size={12}
|
|
225
|
+
numberOfLines={1}
|
|
226
|
+
ellipsizeMode="tail"
|
|
227
|
+
color={theme.colors.textSecondary}>
|
|
228
|
+
{orderState.options?.moment
|
|
229
|
+
? parseDate(orderState.options?.moment, { outputFormat: configs?.dates_moment_format?.value })
|
|
230
|
+
: t('ASAP_ABBREVIATION', 'ASAP')}
|
|
231
|
+
</OText>
|
|
232
|
+
{isPreorderEnabled && (
|
|
233
|
+
<OIcon
|
|
234
|
+
src={theme.images.general.arrow_down}
|
|
235
|
+
width={10}
|
|
236
|
+
style={{ marginStart: 8 }}
|
|
237
|
+
/>
|
|
238
|
+
)}
|
|
239
|
+
</WrapMomentOption>
|
|
240
|
+
)}
|
|
241
|
+
<WrapMomentOption onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes, setOrderTypeValue })}>
|
|
242
|
+
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textSecondary}>{t(getTypesText(orderTypeValue || orderState?.options?.type || 1), 'Delivery')}</OText>
|
|
243
|
+
<OIcon
|
|
244
|
+
src={theme.images.general.arrow_down}
|
|
245
|
+
width={10}
|
|
246
|
+
style={{ marginStart: 8 }}
|
|
247
|
+
/>
|
|
248
|
+
</WrapMomentOption>
|
|
249
|
+
</View>
|
|
250
|
+
</OrderControlContainer>
|
|
251
|
+
) : (
|
|
252
|
+
<>
|
|
253
|
+
{isPreOrderSetting && (
|
|
254
|
+
<View style={{ paddingHorizontal: 30 }}>
|
|
255
|
+
<PreorderInput
|
|
256
|
+
isChewLayout={isChewLayout}
|
|
257
|
+
onPress={() => handleMomentClick()}
|
|
258
|
+
>
|
|
259
|
+
<OText color={theme.colors.textSecondary}>
|
|
260
|
+
{orderState.options?.moment
|
|
261
|
+
? parseDate(orderState.options?.moment, { outputFormat: configs?.dates_moment_format?.value })
|
|
262
|
+
: t('ASAP_ABBREVIATION', 'ASAP')}</OText>
|
|
263
|
+
</PreorderInput>
|
|
264
|
+
</View>
|
|
265
|
+
)}
|
|
266
|
+
</>
|
|
267
|
+
)}
|
|
268
|
+
</View>
|
|
269
|
+
{!isChewLayout ? (
|
|
270
|
+
<>
|
|
271
|
+
{!hideHero ? (
|
|
272
|
+
<HeaderWrapper
|
|
273
|
+
source={bgHeader ? { uri: bgHeader } : theme.images.backgrounds.business_list_header}
|
|
274
|
+
style={{ paddingTop: top + 20 }}
|
|
275
|
+
resizeMode='cover'
|
|
276
|
+
bgHeaderHeight={bgHeaderHeight}
|
|
277
|
+
>
|
|
278
|
+
{!auth && (
|
|
279
|
+
<TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
|
|
280
|
+
<OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
|
|
281
|
+
</TouchableOpacity>
|
|
282
|
+
)}
|
|
283
|
+
</HeaderWrapper>
|
|
284
|
+
) : (
|
|
285
|
+
<>
|
|
286
|
+
{!auth && (
|
|
287
|
+
<TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
|
|
288
|
+
<OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
|
|
289
|
+
</TouchableOpacity>
|
|
290
|
+
)}
|
|
291
|
+
</>
|
|
292
|
+
)}
|
|
293
|
+
</>
|
|
294
|
+
) : (
|
|
295
|
+
<OrderTypesContainer>
|
|
296
|
+
<OrderTypeSelector
|
|
297
|
+
handleChangeBusinessType={handleChangeBusinessType}
|
|
298
|
+
isChewLayout
|
|
299
|
+
chewOrderTypes={chewOrderTypes}
|
|
300
|
+
handleChangeType={setOrderTypeValue}
|
|
301
|
+
/>
|
|
302
|
+
</OrderTypesContainer>
|
|
303
|
+
)}
|
|
304
|
+
|
|
305
|
+
{!hideCities && orderTypeValue === 2 && (
|
|
306
|
+
<View style={{ marginTop: 20 }}>
|
|
307
|
+
<TouchableOpacity
|
|
308
|
+
style={styles.buttonCityStyle}
|
|
309
|
+
onPress={() => setIsOpenCities(true)}
|
|
310
|
+
disabled={orderState?.loading}
|
|
311
|
+
>
|
|
312
|
+
<OText size={18} color={theme.colors.backgroundGray} weight='bold' style={{ textAlign: 'center' }}>
|
|
313
|
+
{citiesState?.cities?.find((city: any) => city?.id === orderState?.options?.city_id)?.name || t('FILTER_BY_CITY', 'Filter by city')}
|
|
314
|
+
</OText>
|
|
315
|
+
</TouchableOpacity>
|
|
316
|
+
</View>
|
|
317
|
+
)}
|
|
318
|
+
{!hidePreviousOrders && (
|
|
319
|
+
<OrderProgress
|
|
320
|
+
{...props}
|
|
321
|
+
isFocused={isFocused}
|
|
322
|
+
/>
|
|
323
|
+
)}
|
|
324
|
+
{
|
|
325
|
+
!businessId && !props.franchiseId && featuredBusiness && featuredBusiness.length > 0 && (
|
|
326
|
+
<FeaturedWrapper>
|
|
327
|
+
<OText size={16} style={{ marginLeft: 40 }} weight={Platform.OS === 'ios' ? '600' : 'bold'}>{t('BUSINESS_FEATURE', 'Featured business')}</OText>
|
|
328
|
+
<ScrollView
|
|
329
|
+
showsHorizontalScrollIndicator={false}
|
|
330
|
+
nestedScrollEnabled
|
|
331
|
+
horizontal
|
|
332
|
+
contentContainerStyle={{ paddingHorizontal: 40 }}
|
|
333
|
+
>
|
|
334
|
+
{featuredBusiness.map((bAry: any, idx: number) => (
|
|
335
|
+
<View key={'f-listing_' + idx}>
|
|
336
|
+
<BusinessFeaturedController
|
|
337
|
+
business={bAry[0]}
|
|
338
|
+
isBusinessOpen={bAry[0]?.open}
|
|
339
|
+
handleCustomClick={handleBusinessClick}
|
|
340
|
+
orderType={orderState?.options?.type}
|
|
341
|
+
/>
|
|
342
|
+
{bAry.length > 1 && (
|
|
343
|
+
<BusinessFeaturedController
|
|
344
|
+
business={bAry[1]}
|
|
345
|
+
isBusinessOpen={bAry[1]?.open}
|
|
346
|
+
handleCustomClick={handleBusinessClick}
|
|
347
|
+
orderType={orderState?.options?.type}
|
|
348
|
+
/>
|
|
349
|
+
)}
|
|
350
|
+
</View>
|
|
351
|
+
))}
|
|
352
|
+
</ScrollView>
|
|
353
|
+
</FeaturedWrapper>
|
|
354
|
+
)
|
|
355
|
+
}
|
|
356
|
+
{!isChewLayout && !hideHighestBusiness && (
|
|
357
|
+
<>
|
|
358
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
|
|
359
|
+
{
|
|
360
|
+
!businessId && !props.franchiseId && (
|
|
361
|
+
<HighestRatedBusinesses
|
|
362
|
+
propsToFetch={props.propsToFetch}
|
|
363
|
+
onBusinessClick={handleBusinessClick}
|
|
364
|
+
navigation={navigation}
|
|
365
|
+
favoriteIds={favoriteIds}
|
|
366
|
+
setFavoriteIds={setFavoriteIds}
|
|
367
|
+
/>
|
|
368
|
+
)
|
|
369
|
+
}
|
|
370
|
+
</>
|
|
371
|
+
)}
|
|
372
|
+
<PageBanner position='app_business_listing' navigation={navigation} />
|
|
373
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
|
|
374
|
+
|
|
375
|
+
<ListWrapper style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}>
|
|
376
|
+
{!businessId && !isAllCategoriesHidden && (
|
|
377
|
+
<BusinessTypeFilter
|
|
378
|
+
images={props.images}
|
|
379
|
+
businessTypes={props.businessTypes}
|
|
380
|
+
defaultBusinessType={props.defaultBusinessType}
|
|
381
|
+
handleChangeBusinessType={handleChangeBusinessType}
|
|
382
|
+
/>
|
|
383
|
+
)}
|
|
384
|
+
{!businessesList.loading && businessesList.businesses.length === 0 && businessesList?.fetched && (
|
|
385
|
+
<NotFoundSource
|
|
386
|
+
content={t(
|
|
387
|
+
'NOT_FOUND_BUSINESSES',
|
|
388
|
+
'No businesses to delivery / pick up at this address, please change filters or change address.',
|
|
389
|
+
)}
|
|
390
|
+
/>
|
|
391
|
+
)}
|
|
392
|
+
</ListWrapper>
|
|
393
|
+
<OModal
|
|
394
|
+
open={isOpenCities}
|
|
395
|
+
onClose={() => setIsOpenCities(false)}
|
|
396
|
+
title={t('SELECT_A_CITY', 'Select a city')}
|
|
397
|
+
>
|
|
398
|
+
<CitiesControl
|
|
399
|
+
cities={citiesState?.cities}
|
|
400
|
+
onClose={() => setIsOpenCities(false)}
|
|
401
|
+
handleChangeCity={handleChangeCity}
|
|
402
|
+
/>
|
|
403
|
+
</OModal>
|
|
404
|
+
</>
|
|
405
|
+
)
|
|
406
|
+
}
|
package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import { FlatList, RefreshControl, View } from 'react-native'
|
|
3
|
+
import { FlatListBusinessListHeader } from './FlatListBusinessListHeader'
|
|
4
|
+
import { FlatListBusinessListFooter } from './FlatListBusinessListFooter'
|
|
5
|
+
import { BusinessController } from '../../../BusinessController'
|
|
6
|
+
import {
|
|
7
|
+
useOrder
|
|
8
|
+
} from 'ordering-components/native';
|
|
9
|
+
import { useTheme } from 'styled-components/native'
|
|
10
|
+
|
|
11
|
+
export const FlatListBusinessListing = (props : any) => {
|
|
12
|
+
const {
|
|
13
|
+
handleScroll,
|
|
14
|
+
businessesList,
|
|
15
|
+
handleBusinessClick,
|
|
16
|
+
navigation,
|
|
17
|
+
handleUpdateBusinessList,
|
|
18
|
+
favoriteIds,
|
|
19
|
+
setFavoriteIds,
|
|
20
|
+
handleOnRefresh,
|
|
21
|
+
isChewLayout
|
|
22
|
+
} = props
|
|
23
|
+
|
|
24
|
+
const [orderState] = useOrder()
|
|
25
|
+
const [refreshing] = useState(false);
|
|
26
|
+
const theme = useTheme()
|
|
27
|
+
return (
|
|
28
|
+
<FlatList
|
|
29
|
+
ListHeaderComponent={
|
|
30
|
+
<FlatListBusinessListHeader
|
|
31
|
+
{...props}
|
|
32
|
+
/>
|
|
33
|
+
}
|
|
34
|
+
ListFooterComponent={
|
|
35
|
+
<FlatListBusinessListFooter {...props} />
|
|
36
|
+
}
|
|
37
|
+
onScroll={(e : any) => handleScroll(e)}
|
|
38
|
+
showsVerticalScrollIndicator={false}
|
|
39
|
+
refreshControl={
|
|
40
|
+
<RefreshControl
|
|
41
|
+
refreshing={refreshing}
|
|
42
|
+
onRefresh={() => handleOnRefresh()}
|
|
43
|
+
/>
|
|
44
|
+
}
|
|
45
|
+
data={businessesList.businesses}
|
|
46
|
+
keyExtractor={(business : any) => business?.id}
|
|
47
|
+
renderItem={({ item: business } : any) =>
|
|
48
|
+
<View style={{
|
|
49
|
+
paddingHorizontal: 20,
|
|
50
|
+
backgroundColor: theme.colors.backgroundLight
|
|
51
|
+
}}>
|
|
52
|
+
<BusinessController
|
|
53
|
+
// enableIntersection
|
|
54
|
+
business={business}
|
|
55
|
+
isBusinessOpen={business.open}
|
|
56
|
+
handleCustomClick={handleBusinessClick}
|
|
57
|
+
orderType={orderState?.options?.type}
|
|
58
|
+
navigation={navigation}
|
|
59
|
+
businessHeader={business?.header}
|
|
60
|
+
businessFeatured={business?.featured}
|
|
61
|
+
businessLogo={business?.logo}
|
|
62
|
+
businessReviews={business?.reviews}
|
|
63
|
+
businessDeliveryPrice={business?.delivery_price}
|
|
64
|
+
businessDeliveryTime={business?.delivery_time}
|
|
65
|
+
businessPickupTime={business?.pickup_time}
|
|
66
|
+
businessDistance={business?.distance}
|
|
67
|
+
handleUpdateBusinessList={handleUpdateBusinessList}
|
|
68
|
+
favoriteIds={favoriteIds}
|
|
69
|
+
setFavoriteIds={setFavoriteIds}
|
|
70
|
+
/>
|
|
71
|
+
</View>
|
|
72
|
+
}
|
|
73
|
+
/>
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
|