ordering-ui-react-native 0.16.52 → 0.16.53
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 +1 -1
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +197 -142
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +2 -2
- package/themes/original/src/components/BusinessProductsListing/index.tsx +34 -8
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +5 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +238 -94
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +46 -2
- package/themes/original/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/original/src/components/GoogleMap/index.tsx +10 -11
- package/themes/original/src/components/SingleProductCard/index.tsx +113 -103
- package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
- package/themes/original/src/components/shared/OButton.tsx +2 -0
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
3
3
|
import Geolocation from '@react-native-community/geolocation'
|
|
4
|
-
import { IOScrollView } from 'react-native-intersection-observer'
|
|
5
4
|
import { getTrackingStatus, requestTrackingPermission } from 'react-native-tracking-transparency'
|
|
6
5
|
import {
|
|
7
6
|
View,
|
|
@@ -19,6 +18,7 @@ import {
|
|
|
19
18
|
useOrder,
|
|
20
19
|
useConfig,
|
|
21
20
|
useUtils,
|
|
21
|
+
useOrderingTheme
|
|
22
22
|
} from 'ordering-components/native';
|
|
23
23
|
import { useTheme } from 'styled-components/native';
|
|
24
24
|
import Ionicons from 'react-native-vector-icons/Ionicons'
|
|
@@ -33,11 +33,14 @@ import {
|
|
|
33
33
|
FeaturedWrapper,
|
|
34
34
|
OrderProgressWrapper,
|
|
35
35
|
FarAwayMessage,
|
|
36
|
-
AddressInputContainer
|
|
36
|
+
AddressInputContainer,
|
|
37
|
+
PreorderInput,
|
|
38
|
+
OrderTypesContainer,
|
|
39
|
+
BusinessLogosContainer
|
|
37
40
|
} from './styles';
|
|
38
41
|
|
|
39
42
|
import { SearchBar } from '../../../SearchBar';
|
|
40
|
-
import { OIcon, OText } from '../../../shared';
|
|
43
|
+
import { OButton, OIcon, OText, OBottomPopup, OModal } from '../../../shared';
|
|
41
44
|
import { BusinessesListingParams } from '../../../../types';
|
|
42
45
|
import { NotFoundSource } from '../../../NotFoundSource';
|
|
43
46
|
import { BusinessTypeFilter } from '../../../BusinessTypeFilter';
|
|
@@ -49,6 +52,7 @@ import { HighestRatedBusinesses } from '../../../HighestRatedBusinesses';
|
|
|
49
52
|
import { getTypesText, convertToRadian } from '../../../../utils';
|
|
50
53
|
import { OrderProgress } from '../../../OrderProgress';
|
|
51
54
|
import { useFocusEffect, useIsFocused } from '@react-navigation/native';
|
|
55
|
+
import FastImage from 'react-native-fast-image';
|
|
52
56
|
|
|
53
57
|
const PIXELS_TO_SCROLL = 2000;
|
|
54
58
|
|
|
@@ -64,12 +68,19 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
64
68
|
handleChangeSearch,
|
|
65
69
|
businessId,
|
|
66
70
|
isGuestUser,
|
|
67
|
-
handleUpdateBusinessList
|
|
71
|
+
handleUpdateBusinessList,
|
|
72
|
+
citiesState,
|
|
73
|
+
actualSlug,
|
|
74
|
+
logosLayout
|
|
68
75
|
} = props;
|
|
69
76
|
const theme = useTheme();
|
|
77
|
+
const [orderingTheme] = useOrderingTheme()
|
|
70
78
|
const isFocused = useIsFocused();
|
|
71
79
|
const appState = useRef(AppState.currentState)
|
|
80
|
+
const searchBarRef = useRef<any>()
|
|
72
81
|
const [appStateVisible, setAppStateVisible] = useState(appState.current);
|
|
82
|
+
const isChewLayout = theme?.layouts?.header?.components?.layout?.type === 'chew'
|
|
83
|
+
const showCities = !orderingTheme?.theme?.business_listing_view?.components?.cities?.hidden
|
|
73
84
|
const [refreshing] = useState(false);
|
|
74
85
|
const styles = StyleSheet.create({
|
|
75
86
|
container: {
|
|
@@ -114,13 +125,20 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
114
125
|
backgroundColor: theme.colors.white,
|
|
115
126
|
borderColor: theme.colors.backgroundGray,
|
|
116
127
|
borderWidth: 1,
|
|
128
|
+
},
|
|
129
|
+
buttonCityStyle: {
|
|
130
|
+
backgroundColor: theme.colors.white,
|
|
131
|
+
borderColor: theme.colors.backgroundGray,
|
|
132
|
+
borderRadius: 8,
|
|
133
|
+
marginHorizontal: 40,
|
|
134
|
+
height: 45
|
|
117
135
|
}
|
|
118
136
|
});
|
|
119
137
|
|
|
120
138
|
|
|
121
139
|
const [, t] = useLanguage();
|
|
122
140
|
const [{ user, auth }] = useSession();
|
|
123
|
-
const [orderState] = useOrder();
|
|
141
|
+
const [orderState, { changeCityFilter }] = useOrder();
|
|
124
142
|
const [{ configs }] = useConfig();
|
|
125
143
|
const [{ parseDate }] = useUtils();
|
|
126
144
|
|
|
@@ -130,11 +148,13 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
130
148
|
const [isFarAway, setIsFarAway] = useState(false)
|
|
131
149
|
const [businessTypes, setBusinessTypes] = useState(null)
|
|
132
150
|
const [orderTypeValue, setOrderTypeValue] = useState(orderState?.options.value)
|
|
151
|
+
const [isOpenCities, setIsOpenCities] = useState(false)
|
|
133
152
|
const isPreorderEnabled = (configs?.preorder_status_enabled?.value === '1' || configs?.preorder_status_enabled?.value === 'true') &&
|
|
134
153
|
Number(configs?.max_days_preorder?.value) > 0
|
|
135
154
|
const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
|
|
136
155
|
const timerId = useRef<any>(false)
|
|
137
156
|
const [favoriteIds, setFavoriteIds] = useState<any>([])
|
|
157
|
+
const chewOrderTypes = [{ name: t('DELIVERY', 'Delivery').toUpperCase(), value: 1 }, { name: t('PICKUP', 'Pickup').toUpperCase(), value: 2 }]
|
|
138
158
|
|
|
139
159
|
// const panResponder = useRef(
|
|
140
160
|
// PanResponder.create({
|
|
@@ -163,6 +183,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
163
183
|
const hasMore = !(
|
|
164
184
|
paginationProps.totalPages === paginationProps.currentPage
|
|
165
185
|
);
|
|
186
|
+
|
|
166
187
|
if (y + PIXELS_TO_SCROLL > height && !businessesList.loading && hasMore) {
|
|
167
188
|
getBusinesses();
|
|
168
189
|
}
|
|
@@ -180,10 +201,12 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
180
201
|
}
|
|
181
202
|
|
|
182
203
|
const resetInactivityTimeout = () => {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
204
|
+
if(!logosLayout){
|
|
205
|
+
clearTimeout(timerId.current)
|
|
206
|
+
timerId.current = setInterval(() => {
|
|
207
|
+
getBusinesses(true)
|
|
208
|
+
}, 120000)
|
|
209
|
+
}
|
|
187
210
|
}
|
|
188
211
|
|
|
189
212
|
useEffect(() => {
|
|
@@ -224,7 +247,9 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
224
247
|
}
|
|
225
248
|
|
|
226
249
|
useEffect(() => {
|
|
227
|
-
|
|
250
|
+
if(!logosLayout){
|
|
251
|
+
checkUserLocation()
|
|
252
|
+
}
|
|
228
253
|
}, [orderState?.options?.address?.location])
|
|
229
254
|
|
|
230
255
|
useEffect(() => {
|
|
@@ -251,6 +276,44 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
251
276
|
setFavoriteIds([...new Set(ids)])
|
|
252
277
|
}, [businessesList?.businesses?.length])
|
|
253
278
|
|
|
279
|
+
useEffect(() => {
|
|
280
|
+
setIsOpenCities(false)
|
|
281
|
+
}, [orderState?.options?.city_id])
|
|
282
|
+
|
|
283
|
+
if (logosLayout) {
|
|
284
|
+
return (
|
|
285
|
+
<BusinessLogosContainer horizontal>
|
|
286
|
+
{businessesList?.loading ? (
|
|
287
|
+
<Placeholder Animation={Fade}>
|
|
288
|
+
{[...Array(10).keys()].map(item => (
|
|
289
|
+
<PlaceholderLine key={item} width={56} height={56} />
|
|
290
|
+
))}
|
|
291
|
+
</Placeholder>
|
|
292
|
+
) : (
|
|
293
|
+
<>
|
|
294
|
+
{businessesList.businesses
|
|
295
|
+
?.filter(business => business?.slug !== actualSlug && business?.open)
|
|
296
|
+
?.map(business => (
|
|
297
|
+
<TouchableOpacity
|
|
298
|
+
key={business?.id}
|
|
299
|
+
onPress={() => handleBusinessClick && handleBusinessClick(business)}
|
|
300
|
+
>
|
|
301
|
+
<FastImage
|
|
302
|
+
style={{ width: 56, height: 56, marginRight: 20, borderRadius: 7.6 }}
|
|
303
|
+
source={{
|
|
304
|
+
uri: business?.logo,
|
|
305
|
+
priority: FastImage.priority.normal,
|
|
306
|
+
}}
|
|
307
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
308
|
+
/>
|
|
309
|
+
</TouchableOpacity>
|
|
310
|
+
))}
|
|
311
|
+
</>
|
|
312
|
+
)}
|
|
313
|
+
</BusinessLogosContainer>
|
|
314
|
+
)
|
|
315
|
+
}
|
|
316
|
+
|
|
254
317
|
return (
|
|
255
318
|
<ScrollView style={styles.container} onScroll={(e) => handleScroll(e)} showsVerticalScrollIndicator={false}
|
|
256
319
|
refreshControl={
|
|
@@ -260,9 +323,27 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
260
323
|
/>
|
|
261
324
|
}
|
|
262
325
|
>
|
|
263
|
-
<View style={{
|
|
264
|
-
|
|
326
|
+
<View style={{
|
|
327
|
+
height: !isPreOrderSetting && isChewLayout ? 150 : isChewLayout ? 200 : isFarAway ? 150 : 100,
|
|
328
|
+
marginTop: Platform.OS == 'ios' ? 0 : 50,
|
|
329
|
+
backgroundColor: isChewLayout ? theme?.colors?.chew : theme.colors?.white
|
|
330
|
+
}}
|
|
331
|
+
>
|
|
332
|
+
{isChewLayout && (
|
|
333
|
+
<View style={{ marginTop: 30, paddingHorizontal: 30, flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
334
|
+
<OText size={18} weight={700} color={theme.colors?.white}>
|
|
335
|
+
{t('WELCOME', 'Welcome')} {user?.name}!
|
|
336
|
+
</OText>
|
|
337
|
+
<TouchableOpacity
|
|
338
|
+
onPress={() => searchBarRef?.current?.focus?.()}
|
|
339
|
+
>
|
|
340
|
+
<Ionicons name='search' style={{ ...styles.iconStyle, color: theme.colors?.white }} />
|
|
341
|
+
</TouchableOpacity>
|
|
342
|
+
</View>
|
|
343
|
+
)}
|
|
344
|
+
<Search isChewLayout={isChewLayout}>
|
|
265
345
|
<AddressInput
|
|
346
|
+
isChewLayout={isChewLayout}
|
|
266
347
|
onPress={() =>
|
|
267
348
|
auth
|
|
268
349
|
? navigation.navigate('AddressList', { isFromBusinesses: true })
|
|
@@ -272,78 +353,108 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
272
353
|
isGuestUser: isGuestUser
|
|
273
354
|
})
|
|
274
355
|
}>
|
|
275
|
-
<AddressInputContainer>
|
|
356
|
+
<AddressInputContainer isChewLayout={isChewLayout}>
|
|
276
357
|
<OIcon
|
|
277
358
|
src={theme.images.general.pin}
|
|
278
359
|
color={theme.colors.disabled}
|
|
279
360
|
width={16}
|
|
280
|
-
style={{ marginRight: 10 }}
|
|
361
|
+
style={{ marginRight: isChewLayout ? 0 : 10 }}
|
|
281
362
|
/>
|
|
282
|
-
<OText size={12} numberOfLines={1}>
|
|
363
|
+
<OText size={12} numberOfLines={1} style={{ flex: 1 }}>
|
|
283
364
|
{orderState?.options?.address?.address}
|
|
284
365
|
</OText>
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
366
|
+
{!isChewLayout && (
|
|
367
|
+
<OIcon
|
|
368
|
+
src={theme.images.general.arrow_down}
|
|
369
|
+
width={10}
|
|
370
|
+
style={{ marginStart: 8 }}
|
|
371
|
+
/>
|
|
372
|
+
)}
|
|
290
373
|
</AddressInputContainer>
|
|
291
374
|
</AddressInput>
|
|
292
375
|
</Search>
|
|
293
|
-
{isFarAway && (
|
|
376
|
+
{isFarAway && !isChewLayout && (
|
|
294
377
|
<FarAwayMessage style={styles.farAwayMsg}>
|
|
295
378
|
<Ionicons name='md-warning-outline' style={styles.iconStyle} />
|
|
296
379
|
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'You are far from this address')}</OText>
|
|
297
380
|
</FarAwayMessage>
|
|
298
381
|
)}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
382
|
+
{!isChewLayout ? (
|
|
383
|
+
<OrderControlContainer>
|
|
384
|
+
<View style={styles.wrapperOrderOptions}>
|
|
385
|
+
{isPreOrderSetting && (
|
|
386
|
+
<WrapMomentOption
|
|
387
|
+
onPress={() => handleMomentClick()}>
|
|
388
|
+
<OText
|
|
389
|
+
size={12}
|
|
390
|
+
numberOfLines={1}
|
|
391
|
+
ellipsizeMode="tail"
|
|
392
|
+
color={theme.colors.textSecondary}>
|
|
393
|
+
{orderState.options?.moment
|
|
394
|
+
? parseDate(orderState.options?.moment, { outputFormat: configs?.dates_moment_format?.value })
|
|
395
|
+
: t('ASAP_ABBREVIATION', 'ASAP')}
|
|
396
|
+
</OText>
|
|
397
|
+
{isPreorderEnabled && (
|
|
398
|
+
<OIcon
|
|
399
|
+
src={theme.images.general.arrow_down}
|
|
400
|
+
width={10}
|
|
401
|
+
style={{ marginStart: 8 }}
|
|
402
|
+
/>
|
|
403
|
+
)}
|
|
404
|
+
</WrapMomentOption>
|
|
405
|
+
)}
|
|
406
|
+
<WrapMomentOption onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes, setOrderTypeValue })}>
|
|
407
|
+
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textSecondary}>{t(getTypesText(orderTypeValue || orderState?.options?.type || 1), 'Delivery')}</OText>
|
|
408
|
+
<OIcon
|
|
409
|
+
src={theme.images.general.arrow_down}
|
|
410
|
+
width={10}
|
|
411
|
+
style={{ marginStart: 8 }}
|
|
412
|
+
/>
|
|
321
413
|
</WrapMomentOption>
|
|
414
|
+
</View>
|
|
415
|
+
</OrderControlContainer>
|
|
416
|
+
) : (
|
|
417
|
+
<>
|
|
418
|
+
{!isPreOrderSetting && (// cambiar
|
|
419
|
+
<View style={{ paddingHorizontal: 30 }}>
|
|
420
|
+
<PreorderInput
|
|
421
|
+
isChewLayout={isChewLayout}
|
|
422
|
+
onPress={() => handleMomentClick()}
|
|
423
|
+
>
|
|
424
|
+
<OText color={theme.colors.textSecondary}>
|
|
425
|
+
{orderState.options?.moment
|
|
426
|
+
? parseDate(orderState.options?.moment, { outputFormat: configs?.dates_moment_format?.value })
|
|
427
|
+
: t('ASAP_ABBREVIATION', 'ASAP')}</OText>
|
|
428
|
+
</PreorderInput>
|
|
429
|
+
</View>
|
|
322
430
|
)}
|
|
323
|
-
|
|
324
|
-
<OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textSecondary}>{t(getTypesText(orderTypeValue || orderState?.options?.type || 1), 'Delivery')}</OText>
|
|
325
|
-
<OIcon
|
|
326
|
-
src={theme.images.general.arrow_down}
|
|
327
|
-
width={10}
|
|
328
|
-
style={{ marginStart: 8 }}
|
|
329
|
-
/>
|
|
330
|
-
</WrapMomentOption>
|
|
331
|
-
</View>
|
|
332
|
-
</OrderControlContainer>
|
|
333
|
-
</View>
|
|
334
|
-
<HeaderWrapper
|
|
335
|
-
source={theme.images.backgrounds.business_list_header}
|
|
336
|
-
style={{ paddingTop: top + 20 }}
|
|
337
|
-
resizeMode='stretch'
|
|
338
|
-
>
|
|
339
|
-
{!auth && (
|
|
340
|
-
<TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
|
|
341
|
-
<OIcon src={theme.images.general.arrow_left} width={20} style={{ tintColor: theme.colors.white }} />
|
|
342
|
-
</TouchableOpacity>
|
|
431
|
+
</>
|
|
343
432
|
)}
|
|
344
|
-
</
|
|
433
|
+
</View>
|
|
434
|
+
{!isChewLayout ? (
|
|
435
|
+
<HeaderWrapper
|
|
436
|
+
source={theme.images.general.homeHero}
|
|
437
|
+
style={{ paddingTop: top + 20 }}
|
|
438
|
+
resizeMode='stretch'
|
|
439
|
+
>
|
|
440
|
+
{!auth && (
|
|
441
|
+
<TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
|
|
442
|
+
<OIcon src={theme.images.general.arrow_left} width={20} style={{ tintColor: theme.colors.white }} />
|
|
443
|
+
</TouchableOpacity>
|
|
444
|
+
)}
|
|
445
|
+
</HeaderWrapper>
|
|
446
|
+
) : (
|
|
447
|
+
<OrderTypesContainer>
|
|
448
|
+
<OrderTypeSelector
|
|
449
|
+
handleChangeBusinessType={handleChangeBusinessType}
|
|
450
|
+
isChewLayout
|
|
451
|
+
chewOrderTypes={chewOrderTypes}
|
|
452
|
+
/>
|
|
453
|
+
</OrderTypesContainer>
|
|
454
|
+
)}
|
|
345
455
|
{!businessId && (
|
|
346
456
|
<SearchBar
|
|
457
|
+
forwardRef={searchBarRef}
|
|
347
458
|
onSearch={handleChangeSearch}
|
|
348
459
|
searchValue={searchValue}
|
|
349
460
|
lazyLoad
|
|
@@ -352,24 +463,33 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
352
463
|
onCancel={() => handleChangeSearch('')}
|
|
353
464
|
placeholder={t('SEARCH', 'Search')}
|
|
354
465
|
height={50}
|
|
355
|
-
isDisabled={!businessTypes
|
|
466
|
+
isDisabled={!businessTypes}
|
|
356
467
|
inputContainerStyles={styles.inputContainerStyles}
|
|
357
468
|
containerStyles={{
|
|
358
469
|
marginHorizontal: 40,
|
|
359
470
|
marginTop: 20
|
|
360
471
|
}}
|
|
361
472
|
inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? { paddingBottom: 6 } : { paddingBottom: 4 } }}
|
|
362
|
-
onPress={() => { configs?.advanced_business_search_enabled?.value === '1' && navigation.navigate('BusinessSearch', { businessTypes }) }}
|
|
363
473
|
onSubmitEditing={() => { configs?.advanced_business_search_enabled?.value === '1' && navigation.navigate('BusinessSearch', { businessTypes, defaultTerm: searchValue }) }}
|
|
364
474
|
/>
|
|
365
475
|
)}
|
|
476
|
+
|
|
477
|
+
{showCities && (
|
|
478
|
+
<View style={{ marginTop: 10 }}>
|
|
479
|
+
<OButton
|
|
480
|
+
onClick={() => setIsOpenCities(true)}
|
|
481
|
+
text={citiesState?.cities?.find((city : any) => city?.id === orderState?.options?.city_id)?.name || t('FILTER_BY_CITY', 'Filter by city')}
|
|
482
|
+
style={styles?.buttonCityStyle}
|
|
483
|
+
textStyle={{ color: theme.colors.backgroundGray, fontWeight: 'bold', fontSize: 18 }}
|
|
484
|
+
/>
|
|
485
|
+
</View>
|
|
486
|
+
)}
|
|
366
487
|
<OrderProgressWrapper>
|
|
367
488
|
<OrderProgress
|
|
368
489
|
{...props}
|
|
369
490
|
isFocused={isFocused}
|
|
370
491
|
/>
|
|
371
492
|
</OrderProgressWrapper>
|
|
372
|
-
|
|
373
493
|
{
|
|
374
494
|
!businessId && !props.franchiseId && featuredBusiness && featuredBusiness.length > 0 && (
|
|
375
495
|
<FeaturedWrapper>
|
|
@@ -377,7 +497,9 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
377
497
|
<ScrollView
|
|
378
498
|
showsHorizontalScrollIndicator={false}
|
|
379
499
|
nestedScrollEnabled
|
|
380
|
-
horizontal
|
|
500
|
+
horizontal
|
|
501
|
+
contentContainerStyle={{ paddingHorizontal: 40 }}
|
|
502
|
+
>
|
|
381
503
|
{featuredBusiness.map((bAry: any, idx) => (
|
|
382
504
|
<View key={'f-listing_' + idx}>
|
|
383
505
|
<BusinessFeaturedController
|
|
@@ -430,32 +552,29 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
430
552
|
)}
|
|
431
553
|
/>
|
|
432
554
|
)}
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
)
|
|
457
|
-
)}
|
|
458
|
-
</IOScrollView>
|
|
555
|
+
{businessesList.businesses?.map(
|
|
556
|
+
(business: any, i: number) => (
|
|
557
|
+
<BusinessController
|
|
558
|
+
key={`${business.id}_` + i}
|
|
559
|
+
business={business}
|
|
560
|
+
isBusinessOpen={business.open}
|
|
561
|
+
handleCustomClick={handleBusinessClick}
|
|
562
|
+
orderType={orderState?.options?.type}
|
|
563
|
+
navigation={navigation}
|
|
564
|
+
businessHeader={business?.header}
|
|
565
|
+
businessFeatured={business?.featured}
|
|
566
|
+
businessLogo={business?.logo}
|
|
567
|
+
businessReviews={business?.reviews}
|
|
568
|
+
businessDeliveryPrice={business?.delivery_price}
|
|
569
|
+
businessDeliveryTime={business?.delivery_time}
|
|
570
|
+
businessPickupTime={business?.pickup_time}
|
|
571
|
+
businessDistance={business?.distance}
|
|
572
|
+
handleUpdateBusinessList={handleUpdateBusinessList}
|
|
573
|
+
favoriteIds={favoriteIds}
|
|
574
|
+
setFavoriteIds={setFavoriteIds}
|
|
575
|
+
/>
|
|
576
|
+
)
|
|
577
|
+
)}
|
|
459
578
|
{businessesList.loading && (
|
|
460
579
|
<>
|
|
461
580
|
{[
|
|
@@ -508,6 +627,31 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
508
627
|
</>
|
|
509
628
|
)}
|
|
510
629
|
</ListWrapper>
|
|
630
|
+
<OModal
|
|
631
|
+
open={isOpenCities}
|
|
632
|
+
onClose={() => setIsOpenCities(false)}
|
|
633
|
+
title={t('SELECT_A_CITY', 'Select a city')}
|
|
634
|
+
>
|
|
635
|
+
<View style={{ padding: 40, width: '100%' }}>
|
|
636
|
+
{citiesState?.cities?.map((city : any) => (
|
|
637
|
+
<TouchableOpacity
|
|
638
|
+
key={city?.id}
|
|
639
|
+
style={{
|
|
640
|
+
padding: 10,
|
|
641
|
+
borderBottomWidth: 1,
|
|
642
|
+
borderBottomColor: orderState?.options?.city_id === city?.id ? theme.colors.primary : theme.colors.backgroundGray,
|
|
643
|
+
marginBottom: 10,
|
|
644
|
+
}}
|
|
645
|
+
onPress={() => changeCityFilter(city?.id)}
|
|
646
|
+
disabled={orderState?.loading}
|
|
647
|
+
>
|
|
648
|
+
<OText color={orderState?.options?.city_id === city?.id ? theme.colors.primary : theme.colors.black}>
|
|
649
|
+
{city?.name}
|
|
650
|
+
</OText>
|
|
651
|
+
</TouchableOpacity>
|
|
652
|
+
))}
|
|
653
|
+
</View>
|
|
654
|
+
</OModal>
|
|
511
655
|
</ScrollView>
|
|
512
656
|
);
|
|
513
657
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import styled from 'styled-components/native'
|
|
1
|
+
import styled, { css } from 'styled-components/native'
|
|
2
2
|
|
|
3
3
|
export const WelcomeTitle = styled.View`
|
|
4
4
|
flex: 1;
|
|
@@ -16,6 +16,9 @@ export const Search = styled.View`
|
|
|
16
16
|
align-items: center;
|
|
17
17
|
margin-vertical: 10px;
|
|
18
18
|
margin-horizontal: 20px;
|
|
19
|
+
${(props: any) => props.isChewLayout && css`
|
|
20
|
+
margin-horizontal: 30px;
|
|
21
|
+
`}
|
|
19
22
|
`
|
|
20
23
|
|
|
21
24
|
export const AddressInput = styled.TouchableOpacity`
|
|
@@ -27,6 +30,9 @@ export const AddressInput = styled.TouchableOpacity`
|
|
|
27
30
|
width: 100%;
|
|
28
31
|
height: 44px;
|
|
29
32
|
max-height: 44px;
|
|
33
|
+
${(props: any) => props.isChewLayout && css`
|
|
34
|
+
border-radius: 8px;
|
|
35
|
+
`}
|
|
30
36
|
`
|
|
31
37
|
|
|
32
38
|
export const OrderControlContainer = styled.View`
|
|
@@ -89,5 +95,43 @@ export const AddressInputContainer = styled.View`
|
|
|
89
95
|
flex-direction: row;
|
|
90
96
|
width: 100%;
|
|
91
97
|
align-items: center;
|
|
92
|
-
justify-content: center
|
|
98
|
+
justify-content: center;
|
|
99
|
+
${(props: any) => props.isChewLayout && css`
|
|
100
|
+
flex-direction: row-reverse;
|
|
101
|
+
`}
|
|
102
|
+
`
|
|
103
|
+
|
|
104
|
+
export const PreorderInput = styled(AddressInput)`
|
|
105
|
+
justify-content: center;
|
|
106
|
+
`
|
|
107
|
+
|
|
108
|
+
export const OTabs = styled.View`
|
|
109
|
+
flex-direction: row;
|
|
110
|
+
justify-content: space-between;
|
|
111
|
+
align-items: center;
|
|
112
|
+
margin-bottom: -1px;
|
|
113
|
+
width: 100%;
|
|
114
|
+
`;
|
|
115
|
+
|
|
116
|
+
export const OTab = styled.TouchableOpacity`
|
|
117
|
+
padding-bottom: 10px;
|
|
118
|
+
border-bottom-width: 1px;
|
|
119
|
+
margin-end: 14px;
|
|
120
|
+
padding-horizontal: 5px;
|
|
121
|
+
`;
|
|
122
|
+
|
|
123
|
+
export const OrderTypesContainer = styled.View`
|
|
124
|
+
flex-direction: row;
|
|
125
|
+
font-size: 14px;
|
|
126
|
+
width: 180px;
|
|
127
|
+
justify-content: space-between;
|
|
128
|
+
align-items: center;
|
|
129
|
+
border-bottom-width: 1px;
|
|
130
|
+
border-bottom-color: ${(props: any) => props.theme.colors.border};
|
|
131
|
+
margin-top: 10px;
|
|
132
|
+
align-self: center;
|
|
133
|
+
`
|
|
134
|
+
|
|
135
|
+
export const BusinessLogosContainer = styled.ScrollView`
|
|
136
|
+
padding-bottom: 10px;
|
|
93
137
|
`
|
|
@@ -10,8 +10,8 @@ import { ReviewOrderModal, ReviewProductsModal, ReviewDriverModal } from '../Rev
|
|
|
10
10
|
|
|
11
11
|
export const BusinessesListing = (props: any) => {
|
|
12
12
|
const theme = useTheme()
|
|
13
|
+
const layout = theme?.layouts?.business_listing_view?.components?.layout?.type || 'original'
|
|
13
14
|
const [, t] = useLanguage();
|
|
14
|
-
const layout = theme?.layout?.businessListing?.layout?.type || 'original'
|
|
15
15
|
const [{ auth }] = useSession()
|
|
16
16
|
const [, { getLastOrderHasNoReview }] = useOrder();
|
|
17
17
|
|
|
@@ -32,6 +32,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
|
|
|
32
32
|
latitudeDelta: 0.0010,
|
|
33
33
|
longitudeDelta: 0.0010 * ASPECT_RATIO
|
|
34
34
|
})
|
|
35
|
+
const [MARKERS, SETMARKERS] = useState(locations)
|
|
35
36
|
let mapRef = useRef<any>(null)
|
|
36
37
|
const googleMapsApiKey = configState?.configs?.google_maps_api_key?.value
|
|
37
38
|
|
|
@@ -41,12 +42,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
|
|
|
41
42
|
ERROR_NOT_FOUND_ADDRESS: 'Sorry, we couldn\'t find an address',
|
|
42
43
|
ERROR_MAX_LIMIT_LOCATION: `Sorry, You can only set the position to ${maxLimitLocation}m`
|
|
43
44
|
}
|
|
44
|
-
|
|
45
|
-
return {
|
|
46
|
-
latitude: location.lat,
|
|
47
|
-
longitude: location.lng
|
|
48
|
-
}
|
|
49
|
-
})
|
|
45
|
+
|
|
50
46
|
const geocodePosition = (pos: { latitude: number, longitude: number }) => {
|
|
51
47
|
Geocoder.from({
|
|
52
48
|
latitude: pos.latitude,
|
|
@@ -147,7 +143,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
|
|
|
147
143
|
}
|
|
148
144
|
|
|
149
145
|
const fitAllMarkers = () => {
|
|
150
|
-
mapRef.current.fitToCoordinates(MARKERS, {
|
|
146
|
+
mapRef.current.fitToCoordinates(MARKERS?.map(location => ({ latitude: location.lat, longitude: location.lng })), {
|
|
151
147
|
edgePadding: { top: 80, right: 80, bottom: 80, left: 80 },
|
|
152
148
|
animated: true,
|
|
153
149
|
});
|
|
@@ -170,6 +166,9 @@ export const GoogleMap = (props: GoogleMapsParams) => {
|
|
|
170
166
|
fitAllMarkers()
|
|
171
167
|
}
|
|
172
168
|
}, 1000)
|
|
169
|
+
if (locations) {
|
|
170
|
+
SETMARKERS(locations)
|
|
171
|
+
}
|
|
173
172
|
return () => clearInterval(interval)
|
|
174
173
|
}, [locations])
|
|
175
174
|
|
|
@@ -189,16 +188,16 @@ export const GoogleMap = (props: GoogleMapsParams) => {
|
|
|
189
188
|
>
|
|
190
189
|
{locations ? (
|
|
191
190
|
<>
|
|
192
|
-
{MARKERS && MARKERS.map((location: {
|
|
191
|
+
{MARKERS && MARKERS.map((location: { lat: number, lng: number }, i: number) => (
|
|
193
192
|
<React.Fragment key={i}>
|
|
194
193
|
{
|
|
195
194
|
<Marker
|
|
196
195
|
zIndex={i}
|
|
197
|
-
coordinate={location}
|
|
198
|
-
title={
|
|
196
|
+
coordinate={{ latitude: location.lat ?? 0, longitude: location.lng ?? 0 }}
|
|
197
|
+
title={MARKERS[i]?.title}
|
|
199
198
|
>
|
|
200
199
|
<View>
|
|
201
|
-
<OIcon url={
|
|
200
|
+
<OIcon url={MARKERS[i].icon} width={50} height={50} />
|
|
202
201
|
</View>
|
|
203
202
|
</Marker>
|
|
204
203
|
}
|