ordering-ui-react-native 0.14.29 → 0.14.31-release
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/components/BusinessItemAccordion/index.tsx +2 -2
- package/src/components/BusinessProductsListing/index.tsx +10 -26
- package/src/components/Cart/index.tsx +136 -62
- package/src/components/Cart/styles.tsx +7 -0
- package/src/components/Checkout/index.tsx +10 -6
- package/src/components/LogoutButton/index.tsx +14 -0
- package/src/components/OrderDetails/index.tsx +102 -34
- package/src/components/OrderDetails/styles.tsx +7 -0
- package/src/components/OrderSummary/index.tsx +142 -58
- package/src/components/OrderSummary/styles.tsx +10 -2
- package/src/components/ProductForm/index.tsx +72 -27
- package/src/components/ProductForm/styles.tsx +1 -1
- package/src/components/SingleProductCard/index.tsx +1 -1
- package/src/components/TaxInformation/index.tsx +58 -26
- package/src/components/UpsellingProducts/index.tsx +13 -31
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/navigators/HomeNavigator.tsx +6 -0
- package/src/pages/ProductDetails.tsx +55 -0
- package/src/types/index.tsx +2 -0
- package/src/types/react-native-color-matrix-image-filters/index.d.ts +1 -0
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/doordash/src/components/ProductForm/index.tsx +41 -2
- package/themes/doordash/src/components/ProductForm/styles.tsx +1 -1
- package/themes/instacart/src/components/ProductForm/index.tsx +40 -1
- package/themes/instacart/src/components/ProductForm/styles.tsx +1 -1
- package/themes/kiosk/src/components/Cart/index.tsx +14 -21
- package/themes/kiosk/src/components/CartItem/index.tsx +9 -7
- package/themes/kiosk/src/components/CustomerName/index.tsx +2 -1
- package/themes/kiosk/src/components/Intro/index.tsx +4 -4
- package/themes/kiosk/src/components/OptionCard/index.tsx +11 -6
- package/themes/kiosk/src/components/PaymentOptions/index.tsx +46 -44
- package/themes/original/index.tsx +4 -0
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -9
- package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -2
- package/themes/original/src/components/BusinessPreorder/index.tsx +37 -34
- package/themes/original/src/components/BusinessProductsList/index.tsx +3 -3
- package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +35 -0
- package/themes/original/src/components/BusinessProductsListing/index.tsx +16 -47
- package/themes/original/src/components/Cart/index.tsx +10 -31
- package/themes/original/src/components/Checkout/index.tsx +2 -0
- package/themes/original/src/components/Checkout/styles.tsx +1 -0
- package/themes/original/src/components/DriverTips/index.tsx +3 -3
- package/themes/original/src/components/DriverTips/styles.tsx +5 -5
- package/themes/original/src/components/FacebookLogin/index.tsx +20 -5
- package/themes/original/src/components/Help/index.tsx +1 -1
- package/themes/original/src/components/Home/index.tsx +5 -3
- package/themes/original/src/components/LoginForm/index.tsx +50 -49
- package/themes/original/src/components/MessageListing/index.tsx +4 -2
- package/themes/original/src/components/OrderDetails/index.tsx +3 -1
- package/themes/original/src/components/OrderSummary/index.tsx +11 -30
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +10 -6
- package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -0
- package/themes/original/src/components/ProductForm/index.tsx +125 -83
- package/themes/original/src/components/ProductForm/styles.tsx +10 -3
- package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/original/src/components/SingleProductCard/index.tsx +22 -13
- package/themes/original/src/components/SingleProductCard/styles.tsx +6 -0
- package/themes/original/src/components/UpsellingProducts/index.tsx +84 -86
- package/themes/original/src/types/index.tsx +7 -1
- package/themes/uber-eats/src/components/ProductForm/index.tsx +43 -2
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
PaymentOptionWallet as PaymentOptionWalletController,
|
|
8
8
|
useLanguage,
|
|
9
9
|
useUtils,
|
|
10
|
+
useOrder
|
|
10
11
|
} from 'ordering-components/native'
|
|
11
12
|
|
|
12
13
|
import {
|
|
@@ -18,7 +19,7 @@ import { OText } from '../shared'
|
|
|
18
19
|
|
|
19
20
|
const PaymentOptionWalletUI = (props: any) => {
|
|
20
21
|
const {
|
|
21
|
-
|
|
22
|
+
businessId,
|
|
22
23
|
walletsState,
|
|
23
24
|
selectWallet,
|
|
24
25
|
deletetWalletSelected
|
|
@@ -26,8 +27,11 @@ const PaymentOptionWalletUI = (props: any) => {
|
|
|
26
27
|
|
|
27
28
|
const theme = useTheme()
|
|
28
29
|
const [, t] = useLanguage()
|
|
30
|
+
const [{ carts }] = useOrder()
|
|
29
31
|
const [{ parsePrice }] = useUtils()
|
|
30
32
|
|
|
33
|
+
const cart = carts?.[`businessId:${businessId}`] ?? {}
|
|
34
|
+
|
|
31
35
|
const styles = StyleSheet.create({
|
|
32
36
|
checkBoxStyle: {
|
|
33
37
|
width: 25,
|
|
@@ -65,10 +69,10 @@ const PaymentOptionWalletUI = (props: any) => {
|
|
|
65
69
|
};
|
|
66
70
|
|
|
67
71
|
useEffect(() => {
|
|
68
|
-
if (!walletsState.loading) {
|
|
72
|
+
if (!walletsState.loading && walletsState.result?.length) {
|
|
69
73
|
setCheckedState(
|
|
70
|
-
walletsState.result
|
|
71
|
-
return !!cart?.
|
|
74
|
+
walletsState.result?.map((wallet: any) => {
|
|
75
|
+
return !!cart?.payment_events?.find((w: any) => w.wallet_id === wallet.id)
|
|
72
76
|
})
|
|
73
77
|
)
|
|
74
78
|
}
|
|
@@ -101,7 +105,7 @@ const PaymentOptionWalletUI = (props: any) => {
|
|
|
101
105
|
onTintColor={theme.colors.primary}
|
|
102
106
|
style={Platform.OS === 'ios' && styles.checkBoxStyle}
|
|
103
107
|
/>
|
|
104
|
-
<View style={{ alignItems: 'baseline' }}>
|
|
108
|
+
<View style={{ alignItems: 'baseline', marginLeft: 5 }}>
|
|
105
109
|
<View>
|
|
106
110
|
<OText
|
|
107
111
|
style={((cart?.balance === 0 && !checkedState[idx]) || wallet.balance === 0) ?{
|
|
@@ -114,7 +118,7 @@ const PaymentOptionWalletUI = (props: any) => {
|
|
|
114
118
|
</View>
|
|
115
119
|
</SectionLeft>
|
|
116
120
|
|
|
117
|
-
<View style={{maxWidth: '
|
|
121
|
+
<View style={{maxWidth: '35%', alignItems: 'flex-end' }}>
|
|
118
122
|
{wallet.type === 'cash' && (
|
|
119
123
|
<OText>
|
|
120
124
|
{parsePrice(wallet?.balance)}
|
|
@@ -16,10 +16,9 @@ import {
|
|
|
16
16
|
Grayscale
|
|
17
17
|
} from 'react-native-color-matrix-image-filters'
|
|
18
18
|
|
|
19
|
-
import { View, TouchableOpacity, StyleSheet, Dimensions,
|
|
19
|
+
import { View, TouchableOpacity, StyleSheet, Dimensions, I18nManager, SafeAreaView } from 'react-native';
|
|
20
20
|
|
|
21
21
|
import {
|
|
22
|
-
ProductHeader,
|
|
23
22
|
WrapHeader,
|
|
24
23
|
TopHeader,
|
|
25
24
|
WrapContent,
|
|
@@ -33,16 +32,15 @@ import {
|
|
|
33
32
|
ProductActions,
|
|
34
33
|
ExtraOptionWrap,
|
|
35
34
|
WeightUnitSwitch,
|
|
36
|
-
WeightUnitItem
|
|
35
|
+
WeightUnitItem,
|
|
36
|
+
TopActions
|
|
37
37
|
} from './styles';
|
|
38
38
|
import { OButton, OIcon, OInput, OText } from '../shared';
|
|
39
39
|
import { ScrollView } from 'react-native-gesture-handler';
|
|
40
40
|
import { ProductOptionSubOption } from '../ProductOptionSubOption';
|
|
41
41
|
import { NotFoundSource } from '../NotFoundSource';
|
|
42
42
|
import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
|
|
43
|
-
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
44
43
|
import { useState } from 'react';
|
|
45
|
-
import { useWindowDimensions } from 'react-native';
|
|
46
44
|
|
|
47
45
|
const windowHeight = Dimensions.get('window').height;
|
|
48
46
|
const windowWidth = Dimensions.get('window').width;
|
|
@@ -63,8 +61,6 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
63
61
|
handleChangeSuboptionState,
|
|
64
62
|
handleChangeCommentState,
|
|
65
63
|
productObject,
|
|
66
|
-
onClose,
|
|
67
|
-
isFromCheckout,
|
|
68
64
|
} = props;
|
|
69
65
|
|
|
70
66
|
const theme = useTheme();
|
|
@@ -97,7 +93,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
97
93
|
},
|
|
98
94
|
btnBackArrow: {
|
|
99
95
|
borderWidth: 0,
|
|
100
|
-
backgroundColor: '
|
|
96
|
+
backgroundColor: '#FFF',
|
|
101
97
|
borderRadius: 24,
|
|
102
98
|
marginRight: 15,
|
|
103
99
|
},
|
|
@@ -135,6 +131,20 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
135
131
|
},
|
|
136
132
|
unitItem: {
|
|
137
133
|
fontSize: 12
|
|
134
|
+
},
|
|
135
|
+
productTagWrapper: {
|
|
136
|
+
flexDirection: 'row',
|
|
137
|
+
alignItems: 'center'
|
|
138
|
+
},
|
|
139
|
+
productTagImageStyle: {
|
|
140
|
+
width: 32,
|
|
141
|
+
height: 32,
|
|
142
|
+
borderRadius: 8,
|
|
143
|
+
resizeMode: 'cover'
|
|
144
|
+
},
|
|
145
|
+
productTagNameStyle: {
|
|
146
|
+
paddingHorizontal: 6,
|
|
147
|
+
marginRight: 5
|
|
138
148
|
}
|
|
139
149
|
});
|
|
140
150
|
|
|
@@ -146,15 +156,13 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
146
156
|
const [gallery, setGallery] = useState([])
|
|
147
157
|
const [thumbsSwiper, setThumbsSwiper] = useState(0)
|
|
148
158
|
|
|
149
|
-
const { top, bottom } = useSafeAreaInsets();
|
|
150
|
-
const { height } = useWindowDimensions();
|
|
151
159
|
const [selOpt, setSelectedOpt] = useState(0);
|
|
152
160
|
const [isHaveWeight, setIsHaveWeight] = useState(false)
|
|
153
161
|
const [qtyBy, setQtyBy] = useState({
|
|
154
162
|
weight_unit: false,
|
|
155
163
|
pieces: true
|
|
156
164
|
})
|
|
157
|
-
const [pricePerWeightUnit, setPricePerWeightUnit] = useState(null)
|
|
165
|
+
const [pricePerWeightUnit, setPricePerWeightUnit] = useState<any>(null)
|
|
158
166
|
|
|
159
167
|
const swiperRef: any = useRef(null)
|
|
160
168
|
|
|
@@ -173,10 +181,8 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
173
181
|
};
|
|
174
182
|
|
|
175
183
|
const handleSaveProduct = () => {
|
|
176
|
-
console.log('----- click handle ------')
|
|
177
184
|
const isErrors = Object.values(errors).length > 0;
|
|
178
185
|
if (!isErrors) {
|
|
179
|
-
console.log('----- save handle ------')
|
|
180
186
|
handleSave && handleSave();
|
|
181
187
|
return;
|
|
182
188
|
}
|
|
@@ -206,7 +212,6 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
206
212
|
}
|
|
207
213
|
|
|
208
214
|
const handleRedirectLogin = () => {
|
|
209
|
-
onClose();
|
|
210
215
|
navigation.navigate('Login');
|
|
211
216
|
};
|
|
212
217
|
|
|
@@ -284,14 +289,16 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
284
289
|
</>
|
|
285
290
|
);
|
|
286
291
|
|
|
292
|
+
const handleGoBack = navigation?.canGoBack()
|
|
293
|
+
? () => navigation.goBack()
|
|
294
|
+
: () => navigation.navigate('Business', { store: props.businessSlug })
|
|
295
|
+
|
|
287
296
|
return (
|
|
288
|
-
|
|
297
|
+
<SafeAreaView style={{ flex: 1 }}>
|
|
289
298
|
<TopHeader>
|
|
290
|
-
<
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
<OIcon src={theme.images.general.close} width={16} />
|
|
294
|
-
</TouchableOpacity>
|
|
299
|
+
<TopActions onPress={() => handleGoBack()}>
|
|
300
|
+
<OIcon src={theme.images.general.arrow_left} width={15} />
|
|
301
|
+
</TopActions>
|
|
295
302
|
</TopHeader>
|
|
296
303
|
<ScrollView>
|
|
297
304
|
{!error && (
|
|
@@ -342,15 +349,13 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
342
349
|
style={styles.slide1}
|
|
343
350
|
key={i}
|
|
344
351
|
>
|
|
345
|
-
<
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
/>
|
|
353
|
-
</Grayscale>
|
|
352
|
+
<FastImage
|
|
353
|
+
style={{ height: '100%', opacity: isSoldOut ? 0.5 : 1 }}
|
|
354
|
+
source={{
|
|
355
|
+
uri: optimizeImage(img, 'h_258,c_limit'),
|
|
356
|
+
priority: FastImage.priority.normal,
|
|
357
|
+
}}
|
|
358
|
+
/>
|
|
354
359
|
</View>
|
|
355
360
|
))}
|
|
356
361
|
</Swiper>
|
|
@@ -374,19 +379,18 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
374
379
|
opacity: index === thumbsSwiper ? 1 : 0.8
|
|
375
380
|
}}
|
|
376
381
|
>
|
|
377
|
-
<
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
</Grayscale>
|
|
382
|
+
<OIcon
|
|
383
|
+
url={img}
|
|
384
|
+
style={{
|
|
385
|
+
borderColor: theme.colors.lightGray,
|
|
386
|
+
borderRadius: 8,
|
|
387
|
+
minHeight: '100%',
|
|
388
|
+
opacity: isSoldOut ? 0.5 : 1
|
|
389
|
+
}}
|
|
390
|
+
width={56}
|
|
391
|
+
height={56}
|
|
392
|
+
cover
|
|
393
|
+
/>
|
|
390
394
|
</View>
|
|
391
395
|
</TouchableOpacity>
|
|
392
396
|
|
|
@@ -410,14 +414,20 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
410
414
|
</Placeholder>
|
|
411
415
|
) : (
|
|
412
416
|
<>
|
|
413
|
-
<
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
417
|
+
<View style={{ flexDirection: 'row' }}>
|
|
418
|
+
<OText
|
|
419
|
+
size={20}
|
|
420
|
+
lineHeight={30}
|
|
421
|
+
weight={'600'}
|
|
422
|
+
style={{ flex: 1, marginBottom: 10 }}>
|
|
423
|
+
{product?.name || productCart.name}
|
|
424
|
+
</OText>
|
|
425
|
+
{!!product?.calories && (
|
|
426
|
+
<OText size={16} style={{ color: '#808080' }}>{product?.calories} cal
|
|
427
|
+
</OText>
|
|
428
|
+
)}
|
|
429
|
+
</View>
|
|
430
|
+
{((!!product?.sku && product?.sku !== '-1' && product?.sku !== '1') || (!!product?.estimated_person)) && (
|
|
421
431
|
<OText size={14} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={'#909BA9'} mBottom={7}>
|
|
422
432
|
{
|
|
423
433
|
((product?.sku && product?.sku !== '-1' && product?.sku !== '1') || (productCart?.sku && productCart?.sku !== '-1' && productCart?.sku !== '1'))
|
|
@@ -432,11 +442,20 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
432
442
|
</OText>
|
|
433
443
|
)}
|
|
434
444
|
{isHaveWeight ? (
|
|
435
|
-
<OText size={16} lineHeight={24} color={theme.colors.
|
|
445
|
+
<OText size={16} lineHeight={24} color={theme.colors.primary}>{parsePrice(pricePerWeightUnit)} / {product?.weight_unit}</OText>
|
|
436
446
|
) : (
|
|
437
|
-
<
|
|
438
|
-
{productCart.price ? parsePrice(productCart.price) : ''}
|
|
439
|
-
|
|
447
|
+
<View style={{ flexDirection: 'row', marginBottom: 10 }}>
|
|
448
|
+
<OText size={16} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={theme.colors.primary}>{productCart.price ? parsePrice(productCart.price) : ''}</OText>
|
|
449
|
+
{product?.offer_price !== null && product?.in_offer && (
|
|
450
|
+
<OText style={{
|
|
451
|
+
fontSize: 14,
|
|
452
|
+
color: '#808080',
|
|
453
|
+
textDecorationLine: 'line-through',
|
|
454
|
+
marginLeft: 7,
|
|
455
|
+
marginRight: 7
|
|
456
|
+
}}>{parsePrice(product?.offer_price)}</OText>
|
|
457
|
+
)}
|
|
458
|
+
</View>
|
|
440
459
|
)}
|
|
441
460
|
</>
|
|
442
461
|
)}
|
|
@@ -446,6 +465,31 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
446
465
|
{product?.description || productCart?.description}
|
|
447
466
|
</OText>
|
|
448
467
|
</ProductDescription>
|
|
468
|
+
<ScrollView
|
|
469
|
+
horizontal
|
|
470
|
+
showsHorizontalScrollIndicator={false}
|
|
471
|
+
contentContainerStyle={{ paddingBottom: 30 }}
|
|
472
|
+
>
|
|
473
|
+
{product?.tags?.map((tag: any) => (
|
|
474
|
+
<View
|
|
475
|
+
key={tag.id}
|
|
476
|
+
style={styles.productTagWrapper}
|
|
477
|
+
>
|
|
478
|
+
{!!tag?.image ? (
|
|
479
|
+
<OIcon
|
|
480
|
+
url={optimizeImage(tag?.image, 'h_40,c_limit')}
|
|
481
|
+
style={styles.productTagImageStyle}
|
|
482
|
+
/>
|
|
483
|
+
) : (
|
|
484
|
+
<OIcon
|
|
485
|
+
src={theme.images?.dummies?.product}
|
|
486
|
+
style={styles.productTagImageStyle}
|
|
487
|
+
/>
|
|
488
|
+
)}
|
|
489
|
+
<OText color={theme.colors.textSecondary} size={12} style={styles.productTagNameStyle}>{tag.name}</OText>
|
|
490
|
+
</View>
|
|
491
|
+
))}
|
|
492
|
+
</ScrollView>
|
|
449
493
|
{loading && !product ? (
|
|
450
494
|
<>
|
|
451
495
|
{[...Array(2)].map((item, i) => (
|
|
@@ -714,16 +758,12 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
714
758
|
</WrapContent>
|
|
715
759
|
</View>
|
|
716
760
|
)}
|
|
717
|
-
{error && error.length > 0 && (
|
|
761
|
+
{!!error && error.length > 0 && (
|
|
718
762
|
<NotFoundSource content={error[0]?.message || error[0]} />
|
|
719
763
|
)}
|
|
720
764
|
</ScrollView>
|
|
721
765
|
{!loading && !error && product && (
|
|
722
|
-
<ProductActions
|
|
723
|
-
style={{
|
|
724
|
-
paddingBottom: Platform.OS === 'ios' ? bottom + 30 : bottom + 80
|
|
725
|
-
}}
|
|
726
|
-
>
|
|
766
|
+
<ProductActions>
|
|
727
767
|
<OText size={16} lineHeight={24} weight={'600'}>
|
|
728
768
|
{productCart.total ? parsePrice(productCart?.total) : ''}
|
|
729
769
|
</OText>
|
|
@@ -745,7 +785,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
745
785
|
<OText
|
|
746
786
|
size={12}
|
|
747
787
|
lineHeight={18}
|
|
748
|
-
style={{ minWidth:
|
|
788
|
+
style={{ minWidth: 40, textAlign: 'center' }}
|
|
749
789
|
>
|
|
750
790
|
{qtyBy?.pieces && productCart.quantity}
|
|
751
791
|
{qtyBy?.weight_unit && productCart.quantity * product?.weight}
|
|
@@ -769,36 +809,38 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
769
809
|
}
|
|
770
810
|
/>
|
|
771
811
|
</TouchableOpacity>
|
|
772
|
-
|
|
773
|
-
<
|
|
774
|
-
onPress={() => handleSwitchQtyUnit('pieces')}
|
|
775
|
-
>
|
|
776
|
-
<WeightUnitItem active={qtyBy?.pieces}>
|
|
777
|
-
<OText
|
|
778
|
-
size={12}
|
|
779
|
-
lineHeight={18}
|
|
780
|
-
color={qtyBy?.pieces ? theme.colors.primary : theme.colors.textNormal}
|
|
781
|
-
>
|
|
782
|
-
{t('PIECES', 'pieces')}
|
|
783
|
-
</OText>
|
|
784
|
-
</WeightUnitItem>
|
|
785
|
-
</TouchableOpacity>
|
|
786
|
-
<View style={{ alignItems: 'flex-start' }}>
|
|
812
|
+
{isHaveWeight && (
|
|
813
|
+
<WeightUnitSwitch>
|
|
787
814
|
<TouchableOpacity
|
|
788
|
-
onPress={() => handleSwitchQtyUnit('
|
|
815
|
+
onPress={() => handleSwitchQtyUnit('pieces')}
|
|
789
816
|
>
|
|
790
|
-
<WeightUnitItem active={qtyBy?.
|
|
817
|
+
<WeightUnitItem active={qtyBy?.pieces}>
|
|
791
818
|
<OText
|
|
792
819
|
size={12}
|
|
793
820
|
lineHeight={18}
|
|
794
|
-
color={qtyBy?.
|
|
821
|
+
color={qtyBy?.pieces ? theme.colors.primary : theme.colors.textNormal}
|
|
795
822
|
>
|
|
796
|
-
{
|
|
823
|
+
{t('PIECES', 'pcs')}
|
|
797
824
|
</OText>
|
|
798
825
|
</WeightUnitItem>
|
|
799
826
|
</TouchableOpacity>
|
|
800
|
-
|
|
801
|
-
|
|
827
|
+
<View style={{ alignItems: 'flex-start' }}>
|
|
828
|
+
<TouchableOpacity
|
|
829
|
+
onPress={() => handleSwitchQtyUnit('weight_unit')}
|
|
830
|
+
>
|
|
831
|
+
<WeightUnitItem active={qtyBy?.weight_unit}>
|
|
832
|
+
<OText
|
|
833
|
+
size={12}
|
|
834
|
+
lineHeight={18}
|
|
835
|
+
color={qtyBy?.weight_unit ? theme.colors.primary : theme.colors.textNormal}
|
|
836
|
+
>
|
|
837
|
+
{product?.weight_unit}
|
|
838
|
+
</OText>
|
|
839
|
+
</WeightUnitItem>
|
|
840
|
+
</TouchableOpacity>
|
|
841
|
+
</View>
|
|
842
|
+
</WeightUnitSwitch>
|
|
843
|
+
)}
|
|
802
844
|
</View>
|
|
803
845
|
)}
|
|
804
846
|
<View
|
|
@@ -867,7 +909,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
867
909
|
</View>
|
|
868
910
|
</ProductActions>
|
|
869
911
|
)}
|
|
870
|
-
|
|
912
|
+
</SafeAreaView>
|
|
871
913
|
);
|
|
872
914
|
};
|
|
873
915
|
|
|
@@ -5,13 +5,20 @@ export const WrapHeader = styled.View`
|
|
|
5
5
|
z-index: 1;
|
|
6
6
|
`
|
|
7
7
|
|
|
8
|
+
export const TopActions = styled.TouchableOpacity`
|
|
9
|
+
height: 44px;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
padding-horizontal: 30px;
|
|
12
|
+
`;
|
|
13
|
+
|
|
8
14
|
export const TopHeader = styled.View`
|
|
9
15
|
width: 100%;
|
|
10
16
|
flex-direction: row;
|
|
11
17
|
align-items: center;
|
|
12
18
|
justify-content: space-between;
|
|
13
19
|
z-index: 1;
|
|
14
|
-
|
|
20
|
+
height: 60px;
|
|
21
|
+
min-height: 60px;
|
|
15
22
|
`
|
|
16
23
|
|
|
17
24
|
export const ProductHeader = styled.ImageBackground`
|
|
@@ -37,7 +44,7 @@ export const ProductTitle = styled.View`
|
|
|
37
44
|
`
|
|
38
45
|
|
|
39
46
|
export const ProductDescription = styled.View`
|
|
40
|
-
margin-bottom:
|
|
47
|
+
margin-bottom: 20px;
|
|
41
48
|
`
|
|
42
49
|
|
|
43
50
|
export const ProductEditions = styled.View`
|
|
@@ -89,4 +96,4 @@ export const WeightUnitItem = styled.View`
|
|
|
89
96
|
${({ active }: any) => active && css`
|
|
90
97
|
background-color: ${(props: any) => props.theme.colors.primary}20;
|
|
91
98
|
`}
|
|
92
|
-
`
|
|
99
|
+
`
|
|
@@ -212,8 +212,8 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
212
212
|
</View>
|
|
213
213
|
{((isCartProduct && !isCartPending && product?.valid_menu && !product?.valid_quantity) ||
|
|
214
214
|
(!product?.valid_menu && isCartProduct && !isCartPending)) && (
|
|
215
|
-
<View style={{ alignItems: 'flex-end', width: '100%' }}>
|
|
216
|
-
<OText size={14} color={theme.colors.red} style={{ textAlign: 'right',
|
|
215
|
+
<View style={{ alignItems: 'flex-end', width: '100%', }}>
|
|
216
|
+
<OText size={14} color={theme.colors.red} style={{ textAlign: 'right', marginTop: 5 }}>
|
|
217
217
|
{t('NOT_AVAILABLE', 'Not available')}
|
|
218
218
|
</OText>
|
|
219
219
|
</View>
|
|
@@ -7,13 +7,13 @@ import {
|
|
|
7
7
|
} from 'ordering-components/native';
|
|
8
8
|
import { useTheme } from 'styled-components/native';
|
|
9
9
|
import { SingleProductCardParams } from '../../types';
|
|
10
|
-
import { CardContainer, CardInfo, SoldOut, QuantityContainer } from './styles';
|
|
10
|
+
import { CardContainer, CardInfo, SoldOut, QuantityContainer, PricesContainer } from './styles';
|
|
11
11
|
import { StyleSheet } from 'react-native';
|
|
12
12
|
import { OText, OIcon } from '../shared';
|
|
13
13
|
import FastImage from 'react-native-fast-image'
|
|
14
14
|
|
|
15
15
|
export const SingleProductCard = (props: SingleProductCardParams) => {
|
|
16
|
-
const { businessId, product, isSoldOut, onProductClick,
|
|
16
|
+
const { businessId, product, isSoldOut, onProductClick, productAddedToCartLength } = props;
|
|
17
17
|
|
|
18
18
|
const theme = useTheme();
|
|
19
19
|
|
|
@@ -51,6 +51,13 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
|
|
|
51
51
|
textAlign: 'center',
|
|
52
52
|
borderRadius: 25,
|
|
53
53
|
alignItems: 'center'
|
|
54
|
+
},
|
|
55
|
+
regularPriceStyle: {
|
|
56
|
+
fontSize: 12,
|
|
57
|
+
color: '#808080',
|
|
58
|
+
textDecorationLine: 'line-through',
|
|
59
|
+
marginLeft: 7,
|
|
60
|
+
marginRight: 7
|
|
54
61
|
}
|
|
55
62
|
});
|
|
56
63
|
|
|
@@ -90,7 +97,6 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
|
|
|
90
97
|
maxCartProductConfig,
|
|
91
98
|
maxCartProductInventory,
|
|
92
99
|
);
|
|
93
|
-
|
|
94
100
|
return (
|
|
95
101
|
<CardContainer
|
|
96
102
|
style={[
|
|
@@ -98,13 +104,13 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
|
|
|
98
104
|
(isSoldOut || maxProductQuantity <= 0) && styles.soldOutBackgroundStyle,
|
|
99
105
|
]}
|
|
100
106
|
onPress={() => onProductClick?.(product)}>
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
107
|
+
{productAddedToCartLength > 0 && (
|
|
108
|
+
<QuantityContainer style={[styles.quantityContainer, {
|
|
109
|
+
transform: [{ translateX: 10 }, { translateY: -10 }],
|
|
110
|
+
}]}>
|
|
111
|
+
<OText size={12} color={theme.colors.white}>{productAddedToCartLength.toString()}</OText>
|
|
112
|
+
</QuantityContainer>
|
|
113
|
+
)}
|
|
108
114
|
<CardInfo>
|
|
109
115
|
<OText
|
|
110
116
|
size={12}
|
|
@@ -114,9 +120,12 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
|
|
|
114
120
|
style={styles.line18}>
|
|
115
121
|
{product?.name}
|
|
116
122
|
</OText>
|
|
117
|
-
<
|
|
118
|
-
{parsePrice(product?.price)}
|
|
119
|
-
|
|
123
|
+
<PricesContainer>
|
|
124
|
+
<OText color={theme.colors.primary}>{parsePrice(product?.price)}</OText>
|
|
125
|
+
{product?.offer_price !== null && product?.in_offer && (
|
|
126
|
+
<OText style={styles.regularPriceStyle}>{parsePrice(product?.offer_price)}</OText>
|
|
127
|
+
)}
|
|
128
|
+
</PricesContainer>
|
|
120
129
|
<OText
|
|
121
130
|
size={10}
|
|
122
131
|
numberOfLines={2}
|
|
@@ -24,4 +24,10 @@ export const SoldOut = styled.View`
|
|
|
24
24
|
|
|
25
25
|
export const QuantityContainer = styled.View`
|
|
26
26
|
background: ${({ theme } : any) => theme.colors.primary};
|
|
27
|
+
align-items: center;
|
|
28
|
+
justify-content: center;
|
|
29
|
+
`
|
|
30
|
+
export const PricesContainer = styled.View`
|
|
31
|
+
flex-direction: row;
|
|
32
|
+
align-items: center;
|
|
27
33
|
`
|