ordering-ui-react-native 0.12.12 → 0.12.16
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/AddressList/index.tsx +3 -1
- package/src/components/GoogleMap/index.tsx +12 -1
- package/src/components/OrderDetails/index.tsx +3 -4
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +10 -4
- package/themes/business/src/components/MapView/index.tsx +4 -4
- package/themes/business/src/components/NewOrderNotification/index.tsx +20 -6
- package/themes/business/src/components/OrderDetails/Delivery.tsx +5 -4
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +14 -1
- package/themes/business/src/components/OrdersOption/index.tsx +202 -169
- package/themes/business/src/components/PreviousOrders/index.tsx +94 -69
- package/themes/business/src/components/PreviousOrders/styles.tsx +7 -0
- package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -25
- package/themes/business/src/components/shared/OIcon.tsx +2 -0
- package/themes/business/src/types/index.tsx +1 -0
- package/themes/kiosk/src/components/LanguageSelector/index.tsx +78 -58
- package/themes/kiosk/src/components/OrderDetails/index.tsx +3 -1
- package/themes/kiosk/src/components/ProductForm/index.tsx +123 -123
- package/themes/original/src/components/BusinessesListing/index.tsx +9 -6
- package/themes/original/src/components/OrderProgress/index.tsx +32 -18
|
@@ -230,139 +230,139 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
230
230
|
|
|
231
231
|
return (
|
|
232
232
|
<>
|
|
233
|
-
<
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
height:
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
style={{
|
|
272
|
-
flexDirection: 'row',
|
|
273
|
-
alignItems: 'center',
|
|
274
|
-
padding: 20,
|
|
275
|
-
paddingTop: 0,
|
|
276
|
-
paddingBottom: 10
|
|
277
|
-
}}
|
|
278
|
-
>
|
|
279
|
-
<OImage
|
|
280
|
-
source={{uri: product?.images}}
|
|
281
|
-
width={70}
|
|
282
|
-
height={70}
|
|
283
|
-
resizeMode="cover"
|
|
284
|
-
borderRadius={6}
|
|
233
|
+
<ScrollView
|
|
234
|
+
style={styles.mainContainer}
|
|
235
|
+
contentContainerStyle={styles.scrollContainer}
|
|
236
|
+
onScroll={Animated.event(
|
|
237
|
+
[{ nativeEvent: { contentOffset: { y: scrollY }} }],
|
|
238
|
+
{useNativeDriver: false})
|
|
239
|
+
}
|
|
240
|
+
scrollEventThrottle={16}
|
|
241
|
+
>
|
|
242
|
+
<Animated.View style={[styles.header, { height: headerHeight }]}>
|
|
243
|
+
<Animated.View style={{ opacity: navBar1ContainerOpacity }}>
|
|
244
|
+
<NavBar
|
|
245
|
+
{...navBarProps}
|
|
246
|
+
titleColor={theme.colors.white}
|
|
247
|
+
{...((navigation || onClose) && { leftImg: theme.images.general.arrow_left_white })}
|
|
248
|
+
btnStyle={{
|
|
249
|
+
width: 55,
|
|
250
|
+
height: 55,
|
|
251
|
+
backgroundColor: 'black',
|
|
252
|
+
borderRadius: 100,
|
|
253
|
+
opacity: 0.8,
|
|
254
|
+
left: 20,
|
|
255
|
+
}}
|
|
256
|
+
imgLeftStyle={{ width: 27, height: 27 }}
|
|
257
|
+
/>
|
|
258
|
+
</Animated.View>
|
|
259
|
+
<Animated.View style={{ opacity: navBar2ContainerOpacity, position: 'absolute' }}>
|
|
260
|
+
<NavBar
|
|
261
|
+
{...navBarProps}
|
|
262
|
+
{...((navigation || onClose) && { leftImg: theme.images.general.arrow_left })}
|
|
263
|
+
btnStyle={{
|
|
264
|
+
width: 55,
|
|
265
|
+
height: 55,
|
|
266
|
+
backgroundColor: 'transparent',
|
|
267
|
+
borderRadius: 100,
|
|
268
|
+
left: 20,
|
|
269
|
+
}}
|
|
270
|
+
imgLeftStyle={{ width: 27, height: 27 }}
|
|
285
271
|
/>
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
272
|
+
</Animated.View>
|
|
273
|
+
|
|
274
|
+
<Animated.View style={{
|
|
275
|
+
backgroundColor: 'white',
|
|
276
|
+
width: orientationState?.dimensions?.width,
|
|
277
|
+
opacity: collapsedBarContainerOpacity,
|
|
278
|
+
}}>
|
|
279
|
+
<View
|
|
280
|
+
style={{
|
|
281
|
+
flexDirection: 'row',
|
|
282
|
+
alignItems: 'center',
|
|
283
|
+
padding: 20,
|
|
284
|
+
paddingTop: 0,
|
|
285
|
+
paddingBottom: 10
|
|
286
|
+
}}
|
|
291
287
|
>
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
288
|
+
<OImage
|
|
289
|
+
source={{uri: product?.images}}
|
|
290
|
+
width={70}
|
|
291
|
+
height={70}
|
|
292
|
+
resizeMode="cover"
|
|
293
|
+
borderRadius={6}
|
|
294
|
+
/>
|
|
295
|
+
<OText
|
|
296
|
+
size={orientationState?.dimensions?.width * 0.025}
|
|
297
|
+
weight="bold"
|
|
298
|
+
mLeft={20}
|
|
299
|
+
numberOfLines={2}
|
|
300
|
+
>
|
|
301
|
+
{product?.name}
|
|
302
|
+
</OText>
|
|
303
|
+
</View>
|
|
304
|
+
<View
|
|
305
|
+
style={{
|
|
306
|
+
position: 'absolute',
|
|
307
|
+
bottom: -2,
|
|
308
|
+
height: 1,
|
|
309
|
+
backgroundColor: 'white',
|
|
310
|
+
width: orientationState?.dimensions?.width,
|
|
311
|
+
...styles.shadow,
|
|
312
|
+
}}
|
|
313
|
+
/>
|
|
314
|
+
</Animated.View>
|
|
306
315
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
316
|
+
<Animated.View style={{
|
|
317
|
+
opacity: heroContainerOpacity,
|
|
318
|
+
position: 'absolute',
|
|
319
|
+
zIndex: -100,
|
|
320
|
+
transform: [{translateY: heroTranslateY }],
|
|
321
|
+
}}>
|
|
322
|
+
<View
|
|
323
|
+
style={{
|
|
324
|
+
width: orientationState?.dimensions?.width,
|
|
325
|
+
height: HEADER_EXPANDED_HEIGHT,
|
|
326
|
+
position: 'absolute',
|
|
327
|
+
zIndex: 1,
|
|
328
|
+
backgroundColor: 'rgba(24, 28, 50, 0.4)',
|
|
329
|
+
}}
|
|
330
|
+
>
|
|
331
|
+
<ImageBackground source={{ uri: product?.images }} resizeMode='cover' style={{ flex:1, justifyContent: 'center' }} />
|
|
323
332
|
|
|
324
|
-
|
|
333
|
+
</View>
|
|
325
334
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
>
|
|
337
|
-
<OText
|
|
338
|
-
color={theme.colors.white}
|
|
339
|
-
size={orientationState?.dimensions?.width * 0.048}
|
|
340
|
-
weight="bold"
|
|
341
|
-
mBottom={10}
|
|
342
|
-
numberOfLines={2}
|
|
335
|
+
<Animated.View
|
|
336
|
+
style={{
|
|
337
|
+
transform: [{translateY: heroTranslateY }],
|
|
338
|
+
width: orientationState?.dimensions?.width * 0.75,
|
|
339
|
+
height: HEADER_EXPANDED_HEIGHT / 2,
|
|
340
|
+
position: 'relative',
|
|
341
|
+
top: HEADER_EXPANDED_HEIGHT / 3,
|
|
342
|
+
zIndex: 100,
|
|
343
|
+
padding: 20,
|
|
344
|
+
}}
|
|
343
345
|
>
|
|
344
|
-
|
|
345
|
-
|
|
346
|
+
<OText
|
|
347
|
+
color={theme.colors.white}
|
|
348
|
+
size={orientationState?.dimensions?.width * 0.048}
|
|
349
|
+
weight="bold"
|
|
350
|
+
mBottom={10}
|
|
351
|
+
numberOfLines={2}
|
|
352
|
+
>
|
|
353
|
+
{product?.name || productCart?.name}
|
|
354
|
+
</OText>
|
|
346
355
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
356
|
+
<OText
|
|
357
|
+
color={theme.colors.white}
|
|
358
|
+
numberOfLines={4}
|
|
359
|
+
>
|
|
360
|
+
{product?.description || productCart?.description}
|
|
361
|
+
</OText>
|
|
362
|
+
</Animated.View>
|
|
353
363
|
</Animated.View>
|
|
354
364
|
</Animated.View>
|
|
355
|
-
</Animated.View>
|
|
356
365
|
|
|
357
|
-
<ScrollView
|
|
358
|
-
style={styles.mainContainer}
|
|
359
|
-
contentContainerStyle={styles.scrollContainer}
|
|
360
|
-
onScroll={Animated.event(
|
|
361
|
-
[{ nativeEvent: { contentOffset: { y: scrollY }} }],
|
|
362
|
-
{useNativeDriver: false})
|
|
363
|
-
}
|
|
364
|
-
scrollEventThrottle={16}
|
|
365
|
-
>
|
|
366
366
|
{!isFromCheckout && (
|
|
367
367
|
<Spinner visible={loading} />
|
|
368
368
|
)}
|
|
@@ -40,6 +40,7 @@ import { BusinessFeaturedController } from '../BusinessFeaturedController';
|
|
|
40
40
|
import { HighestRatedBusinesses } from '../HighestRatedBusinesses';
|
|
41
41
|
import { getTypesText } from '../../utils';
|
|
42
42
|
import { OrderProgress } from '../OrderProgress';
|
|
43
|
+
import { useIsFocused } from '@react-navigation/native';
|
|
43
44
|
|
|
44
45
|
const PIXELS_TO_SCROLL = 1000;
|
|
45
46
|
|
|
@@ -56,7 +57,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
56
57
|
} = props;
|
|
57
58
|
|
|
58
59
|
const theme = useTheme();
|
|
59
|
-
|
|
60
|
+
const isFocused = useIsFocused();
|
|
60
61
|
|
|
61
62
|
const styles = StyleSheet.create({
|
|
62
63
|
container: {
|
|
@@ -226,11 +227,13 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
226
227
|
</View>
|
|
227
228
|
</OrderControlContainer>
|
|
228
229
|
</HeaderWrapper>
|
|
229
|
-
|
|
230
|
-
<
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
230
|
+
{isFocused && (
|
|
231
|
+
<OrderProgressWrapper>
|
|
232
|
+
<OrderProgress
|
|
233
|
+
{...props}
|
|
234
|
+
/>
|
|
235
|
+
</OrderProgressWrapper>
|
|
236
|
+
)}
|
|
234
237
|
{featuredBusiness && featuredBusiness.length > 0 && (
|
|
235
238
|
<FeaturedWrapper>
|
|
236
239
|
<OText size={16} style={{ marginLeft: 40 }} weight={Platform.OS === 'ios' ? '600' : 'bold'}>{t('FEATURED_BUSINESS', 'Featured business')}</OText>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react'
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
2
|
import {
|
|
3
3
|
OrderList,
|
|
4
4
|
useLanguage,
|
|
@@ -10,7 +10,7 @@ import moment from 'moment';
|
|
|
10
10
|
import { OText } from '../shared'
|
|
11
11
|
import { NotFoundSource } from '../NotFoundSource'
|
|
12
12
|
import { View, StyleSheet, TouchableOpacity } from 'react-native'
|
|
13
|
-
import { Placeholder, Fade } from "rn-placeholder";
|
|
13
|
+
import { Placeholder, Fade, PlaceholderLine } from "rn-placeholder";
|
|
14
14
|
import FastImage from 'react-native-fast-image'
|
|
15
15
|
import {
|
|
16
16
|
ProgressContentWrapper,
|
|
@@ -29,8 +29,8 @@ const OrderProgressUI = (props: any) => {
|
|
|
29
29
|
const theme = useTheme();
|
|
30
30
|
|
|
31
31
|
const [, t] = useLanguage()
|
|
32
|
-
const { loading, error, orders: values } = orderList
|
|
33
32
|
const [{ optimizeImage, parseDate, parseTime }] = useUtils()
|
|
33
|
+
const [lastOrder, setLastOrder] = useState<any>(null)
|
|
34
34
|
const imageFails = theme.images.general.emptyActiveOrders
|
|
35
35
|
|
|
36
36
|
const styles = StyleSheet.create({
|
|
@@ -103,13 +103,14 @@ const OrderProgressUI = (props: any) => {
|
|
|
103
103
|
return objectStatus && objectStatus
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
const convertDiffToHours = (
|
|
106
|
+
const convertDiffToHours = (order: any) => {
|
|
107
|
+
const time = order.delivery_type === 1 ? order?.business?.delivery_time : order?.business?.pickup_time
|
|
107
108
|
const deliveryTime = order?.delivery_datetime_utc
|
|
108
|
-
? parseDate(order?.delivery_datetime_utc, { outputFormat: 'YYYY-MM-DD
|
|
109
|
-
: parseDate(order?.delivery_datetime, { utc: false, outputFormat: 'YYYY-MM-DD
|
|
109
|
+
? parseDate(order?.delivery_datetime_utc, { outputFormat: 'YYYY-MM-DD HH:mm' })
|
|
110
|
+
: parseDate(order?.delivery_datetime, { utc: false, outputFormat: 'YYYY-MM-DD HH:mm' })
|
|
110
111
|
const [hour, minute] = time.split(':')
|
|
111
112
|
const result = time ? (parseInt(hour, 10) * 60) + parseInt(minute, 10) : 0
|
|
112
|
-
const returnedDate = moment(
|
|
113
|
+
const returnedDate = moment(deliveryTime).add(result, 'minutes').format('hh:mm A')
|
|
113
114
|
return returnedDate
|
|
114
115
|
}
|
|
115
116
|
|
|
@@ -117,17 +118,30 @@ const OrderProgressUI = (props: any) => {
|
|
|
117
118
|
navigation && navigation.navigate(index)
|
|
118
119
|
}
|
|
119
120
|
|
|
121
|
+
useEffect(() => {
|
|
122
|
+
if (orderList?.orders.length > 0) {
|
|
123
|
+
const sortedOrders = orderList.orders.sort((a: any, b:any) => a.id > b.id ? -1 : 1)
|
|
124
|
+
setLastOrder(sortedOrders[0])
|
|
125
|
+
}
|
|
126
|
+
}, [orderList?.orders])
|
|
127
|
+
|
|
120
128
|
return (
|
|
121
129
|
<>
|
|
122
|
-
{orderList?.loading &&
|
|
123
|
-
|
|
124
|
-
|
|
130
|
+
{orderList?.loading && (
|
|
131
|
+
<Placeholder Animation={Fade} height={130}>
|
|
132
|
+
<PlaceholderLine height={50} style={{ borderRadius: 8, marginBottom: 10 }} />
|
|
133
|
+
<PlaceholderLine height={15} style={{ marginBottom: 10 }} />
|
|
134
|
+
<PlaceholderLine height={30} style={{ borderRadius: 8, marginBottom: 10 }} />
|
|
135
|
+
</Placeholder>
|
|
136
|
+
)}
|
|
137
|
+
{!orderList?.loading && orderList?.orders?.length > 0 && lastOrder && (
|
|
138
|
+
<View style={styles.main}>
|
|
125
139
|
<OrderInfoWrapper style={{ flex: 1 }}>
|
|
126
140
|
<View style={styles.logoWrapper}>
|
|
127
141
|
<FastImage
|
|
128
142
|
style={{ width: 50, height: 50 }}
|
|
129
143
|
source={{
|
|
130
|
-
uri: optimizeImage(
|
|
144
|
+
uri: optimizeImage(lastOrder?.business?.logo, 'h_50,c_limit'),
|
|
131
145
|
priority: FastImage.priority.normal,
|
|
132
146
|
}}
|
|
133
147
|
resizeMode={FastImage.resizeMode.cover}
|
|
@@ -161,24 +175,24 @@ const OrderProgressUI = (props: any) => {
|
|
|
161
175
|
</OrderInfoWrapper>
|
|
162
176
|
<View style={{ flex: 1 }}>
|
|
163
177
|
<ProgressContentWrapper>
|
|
164
|
-
<ProgressBar style={{ width: getOrderStatus(
|
|
178
|
+
<ProgressBar style={{ width: getOrderStatus(lastOrder.status)?.percentage ? `${getOrderStatus(lastOrder.status)?.percentage}%` : '0%' }} />
|
|
165
179
|
</ProgressContentWrapper>
|
|
166
180
|
<ProgressTextWrapper>
|
|
167
|
-
<OText size={12}>{getOrderStatus(
|
|
181
|
+
<OText size={12}>{getOrderStatus(lastOrder.status)?.value}</OText>
|
|
168
182
|
<TimeWrapper>
|
|
169
183
|
<OText size={11}>{t('ESTIMATED_DELIVERY', 'Estimated delivery')}</OText>
|
|
170
184
|
<OText size={11}>
|
|
171
|
-
{
|
|
172
|
-
? parseTime(
|
|
173
|
-
: parseTime(
|
|
185
|
+
{lastOrder?.delivery_datetime_utc
|
|
186
|
+
? parseTime(lastOrder?.delivery_datetime_utc, { outputFormat: 'hh:mm A' })
|
|
187
|
+
: parseTime(lastOrder?.delivery_datetime, { utc: false })}
|
|
174
188
|
-
|
|
175
|
-
{convertDiffToHours(
|
|
189
|
+
{convertDiffToHours(lastOrder)}
|
|
176
190
|
</OText>
|
|
177
191
|
</TimeWrapper>
|
|
178
192
|
</ProgressTextWrapper>
|
|
179
193
|
</View>
|
|
180
194
|
</View>
|
|
181
|
-
)
|
|
195
|
+
)}
|
|
182
196
|
{!orderList?.loading && orderList?.orders?.length === 0 && (
|
|
183
197
|
<NotFoundSource
|
|
184
198
|
image={imageFails}
|