ordering-ui-react-native 0.16.48 → 0.16.51
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/src/components/BusinessBasicInformation/index.tsx +11 -19
- package/src/components/ReviewDriver/index.tsx +1 -1
- package/src/components/ReviewOrder/index.tsx +2 -2
- package/src/components/ReviewProducts/index.tsx +11 -0
- package/src/components/SingleProductReview/index.tsx +1 -1
- package/themes/original/src/components/BusinessController/index.tsx +126 -110
- package/themes/original/src/components/BusinessListingSearch/index.tsx +26 -2
- package/themes/original/src/components/BusinessProductsList/index.tsx +1 -0
- package/themes/original/src/components/BusinessProductsListing/index.tsx +4 -2
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +47 -42
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +29 -25
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
- package/themes/original/src/components/OrderDetails/index.tsx +54 -5
- package/themes/original/src/components/OrdersOption/index.tsx +10 -3
- package/themes/original/src/components/ProductForm/index.tsx +481 -481
- package/themes/original/src/components/ProductForm/styles.tsx +5 -1
- package/themes/original/src/components/SignupForm/index.tsx +26 -24
- package/themes/original/src/components/SingleOrderCard/index.tsx +89 -96
- package/themes/original/src/components/SingleProductCard/index.tsx +104 -94
- package/themes/original/src/types/index.tsx +7 -5
package/package.json
CHANGED
|
@@ -56,22 +56,14 @@ export const BusinessBasicInformation = (props: BusinessBasicInformationParams)
|
|
|
56
56
|
}
|
|
57
57
|
source={{ uri: header || optimizeImage(businessState?.business?.header, 'h_400,c_limit') }}
|
|
58
58
|
>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
!isBusinessInfoShow && (
|
|
68
|
-
<OIcon
|
|
69
|
-
url={logo || optimizeImage(businessState?.business?.logo, 'h_300,c_limit')}
|
|
70
|
-
style={styles.businessLogo}
|
|
71
|
-
/>
|
|
72
|
-
)
|
|
73
|
-
)}
|
|
74
|
-
</BusinessLogo>
|
|
59
|
+
{!isBusinessInfoShow && (
|
|
60
|
+
<BusinessLogo>
|
|
61
|
+
<OIcon
|
|
62
|
+
url={logo || optimizeImage(businessState?.business?.logo, 'h_300,c_limit')}
|
|
63
|
+
style={styles.businessLogo}
|
|
64
|
+
/>
|
|
65
|
+
</BusinessLogo>
|
|
66
|
+
)}
|
|
75
67
|
</BusinessHeader>
|
|
76
68
|
<BusinessInfo
|
|
77
69
|
style={styles.businessInfo}
|
|
@@ -117,7 +109,7 @@ export const BusinessBasicInformation = (props: BusinessBasicInformationParams)
|
|
|
117
109
|
<PlaceholderLine width={10} />
|
|
118
110
|
</Placeholder>
|
|
119
111
|
) : (
|
|
120
|
-
<View style={{width: '75%'}}>
|
|
112
|
+
<View style={{ width: '75%' }}>
|
|
121
113
|
<OText color={theme.colors.textSecondary}>{getBusinessType()}</OText>
|
|
122
114
|
</View>
|
|
123
115
|
)}
|
|
@@ -187,7 +179,7 @@ export const BusinessBasicInformation = (props: BusinessBasicInformationParams)
|
|
|
187
179
|
titleSectionStyle={styles.modalTitleSectionStyle}
|
|
188
180
|
open={openBusinessInformation}
|
|
189
181
|
onClose={() => setOpenBusinessInformation(false)}
|
|
190
|
-
styleCloseButton={{color: theme.colors.white, backgroundColor: 'rgba(0,0,0,0.3)'}}
|
|
182
|
+
styleCloseButton={{ color: theme.colors.white, backgroundColor: 'rgba(0,0,0,0.3)' }}
|
|
191
183
|
isNotDecoration
|
|
192
184
|
>
|
|
193
185
|
<BusinessInformation
|
|
@@ -199,7 +191,7 @@ export const BusinessBasicInformation = (props: BusinessBasicInformationParams)
|
|
|
199
191
|
titleSectionStyle={styles.modalTitleSectionStyle}
|
|
200
192
|
open={openBusinessReviews}
|
|
201
193
|
onClose={() => setOpenBusinessReviews(false)}
|
|
202
|
-
styleCloseButton={{color: theme.colors.white, backgroundColor: 'rgba(0,0,0,0.3)'}}
|
|
194
|
+
styleCloseButton={{ color: theme.colors.white, backgroundColor: 'rgba(0,0,0,0.3)' }}
|
|
203
195
|
isNotDecoration
|
|
204
196
|
>
|
|
205
197
|
<BusinessReviews
|
|
@@ -218,7 +218,7 @@ const ReviewDriverUI = (props: ReviewDriverParams) => {
|
|
|
218
218
|
<RatingBarContainer>
|
|
219
219
|
<LinearGradient
|
|
220
220
|
start={{ x: 0.0, y: 0.0 }}
|
|
221
|
-
end={{ x: qualificationList[dirverReviews?.qualification - 1]?.percent || 0, y: 0 }}
|
|
221
|
+
end={{ x: qualificationList[dirverReviews?.qualification - 1]?.percent || 0.0001, y: 0 }}
|
|
222
222
|
locations={[.9999, .9999]}
|
|
223
223
|
colors={[theme.colors.primary, theme.colors.lightGray]}
|
|
224
224
|
style={styles.statusBar}
|
|
@@ -106,7 +106,7 @@ export const ReviewOrderUI = (props: ReviewOrderParams) => {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
const qualificationList = [
|
|
109
|
-
{ key: 1, text: t('TERRIBLE', 'Terrible'), percent: 0
|
|
109
|
+
{ key: 1, text: t('TERRIBLE', 'Terrible'), percent: 0, parentStyle: { left: '0%' }, isInnerStyle: false, pointerColor: false },
|
|
110
110
|
{ key: 2, text: t('BAD', 'Bad'), percent: 0.25, parentStyle: { left: '25%' }, isInnerStyle: true, pointerColor: true },
|
|
111
111
|
{ key: 3, text: t('OKAY', 'Okay'), percent: 0.5, parentStyle: { left: '50%' }, isInnerStyle: true, pointerColor: true },
|
|
112
112
|
{ key: 4, text: t('GOOD', 'Good'), percent: 0.75, parentStyle: { left: '75%' }, isInnerStyle: true, pointerColor: true },
|
|
@@ -238,7 +238,7 @@ export const ReviewOrderUI = (props: ReviewOrderParams) => {
|
|
|
238
238
|
<RatingBarContainer>
|
|
239
239
|
<LinearGradient
|
|
240
240
|
start={{ x: 0.0, y: 0.0 }}
|
|
241
|
-
end={{ x: qualificationList[stars.quality - 1]?.percent || 0.
|
|
241
|
+
end={{ x: qualificationList[stars.quality - 1]?.percent || 0.0001, y: 0.0 }}
|
|
242
242
|
locations={[.9999, .9999]}
|
|
243
243
|
colors={[theme.colors.primary, theme.colors.lightGray]}
|
|
244
244
|
style={styles.statusBar}
|
|
@@ -61,6 +61,17 @@ const ReviewProductsUI = (props: ReviewProductParams) => {
|
|
|
61
61
|
}
|
|
62
62
|
}, [formState])
|
|
63
63
|
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
const _changes = order?.products.map(product => {
|
|
66
|
+
return {
|
|
67
|
+
product_id: product?.product_id,
|
|
68
|
+
comment: '',
|
|
69
|
+
qualification: 5
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
handleChangeFormState(_changes)
|
|
73
|
+
}, [])
|
|
74
|
+
|
|
64
75
|
return (
|
|
65
76
|
<>
|
|
66
77
|
<ReviewProductsContainer>
|
|
@@ -69,7 +69,7 @@ export const SingleProductReview = (props: SingleProductReviewParams) => {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
useEffect(() => {
|
|
72
|
-
if (comments?.length === 0 && !extraComment
|
|
72
|
+
if (comments?.length === 0 && !extraComment) return
|
|
73
73
|
let _comments = ''
|
|
74
74
|
if (comments.length > 0) {
|
|
75
75
|
comments.map(comment => (_comments += comment.content + '. '))
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
BusinessController as BusinessSingleCard,
|
|
4
4
|
useUtils,
|
|
5
5
|
useOrder,
|
|
6
6
|
useLanguage,
|
|
7
|
-
useConfig
|
|
7
|
+
useConfig,
|
|
8
|
+
useToast,
|
|
9
|
+
ToastType
|
|
8
10
|
} from 'ordering-components/native';
|
|
9
11
|
import { OIcon, OText } from '../shared';
|
|
10
12
|
import { StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
13
|
+
import { InView } from 'react-native-intersection-observer'
|
|
11
14
|
import { BusinessControllerParams } from '../../types';
|
|
12
15
|
import { convertHoursToMinutes, shape } from '../../utils';
|
|
13
16
|
import {
|
|
@@ -43,13 +46,16 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
43
46
|
businessDeliveryTime,
|
|
44
47
|
businessPickupTime,
|
|
45
48
|
businessDistance,
|
|
46
|
-
handleFavoriteBusiness
|
|
49
|
+
handleFavoriteBusiness,
|
|
50
|
+
enableIntersection
|
|
47
51
|
} = props;
|
|
48
52
|
const [{ parsePrice, parseDistance, parseNumber, optimizeImage }] = useUtils();
|
|
53
|
+
const [, { showToast }] = useToast()
|
|
49
54
|
const [orderState] = useOrder();
|
|
50
55
|
const [configState] = useConfig();
|
|
51
56
|
const [, t] = useLanguage();
|
|
52
57
|
const theme = useTheme()
|
|
58
|
+
const [isIntersectionObserver, setIsIntersectionObserver] = useState(!enableIntersection)
|
|
53
59
|
const styles = StyleSheet.create({
|
|
54
60
|
headerStyle: {
|
|
55
61
|
borderTopLeftRadius: 7.6,
|
|
@@ -119,130 +125,140 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
119
125
|
const handleBusinessClick = (selectedBusiness: any) => {
|
|
120
126
|
if (business?.open) handleClick && handleClick(selectedBusiness)
|
|
121
127
|
else {
|
|
122
|
-
|
|
128
|
+
if (configState?.configs?.preorder_status_enabled?.value === '1') {
|
|
129
|
+
navigation.navigate('BusinessPreorder', { business: selectedBusiness, handleBusinessClick: handleClick })
|
|
130
|
+
return
|
|
131
|
+
}
|
|
132
|
+
showToast(ToastType.Info, t('ERROR_ADD_PRODUCT_BUSINESS_CLOSED', 'The business is closed at the moment'));
|
|
123
133
|
}
|
|
124
134
|
}
|
|
125
135
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
136
|
+
const handleChangeFavorite = () => {
|
|
137
|
+
handleFavoriteBusiness && handleFavoriteBusiness(!business?.favorite)
|
|
138
|
+
}
|
|
129
139
|
|
|
130
140
|
return (
|
|
131
|
-
<
|
|
132
|
-
{
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
<OText
|
|
139
|
-
size={10}
|
|
140
|
-
weight={'400'}
|
|
141
|
-
color={theme.colors.white}
|
|
142
|
-
numberOfLines={2}
|
|
143
|
-
ellipsizeMode='tail'
|
|
144
|
-
lineHeight={13}
|
|
141
|
+
<InView triggerOnce={true} onChange={(inView: boolean) => setIsIntersectionObserver(inView)}>
|
|
142
|
+
<Card activeOpacity={1} onPress={() => handleBusinessClick(business)} style={style}>
|
|
143
|
+
{business?.ribbon?.enabled && (
|
|
144
|
+
<RibbonBox
|
|
145
|
+
bgColor={business?.ribbon?.color}
|
|
146
|
+
isRoundRect={business?.ribbon?.shape === shape?.rectangleRound}
|
|
147
|
+
isCapsule={business?.ribbon?.shape === shape?.capsuleShape}
|
|
145
148
|
>
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
resizeMode={FastImage.resizeMode.cover}
|
|
158
|
-
/>
|
|
159
|
-
{(businessFeatured ?? business?.featured) && (
|
|
160
|
-
<View style={styles.featured}>
|
|
161
|
-
<FontAwesomeIcon name="crown" size={26} color="gold" />
|
|
162
|
-
</View>
|
|
149
|
+
<OText
|
|
150
|
+
size={10}
|
|
151
|
+
weight={'400'}
|
|
152
|
+
color={theme.colors.white}
|
|
153
|
+
numberOfLines={2}
|
|
154
|
+
ellipsizeMode='tail'
|
|
155
|
+
lineHeight={13}
|
|
156
|
+
>
|
|
157
|
+
{business?.ribbon?.text}
|
|
158
|
+
</OText>
|
|
159
|
+
</RibbonBox>
|
|
163
160
|
)}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
<View style={styles.businessStateView}>
|
|
167
|
-
<OText
|
|
168
|
-
color={theme.colors.textThird}
|
|
169
|
-
size={10}
|
|
170
|
-
style={styles.businessStateText}>
|
|
171
|
-
{t('PREORDER', 'PREORDER')}
|
|
172
|
-
</OText>
|
|
173
|
-
</View>
|
|
174
|
-
)}
|
|
175
|
-
</BusinessState>
|
|
176
|
-
</BusinessHero>
|
|
177
|
-
<BusinessContent>
|
|
178
|
-
<BusinessInfo>
|
|
179
|
-
<BusinessLogo style={styles.businessLogo}>
|
|
161
|
+
{isIntersectionObserver && (
|
|
162
|
+
<BusinessHero>
|
|
180
163
|
<FastImage
|
|
181
|
-
style={{
|
|
164
|
+
style={{ height: 120 }}
|
|
182
165
|
source={{
|
|
183
|
-
uri: optimizeImage(
|
|
166
|
+
uri: optimizeImage(businessHeader || business?.header, 'h_500,c_limit'),
|
|
184
167
|
priority: FastImage.priority.normal,
|
|
185
168
|
}}
|
|
186
169
|
resizeMode={FastImage.resizeMode.cover}
|
|
187
170
|
/>
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
<OIcon src={theme.images.general.star} width={12} style={styles.starIcon} />
|
|
193
|
-
<OText size={10} style={{ lineHeight: 15 }}>
|
|
194
|
-
{parseNumber(businessReviews?.reviews?.total ?? business?.reviews?.total, { separator: '.' })}
|
|
195
|
-
</OText>
|
|
196
|
-
</Reviews>
|
|
171
|
+
{(businessFeatured ?? business?.featured) && (
|
|
172
|
+
<View style={styles.featured}>
|
|
173
|
+
<FontAwesomeIcon name="crown" size={26} color="gold" />
|
|
174
|
+
</View>
|
|
197
175
|
)}
|
|
198
|
-
<
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
176
|
+
<BusinessState>
|
|
177
|
+
{!isBusinessOpen && (configState?.configs?.preorder_status_enabled?.value === '1') && (
|
|
178
|
+
<View style={styles.businessStateView}>
|
|
179
|
+
<OText
|
|
180
|
+
color={theme.colors.textThird}
|
|
181
|
+
size={10}
|
|
182
|
+
style={styles.businessStateText}>
|
|
183
|
+
{t('PREORDER', 'PREORDER')}
|
|
184
|
+
</OText>
|
|
185
|
+
</View>
|
|
186
|
+
)}
|
|
187
|
+
</BusinessState>
|
|
188
|
+
</BusinessHero>
|
|
189
|
+
)}
|
|
190
|
+
<BusinessContent>
|
|
191
|
+
<BusinessInfo>
|
|
192
|
+
{isIntersectionObserver && (
|
|
193
|
+
<BusinessLogo style={styles.businessLogo}>
|
|
194
|
+
<FastImage
|
|
195
|
+
style={{ width: 56, height: 56 }}
|
|
196
|
+
source={{
|
|
197
|
+
uri: optimizeImage(businessLogo || business?.logo, 'h_150,c_limit'),
|
|
198
|
+
priority: FastImage.priority.normal,
|
|
199
|
+
}}
|
|
200
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
201
|
+
/>
|
|
202
|
+
</BusinessLogo>
|
|
203
|
+
)}
|
|
204
|
+
<ReviewAndFavorite>
|
|
205
|
+
{(businessReviews?.reviews?.total > 0 ?? business?.reviews?.total > 0) && (
|
|
206
|
+
<Reviews>
|
|
207
|
+
<OIcon src={theme.images.general.star} width={12} style={styles.starIcon} />
|
|
208
|
+
<OText size={10} style={{ lineHeight: 15 }}>
|
|
209
|
+
{parseNumber(businessReviews?.reviews?.total ?? business?.reviews?.total, { separator: '.' })}
|
|
210
|
+
</OText>
|
|
211
|
+
</Reviews>
|
|
212
|
+
)}
|
|
213
|
+
<TouchableOpacity
|
|
214
|
+
onPress={handleChangeFavorite}
|
|
215
|
+
>
|
|
216
|
+
<IconAntDesign
|
|
217
|
+
name={business?.favorite ? 'heart' : 'hearto'}
|
|
218
|
+
color={theme.colors.danger5}
|
|
219
|
+
size={18}
|
|
220
|
+
/>
|
|
221
|
+
</TouchableOpacity>
|
|
222
|
+
</ReviewAndFavorite>
|
|
223
|
+
</BusinessInfo>
|
|
224
|
+
<OText
|
|
225
|
+
size={12}
|
|
226
|
+
style={{ lineHeight: 18, marginBottom: 6 }}
|
|
227
|
+
weight={'500'}>
|
|
228
|
+
{business?.name}
|
|
229
|
+
</OText>
|
|
230
|
+
<OText size={10} style={{ lineHeight: 15, marginBottom: 3 }}>
|
|
231
|
+
{business?.address}
|
|
232
|
+
</OText>
|
|
233
|
+
{/* <BusinessCategory>
|
|
219
234
|
<OText>{getBusinessType()}</OText>
|
|
220
235
|
</BusinessCategory> */}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
</OText>
|
|
227
|
-
</View>
|
|
228
|
-
) : (
|
|
229
|
-
<View style={styles.bullet}>
|
|
230
|
-
{orderState?.options?.type === 1 && (
|
|
231
|
-
<OText size={10} color={theme.colors.textSecondary}>
|
|
232
|
-
{`${t('DELIVERY_FEE', 'Delivery fee')} ${parsePrice(businessDeliveryPrice ?? business?.delivery_price) + ' \u2022 '}`}
|
|
236
|
+
<Metadata>
|
|
237
|
+
{!isBusinessOpen ? (
|
|
238
|
+
<View style={styles.closed}>
|
|
239
|
+
<OText size={10} color={theme.colors.red}>
|
|
240
|
+
{t('CLOSED', 'Closed')}
|
|
233
241
|
</OText>
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
242
|
+
</View>
|
|
243
|
+
) : (
|
|
244
|
+
<View style={styles.bullet}>
|
|
245
|
+
{orderState?.options?.type === 1 && (
|
|
246
|
+
<OText size={10} color={theme.colors.textSecondary}>
|
|
247
|
+
{`${t('DELIVERY_FEE', 'Delivery fee')} ${parsePrice(businessDeliveryPrice ?? business?.delivery_price) + ' \u2022 '}`}
|
|
248
|
+
</OText>
|
|
249
|
+
)}
|
|
250
|
+
<OText size={10} color={theme.colors.textSecondary}>{`${convertHoursToMinutes(
|
|
251
|
+
orderState?.options?.type === 1
|
|
252
|
+
? (businessDeliveryTime ?? business?.delivery_time)
|
|
253
|
+
: (businessPickupTime ?? business?.pickup_time),
|
|
254
|
+
)} \u2022 `}</OText>
|
|
255
|
+
<OText size={10} color={theme.colors.textSecondary}>{parseDistance(businessDistance ?? business?.distance)}</OText>
|
|
256
|
+
</View>
|
|
257
|
+
)}
|
|
258
|
+
</Metadata>
|
|
259
|
+
</BusinessContent>
|
|
260
|
+
</Card>
|
|
261
|
+
</InView>
|
|
246
262
|
);
|
|
247
263
|
};
|
|
248
264
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react'
|
|
2
|
-
import { useLanguage, BusinessSearchList, useOrder, useUtils } from 'ordering-components/native'
|
|
2
|
+
import { useLanguage, BusinessSearchList, useOrder, useUtils, showToast, ToastType } from 'ordering-components/native'
|
|
3
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'
|
|
@@ -183,6 +183,30 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
|
|
|
183
183
|
setOpenFilters(false)
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
+
const isInteger = (val: any) => Number.isInteger(Number(val)) && !!val
|
|
187
|
+
|
|
188
|
+
const onProductClick = (business: any, categoryId: any, productId: any) => {
|
|
189
|
+
if (!isInteger(business?.id) ||
|
|
190
|
+
!isInteger(categoryId) ||
|
|
191
|
+
!isInteger(productId) ||
|
|
192
|
+
!business.slug || !business.header || !business.logo) {
|
|
193
|
+
showToast(ToastType.error, t('NOT_AVAILABLE', 'Not Available'))
|
|
194
|
+
return
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
navigation.navigate('ProductDetails', {
|
|
198
|
+
isRedirect: 'business',
|
|
199
|
+
businessId: business?.id,
|
|
200
|
+
categoryId: categoryId,
|
|
201
|
+
productId: productId,
|
|
202
|
+
business: {
|
|
203
|
+
store: business.slug,
|
|
204
|
+
header: business.header,
|
|
205
|
+
logo: business.logo,
|
|
206
|
+
}
|
|
207
|
+
})
|
|
208
|
+
}
|
|
209
|
+
|
|
186
210
|
useEffect(() => {
|
|
187
211
|
if (filters.business_types?.length === 0 && filters.orderBy === 'default' && Object.keys(filters)?.length === 2 && !openFilters) {
|
|
188
212
|
handleSearchbusinessAndProducts(true)
|
|
@@ -409,7 +433,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
|
|
|
409
433
|
isSoldOut={(product.inventoried && !product.quantity)}
|
|
410
434
|
product={product}
|
|
411
435
|
businessId={business?.id}
|
|
412
|
-
onProductClick={() =>
|
|
436
|
+
onProductClick={(product: any) => onProductClick(business, category?.id, product?.id)}
|
|
413
437
|
productAddedToCartLength={0}
|
|
414
438
|
handleUpdateProducts={(productId: number, changes: any) => handleUpdateProducts(productId, category?.id, business?.id, changes)}
|
|
415
439
|
style={{ width: screenWidth - 80, marginRight: i === category?.products?.length - 1 ? 0 : 20 }}
|
|
@@ -239,6 +239,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
239
239
|
{products.sort((a: any, b: any) => a.rank - b.rank).map((product: any, i: any) => (
|
|
240
240
|
<SingleProductCard
|
|
241
241
|
key={`${product?.id}_${i}`}
|
|
242
|
+
enableIntersection
|
|
242
243
|
isSoldOut={product.inventoried && !product.quantity}
|
|
243
244
|
businessId={businessId}
|
|
244
245
|
product={product}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useRef, useState } from 'react'
|
|
2
2
|
import { View, TouchableOpacity, StyleSheet, SafeAreaView, Dimensions, Platform, KeyboardAvoidingViewBase, KeyboardAvoidingView } from 'react-native'
|
|
3
|
+
import { IOScrollView } from 'react-native-intersection-observer'
|
|
3
4
|
import { useTheme } from 'styled-components/native';
|
|
4
5
|
import {
|
|
5
6
|
BusinessAndProductList,
|
|
@@ -365,7 +366,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
365
366
|
</>
|
|
366
367
|
)}
|
|
367
368
|
{!loading && business?.id && (
|
|
368
|
-
|
|
369
|
+
<IOScrollView rootMargin={{ top: 0, bottom: 0 }}>
|
|
369
370
|
<WrapContent
|
|
370
371
|
onLayout={(event: any) => setProductListLayout(event.nativeEvent.layout)}
|
|
371
372
|
>
|
|
@@ -396,7 +397,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
396
397
|
handleUpdateProducts={handleUpdateProducts}
|
|
397
398
|
/>
|
|
398
399
|
</WrapContent>
|
|
399
|
-
|
|
400
|
+
</IOScrollView>
|
|
400
401
|
)}
|
|
401
402
|
{loading && !error && (
|
|
402
403
|
<>
|
|
@@ -421,6 +422,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
421
422
|
</>
|
|
422
423
|
)}
|
|
423
424
|
</BusinessProductsListingContainer>
|
|
425
|
+
|
|
424
426
|
{!loading && auth && currentCart?.products?.length > 0 && categoryState.products.length !== 0 && (
|
|
425
427
|
<FloatingButton
|
|
426
428
|
btnText={
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
3
|
+
import { IOScrollView } from 'react-native-intersection-observer'
|
|
3
4
|
import Geolocation from '@react-native-community/geolocation'
|
|
4
5
|
import { getTrackingStatus, requestTrackingPermission } from 'react-native-tracking-transparency'
|
|
5
6
|
import {
|
|
@@ -32,7 +33,7 @@ import {
|
|
|
32
33
|
FeaturedWrapper,
|
|
33
34
|
OrderProgressWrapper,
|
|
34
35
|
FarAwayMessage,
|
|
35
|
-
|
|
36
|
+
SearchBarWrapper,
|
|
36
37
|
MomentWrapper,
|
|
37
38
|
FilterWrapper,
|
|
38
39
|
ServiceWrapper,
|
|
@@ -70,8 +71,8 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
70
71
|
isGuestUser,
|
|
71
72
|
handleUpdateBusinessList,
|
|
72
73
|
priceLevelSelected,
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
handleChangePriceLevel,
|
|
75
|
+
businessTypeSelected
|
|
75
76
|
} = props;
|
|
76
77
|
const theme = useTheme();
|
|
77
78
|
const isFocused = useIsFocused();
|
|
@@ -327,22 +328,23 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
327
328
|
/>
|
|
328
329
|
</WrapMomentOption>
|
|
329
330
|
{!businessId && (
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
331
|
+
<SearchBarWrapper>
|
|
332
|
+
<SearchBar
|
|
333
|
+
onSearch={handleChangeSearch}
|
|
334
|
+
searchValue={searchValue}
|
|
335
|
+
lazyLoad
|
|
336
|
+
isCancelXButtonShow={!!searchValue}
|
|
337
|
+
borderStyle={styles.borderStyle}
|
|
338
|
+
onCancel={() => handleChangeSearch('')}
|
|
339
|
+
placeholder={t('SEARCH', 'Search')}
|
|
340
|
+
height={80}
|
|
341
|
+
isAppointment
|
|
342
|
+
isDisabled={!businessTypes || configs?.advanced_business_search_enabled?.value === '1'}
|
|
343
|
+
inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? {} : { paddingBottom: 4 } }}
|
|
344
|
+
onPress={() => { configs?.advanced_business_search_enabled?.value === '1' && navigation.navigate('BusinessSearch', { businessTypes }) }}
|
|
345
|
+
onSubmitEditing={() => { configs?.advanced_business_search_enabled?.value === '1' && navigation.navigate('BusinessSearch', { businessTypes, defaultTerm: searchValue }) }}
|
|
346
|
+
/>
|
|
347
|
+
</SearchBarWrapper>
|
|
346
348
|
)}
|
|
347
349
|
</View>
|
|
348
350
|
</OrderControlContainer>
|
|
@@ -459,29 +461,32 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
459
461
|
)}
|
|
460
462
|
/>
|
|
461
463
|
)}
|
|
462
|
-
|
|
463
|
-
(
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
464
|
+
<IOScrollView>
|
|
465
|
+
{businessesList.businesses?.map(
|
|
466
|
+
(business: any, i: number) => (
|
|
467
|
+
<BusinessController
|
|
468
|
+
key={`${business.id}_` + i}
|
|
469
|
+
enableIntersection
|
|
470
|
+
business={business}
|
|
471
|
+
isBusinessOpen={business.open}
|
|
472
|
+
handleCustomClick={handleBusinessClick}
|
|
473
|
+
orderType={orderState?.options?.type}
|
|
474
|
+
navigation={navigation}
|
|
475
|
+
businessHeader={business?.header}
|
|
476
|
+
businessFeatured={business?.featured}
|
|
477
|
+
businessLogo={business?.logo}
|
|
478
|
+
businessReviews={business?.reviews}
|
|
479
|
+
businessDeliveryPrice={business?.delivery_price}
|
|
480
|
+
businessDeliveryTime={business?.delivery_time}
|
|
481
|
+
businessPickupTime={business?.pickup_time}
|
|
482
|
+
businessDistance={business?.distance}
|
|
483
|
+
handleUpdateBusinessList={handleUpdateBusinessList}
|
|
484
|
+
favoriteIds={favoriteIds}
|
|
485
|
+
setFavoriteIds={setFavoriteIds}
|
|
486
|
+
/>
|
|
487
|
+
)
|
|
488
|
+
)}
|
|
489
|
+
</IOScrollView>
|
|
485
490
|
{businessesList.loading && (
|
|
486
491
|
<>
|
|
487
492
|
{[
|