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,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import {
|
|
3
3
|
useLanguage,
|
|
4
4
|
useConfig,
|
|
@@ -10,9 +10,7 @@ import { useTheme } from 'styled-components/native';
|
|
|
10
10
|
import { SingleProductCardParams } from '../../types';
|
|
11
11
|
import { CardContainer, CardInfo, SoldOut, QuantityContainer, PricesContainer, RibbonBox, LogoWrapper } from './styles';
|
|
12
12
|
import { StyleSheet, View, TouchableOpacity, Image } from 'react-native';
|
|
13
|
-
import {
|
|
14
|
-
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
15
|
-
import { OText } from '../shared';
|
|
13
|
+
import { OButton, OText } from '../shared';
|
|
16
14
|
import FastImage from 'react-native-fast-image'
|
|
17
15
|
import IconAntDesign from 'react-native-vector-icons/AntDesign'
|
|
18
16
|
import { shape } from '../../utils';
|
|
@@ -31,11 +29,11 @@ const SinguleProductCardUI = React.memo((props: SingleProductCardParams) => {
|
|
|
31
29
|
onProductClick,
|
|
32
30
|
productAddedToCartLength,
|
|
33
31
|
style,
|
|
34
|
-
handleFavoriteProduct
|
|
35
|
-
enableIntersection
|
|
32
|
+
handleFavoriteProduct
|
|
36
33
|
} = props;
|
|
37
34
|
|
|
38
35
|
const theme = useTheme();
|
|
36
|
+
const showAddButton = !theme?.layouts?.business_view?.components?.products?.components?.add_to_cart_button?.hidden
|
|
39
37
|
|
|
40
38
|
const styles = StyleSheet.create({
|
|
41
39
|
container: {
|
|
@@ -90,7 +88,7 @@ const SinguleProductCardUI = React.memo((props: SingleProductCardParams) => {
|
|
|
90
88
|
const [stateConfig] = useConfig();
|
|
91
89
|
const [{ parsePrice, optimizeImage }] = useUtils();
|
|
92
90
|
const [orderState] = useOrder();
|
|
93
|
-
|
|
91
|
+
|
|
94
92
|
const editMode = typeof product?.code !== 'undefined';
|
|
95
93
|
|
|
96
94
|
const removeToBalance = editMode ? product?.quantity : 0;
|
|
@@ -120,110 +118,122 @@ const SinguleProductCardUI = React.memo((props: SingleProductCardParams) => {
|
|
|
120
118
|
}
|
|
121
119
|
|
|
122
120
|
return (
|
|
123
|
-
<
|
|
124
|
-
{
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}]
|
|
136
|
-
|
|
137
|
-
</
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
size={12}
|
|
143
|
-
weight={'500'}
|
|
144
|
-
numberOfLines={1}
|
|
145
|
-
ellipsizeMode="tail"
|
|
146
|
-
style={styles.line18}>
|
|
147
|
-
{product?.name}
|
|
148
|
-
</OText>
|
|
149
|
-
<TouchableOpacity
|
|
150
|
-
onPress={handleChangeFavorite}
|
|
151
|
-
>
|
|
152
|
-
<IconAntDesign
|
|
153
|
-
name={product?.favorite ? 'heart' : 'hearto'}
|
|
154
|
-
color={theme.colors.danger5}
|
|
155
|
-
size={18}
|
|
156
|
-
/>
|
|
157
|
-
</TouchableOpacity>
|
|
158
|
-
</View>
|
|
159
|
-
<PricesContainer>
|
|
160
|
-
<OText color={theme.colors.primary}>{product?.price ? parsePrice(product?.price) : ''}</OText>
|
|
161
|
-
{product?.offer_price !== null && product?.in_offer && (
|
|
162
|
-
<OText style={styles.regularPriceStyle}>{product?.offer_price ? parsePrice(product?.offer_price) : ''}</OText>
|
|
163
|
-
)}
|
|
164
|
-
</PricesContainer>
|
|
121
|
+
<CardContainer
|
|
122
|
+
showAddButton={showAddButton}
|
|
123
|
+
style={[
|
|
124
|
+
styles.container,
|
|
125
|
+
(isSoldOut || maxProductQuantity <= 0) && styles.soldOutBackgroundStyle,
|
|
126
|
+
(style && { ...style }),
|
|
127
|
+
]}
|
|
128
|
+
onPress={() => onProductClick?.(product)}
|
|
129
|
+
>
|
|
130
|
+
<View style={{ flexDirection: 'row' }}>
|
|
131
|
+
{productAddedToCartLength > 0 && (
|
|
132
|
+
<QuantityContainer style={[styles.quantityContainer, {
|
|
133
|
+
transform: [{ translateX: 10 }, { translateY: -10 }],
|
|
134
|
+
}]}>
|
|
135
|
+
<OText size={12} color={theme.colors.white}>{productAddedToCartLength.toString()}</OText>
|
|
136
|
+
</QuantityContainer>
|
|
137
|
+
)}
|
|
138
|
+
<CardInfo>
|
|
139
|
+
<View style={styles.titleWrapper}>
|
|
165
140
|
<OText
|
|
166
|
-
size={
|
|
167
|
-
|
|
141
|
+
size={12}
|
|
142
|
+
weight={'500'}
|
|
143
|
+
numberOfLines={1}
|
|
168
144
|
ellipsizeMode="tail"
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
{product?.description}
|
|
145
|
+
style={styles.line18}>
|
|
146
|
+
{product?.name}
|
|
172
147
|
</OText>
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
<
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
>
|
|
181
|
-
<OText
|
|
182
|
-
size={10}
|
|
183
|
-
weight={'400'}
|
|
184
|
-
color={theme.colors.white}
|
|
185
|
-
numberOfLines={2}
|
|
186
|
-
ellipsizeMode='tail'
|
|
187
|
-
lineHeight={13}
|
|
188
|
-
>
|
|
189
|
-
{product?.ribbon?.text}
|
|
190
|
-
</OText>
|
|
191
|
-
</RibbonBox>
|
|
192
|
-
)}
|
|
193
|
-
{product?.images ? (
|
|
194
|
-
<>
|
|
195
|
-
{isIntersectionObserver && (
|
|
196
|
-
<FastImage
|
|
197
|
-
style={styles.productStyle}
|
|
198
|
-
source={{
|
|
199
|
-
uri: optimizeImage(product?.images, 'h_250,c_limit'),
|
|
200
|
-
priority: FastImage.priority.normal,
|
|
201
|
-
}}
|
|
202
|
-
resizeMode={FastImage.resizeMode.cover}
|
|
203
|
-
/>
|
|
204
|
-
)}
|
|
205
|
-
</>
|
|
206
|
-
) : (
|
|
207
|
-
<FastImage
|
|
208
|
-
style={styles.productStyle}
|
|
209
|
-
source={{
|
|
210
|
-
uri: Image.resolveAssetSource(theme.images.dummies.product).uri,
|
|
211
|
-
priority: FastImage.priority.normal,
|
|
212
|
-
}}
|
|
213
|
-
resizeMode={FastImage.resizeMode.cover}
|
|
148
|
+
<TouchableOpacity
|
|
149
|
+
onPress={handleChangeFavorite}
|
|
150
|
+
>
|
|
151
|
+
<IconAntDesign
|
|
152
|
+
name={product?.favorite ? 'heart' : 'hearto'}
|
|
153
|
+
color={theme.colors.danger5}
|
|
154
|
+
size={18}
|
|
214
155
|
/>
|
|
156
|
+
</TouchableOpacity>
|
|
157
|
+
</View>
|
|
158
|
+
<PricesContainer>
|
|
159
|
+
<OText color={theme.colors.primary}>{product?.price ? parsePrice(product?.price) : ''}</OText>
|
|
160
|
+
{product?.offer_price !== null && product?.in_offer && (
|
|
161
|
+
<OText style={styles.regularPriceStyle}>{product?.offer_price ? parsePrice(product?.offer_price) : ''}</OText>
|
|
215
162
|
)}
|
|
216
|
-
</
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
163
|
+
</PricesContainer>
|
|
164
|
+
<OText
|
|
165
|
+
size={10}
|
|
166
|
+
numberOfLines={2}
|
|
167
|
+
ellipsizeMode="tail"
|
|
168
|
+
color={theme.colors.textSecondary}
|
|
169
|
+
style={styles.line15}>
|
|
170
|
+
{product?.description}
|
|
171
|
+
</OText>
|
|
172
|
+
</CardInfo>
|
|
173
|
+
<LogoWrapper>
|
|
174
|
+
{product?.ribbon?.enabled && (
|
|
175
|
+
<RibbonBox
|
|
176
|
+
bgColor={product?.ribbon?.color}
|
|
177
|
+
isRoundRect={product?.ribbon?.shape === shape?.rectangleRound}
|
|
178
|
+
isCapsule={product?.ribbon?.shape === shape?.capsuleShape}
|
|
179
|
+
>
|
|
180
|
+
<OText
|
|
181
|
+
size={10}
|
|
182
|
+
weight={'400'}
|
|
183
|
+
color={theme.colors.white}
|
|
184
|
+
numberOfLines={2}
|
|
185
|
+
ellipsizeMode='tail'
|
|
186
|
+
lineHeight={13}
|
|
187
|
+
>
|
|
188
|
+
{product?.ribbon?.text}
|
|
221
189
|
</OText>
|
|
222
|
-
</
|
|
190
|
+
</RibbonBox>
|
|
191
|
+
)}
|
|
192
|
+
{product?.images ? (
|
|
193
|
+
<FastImage
|
|
194
|
+
style={styles.productStyle}
|
|
195
|
+
source={{
|
|
196
|
+
uri: optimizeImage(product?.images, 'h_250,c_limit'),
|
|
197
|
+
priority: FastImage.priority.normal,
|
|
198
|
+
}}
|
|
199
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
200
|
+
/>
|
|
201
|
+
) : (
|
|
202
|
+
<FastImage
|
|
203
|
+
style={styles.productStyle}
|
|
204
|
+
source={{
|
|
205
|
+
uri: Image.resolveAssetSource(theme.images.dummies.product).uri,
|
|
206
|
+
priority: FastImage.priority.normal,
|
|
207
|
+
}}
|
|
208
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
209
|
+
/>
|
|
223
210
|
)}
|
|
224
|
-
</
|
|
211
|
+
</LogoWrapper>
|
|
212
|
+
|
|
213
|
+
{(isSoldOut || maxProductQuantity <= 0) && (
|
|
214
|
+
<SoldOut>
|
|
215
|
+
<OText size={12} weight="bold" color={theme.colors.textSecondary} style={styles.soldOutTextStyle}>
|
|
216
|
+
{t('SOLD_OUT', 'SOLD OUT')}
|
|
217
|
+
</OText>
|
|
218
|
+
</SoldOut>
|
|
219
|
+
)}
|
|
220
|
+
</View>
|
|
221
|
+
{showAddButton && (
|
|
222
|
+
<OButton
|
|
223
|
+
onClick={() => onProductClick?.(product)}
|
|
224
|
+
style={{
|
|
225
|
+
width: '100%',
|
|
226
|
+
borderRadius: 7.6,
|
|
227
|
+
marginTop: 10,
|
|
228
|
+
|
|
229
|
+
}}
|
|
230
|
+
bgColor={isSoldOut ? '#B8B8B8' : theme?.colors?.white}
|
|
231
|
+
borderColor={theme?.colors.primary}
|
|
232
|
+
textStyle={{color: theme.colors.primary}}
|
|
233
|
+
text={t('ADD', 'Add')}
|
|
234
|
+
/>
|
|
225
235
|
)}
|
|
226
|
-
</
|
|
236
|
+
</CardContainer>
|
|
227
237
|
);
|
|
228
238
|
}, SingleProductCardPropsAreEqual);
|
|
229
239
|
|
|
@@ -2,7 +2,7 @@ import styled, { css } from 'styled-components/native'
|
|
|
2
2
|
|
|
3
3
|
export const CardContainer = styled.TouchableOpacity`
|
|
4
4
|
flex: 1;
|
|
5
|
-
flex-direction: row;
|
|
5
|
+
flex-direction: ${(props : any) => props.showAddButton ? 'column' : 'row'};
|
|
6
6
|
justify-content: space-between;
|
|
7
7
|
align-items: center;
|
|
8
8
|
padding: 12px;
|
|
@@ -23,7 +23,7 @@ export const SoldOut = styled.View`
|
|
|
23
23
|
`
|
|
24
24
|
|
|
25
25
|
export const QuantityContainer = styled.View`
|
|
26
|
-
background: ${({ theme }
|
|
26
|
+
background: ${({ theme }: any) => theme.colors.primary};
|
|
27
27
|
align-items: center;
|
|
28
28
|
justify-content: center;
|
|
29
29
|
`
|
|
@@ -78,6 +78,7 @@ interface Props {
|
|
|
78
78
|
borderColor?: string;
|
|
79
79
|
loadingStyle?: ViewStyle;
|
|
80
80
|
showNextIcon?: boolean;
|
|
81
|
+
isDisabledWithSameStyles?: boolean;
|
|
81
82
|
}
|
|
82
83
|
|
|
83
84
|
const OButton = (props: Props): React.ReactElement => {
|
|
@@ -110,6 +111,7 @@ const OButton = (props: Props): React.ReactElement => {
|
|
|
110
111
|
activeOpacity={props.activeOpacity}
|
|
111
112
|
onPress={props.onClick}
|
|
112
113
|
style={{ width: props.isCircle ? 52 : props.style?.width, ...props.parentStyle }}
|
|
114
|
+
disabled={props.isDisabledWithSameStyles}
|
|
113
115
|
>
|
|
114
116
|
<StyledButton style={props.bgColor ? { ...props.style, backgroundColor: props.bgColor, borderColor: props.borderColor } : props.style}>
|
|
115
117
|
{props.imgLeftSrc ? (
|