ordering-ui-react-native 0.17.10 → 0.17.12
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/BusinessInformation/index.tsx +11 -4
- package/src/components/BusinessInformation/styles.tsx +2 -2
- package/src/components/SingleProductReview/index.tsx +0 -24
- package/src/components/SingleProductReview/styles.tsx +0 -12
- package/themes/business/src/components/DriverMap/index.tsx +6 -3
- package/themes/business/src/components/MapView/index.tsx +11 -0
- package/themes/business/src/types/index.tsx +1 -0
- package/themes/business/src/utils/index.tsx +8 -0
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +1 -1
- package/themes/original/src/components/SingleProductReview/index.tsx +30 -3
- package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import {
|
|
3
3
|
BusinessInformation as BusinessInformationController,
|
|
4
|
-
useLanguage
|
|
4
|
+
useLanguage,
|
|
5
|
+
useConfig
|
|
5
6
|
} from 'ordering-components/native'
|
|
6
7
|
import { OText } from '../shared'
|
|
7
8
|
import {
|
|
@@ -26,6 +27,8 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
|
|
|
26
27
|
} = props
|
|
27
28
|
const [, t] = useLanguage()
|
|
28
29
|
const theme = useTheme()
|
|
30
|
+
const [{ configs }] = useConfig();
|
|
31
|
+
|
|
29
32
|
const daysOfWeek = [
|
|
30
33
|
t('SUNDAY_ABBREVIATION', 'Sun'),
|
|
31
34
|
t('MONDAY_ABBREVIATION', 'Mon'),
|
|
@@ -35,9 +38,13 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
|
|
|
35
38
|
t('FRIDAY_ABBREVIATION', 'Fri'),
|
|
36
39
|
t('SATURDAY_ABBREVIATION', 'Sat')
|
|
37
40
|
]
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
const is12hours = configs?.format_time?.value?.includes('12')
|
|
42
|
+
|
|
43
|
+
const scheduleFormatted = ({ hour, minute } : { hour : number | string, minute : number | string}) => {
|
|
44
|
+
const checkTime = (val: number | string) => (val < 10 ? `0${val}` : val);
|
|
45
|
+
const zz = hour === 0 ? t('AM', 'AM') : hour >= 12 ? t('PM', 'PM') : t('AM', 'AM');
|
|
46
|
+
const h = parseInt(`${hour}`);
|
|
47
|
+
return is12hours ? `${h === 0 ? 12 : h > 12 ? h - 12 : h}:${checkTime(minute)} ${zz}` : `${checkTime(hour)}:${checkTime(minute)}`;
|
|
41
48
|
}
|
|
42
49
|
|
|
43
50
|
return (
|
|
@@ -18,7 +18,7 @@ export const InnerContent = styled.View`
|
|
|
18
18
|
`
|
|
19
19
|
export const WrapScheduleBlock = styled.ScrollView`
|
|
20
20
|
margin: 20px 0;
|
|
21
|
-
max-height:
|
|
21
|
+
max-height: 520px;
|
|
22
22
|
`
|
|
23
23
|
export const ScheduleBlock = styled.View`
|
|
24
24
|
display: flex;
|
|
@@ -27,7 +27,7 @@ export const ScheduleBlock = styled.View`
|
|
|
27
27
|
padding: 0 20px;
|
|
28
28
|
border-left-width: 1px;
|
|
29
29
|
border-color: ${(props: any) => props.theme.colors.lightGray};
|
|
30
|
-
max-width:
|
|
30
|
+
max-width: 120px;
|
|
31
31
|
`
|
|
32
32
|
export const WrapBusinessMap = styled.View`
|
|
33
33
|
max-height: 200px;
|
|
@@ -40,12 +40,6 @@ export const SingleProductReview = (props: SingleProductReviewParams) => {
|
|
|
40
40
|
flexDirection: 'row',
|
|
41
41
|
justifyContent: 'center',
|
|
42
42
|
marginVertical: 10,
|
|
43
|
-
},
|
|
44
|
-
productStyle: {
|
|
45
|
-
width: 80,
|
|
46
|
-
height: 80,
|
|
47
|
-
marginLeft: 'auto',
|
|
48
|
-
marginRight: 'auto'
|
|
49
43
|
}
|
|
50
44
|
})
|
|
51
45
|
|
|
@@ -109,24 +103,6 @@ export const SingleProductReview = (props: SingleProductReviewParams) => {
|
|
|
109
103
|
return (
|
|
110
104
|
<>
|
|
111
105
|
<ProductContainer>
|
|
112
|
-
<LogoWrapper>
|
|
113
|
-
{product?.images ? (
|
|
114
|
-
<FastImage
|
|
115
|
-
style={styles.productStyle}
|
|
116
|
-
source={{
|
|
117
|
-
uri: optimizeImage(product?.images, 'h_250,c_limit'),
|
|
118
|
-
priority: FastImage.priority.normal,
|
|
119
|
-
}}
|
|
120
|
-
resizeMode={FastImage.resizeMode.cover}
|
|
121
|
-
/>
|
|
122
|
-
) : (
|
|
123
|
-
<OIcon
|
|
124
|
-
src={theme?.images?.dummies?.product}
|
|
125
|
-
width={80}
|
|
126
|
-
height={80}
|
|
127
|
-
/>
|
|
128
|
-
)}
|
|
129
|
-
</LogoWrapper>
|
|
130
106
|
<ProductHeader>
|
|
131
107
|
<OText numberOfLines={1} style={{ flex: 1 }}>{product?.name}</OText>
|
|
132
108
|
<LikeHandsActionContainer>
|
|
@@ -14,18 +14,6 @@ export const LikeHandsActionContainer = styled.View`
|
|
|
14
14
|
flex-direction: row;
|
|
15
15
|
`
|
|
16
16
|
|
|
17
|
-
export const LogoWrapper = styled.View`
|
|
18
|
-
shadowRadius: 3;
|
|
19
|
-
shadowOffset: { width: 1, height: 4 };
|
|
20
|
-
elevation: 3;
|
|
21
|
-
borderRadius: 8;
|
|
22
|
-
shadowOpacity: 0.1;
|
|
23
|
-
overflow: hidden;
|
|
24
|
-
width: 80;
|
|
25
|
-
marginLeft: auto;
|
|
26
|
-
marginRight: auto;
|
|
27
|
-
`
|
|
28
|
-
|
|
29
17
|
export const LikeHandsButton = styled.TouchableOpacity`
|
|
30
18
|
${(props: any) => props.isLike && css`
|
|
31
19
|
margin-horizontal: 15px;
|
|
@@ -13,6 +13,7 @@ import { useTheme } from 'styled-components/native';
|
|
|
13
13
|
import { useLocation } from '../../hooks/useLocation';
|
|
14
14
|
import { FloatingButton } from '../FloatingButton';
|
|
15
15
|
import { showLocation } from 'react-native-map-link';
|
|
16
|
+
import { transformDistance } from '../../utils';
|
|
16
17
|
|
|
17
18
|
export const DriverMap = (props: GoogleMapsParams) => {
|
|
18
19
|
const {
|
|
@@ -56,6 +57,7 @@ export const DriverMap = (props: GoogleMapsParams) => {
|
|
|
56
57
|
content: Array<string>;
|
|
57
58
|
key?: string | null;
|
|
58
59
|
}>({ open: false, content: [], key: null });
|
|
60
|
+
const distanceUnit = configState?.configs?.distance_unit?.value
|
|
59
61
|
|
|
60
62
|
const {
|
|
61
63
|
hasLocation,
|
|
@@ -475,9 +477,10 @@ export const DriverMap = (props: GoogleMapsParams) => {
|
|
|
475
477
|
src={theme.images.general.arrow_distance}
|
|
476
478
|
style={styles.arrowDistance}
|
|
477
479
|
/>
|
|
478
|
-
<OText size={12} numberOfLines={3}>
|
|
479
|
-
distancesFromTwoPlacesKm
|
|
480
|
-
|
|
480
|
+
<OText size={12} numberOfLines={3}>
|
|
481
|
+
{`${transformDistance(distancesFromTwoPlacesKm, distanceUnit)} ${t(distanceUnit.toUpperCase(), distanceUnit)}`}
|
|
482
|
+
</OText>
|
|
483
|
+
|
|
481
484
|
</View>
|
|
482
485
|
<View style={{ width: '75%', paddingRight: 20 }}>
|
|
483
486
|
<OText
|
|
@@ -21,6 +21,7 @@ const MapViewComponent = (props: MapViewParams) => {
|
|
|
21
21
|
customerMarkerGroups,
|
|
22
22
|
alertState,
|
|
23
23
|
setAlertState,
|
|
24
|
+
setDriverLocation,
|
|
24
25
|
onNavigationRedirect,
|
|
25
26
|
getBusinessLocations,
|
|
26
27
|
} = props;
|
|
@@ -211,6 +212,16 @@ const MapViewComponent = (props: MapViewParams) => {
|
|
|
211
212
|
)
|
|
212
213
|
}
|
|
213
214
|
|
|
215
|
+
useEffect(() => {
|
|
216
|
+
if (userLocation.latitude !== 0 && userLocation.longitude !== 0) {
|
|
217
|
+
const location = {
|
|
218
|
+
lat: userLocation.latitude,
|
|
219
|
+
lng: userLocation.longitude
|
|
220
|
+
}
|
|
221
|
+
setDriverLocation({ location })
|
|
222
|
+
}
|
|
223
|
+
}, [userLocation])
|
|
224
|
+
|
|
214
225
|
return (
|
|
215
226
|
<SafeAreaView style={{ flex: 1 }}>
|
|
216
227
|
<View style={{ flex: 1 }}>
|
|
@@ -568,6 +568,7 @@ export interface AcceptOrRejectOrderParams {
|
|
|
568
568
|
export interface MapViewParams {
|
|
569
569
|
onNavigationRedirect: (page: string, params?: any) => void,
|
|
570
570
|
getBusinessLocations: () => void,
|
|
571
|
+
setDriverLocation: (location: any) => void,
|
|
571
572
|
isLoadingBusinessMarkers?: boolean,
|
|
572
573
|
markerGroups: Array<any>,
|
|
573
574
|
customerMarkerGroups: Array<any>,
|
|
@@ -345,3 +345,11 @@ export const getOrderStatus = (s: string, t: any) => {
|
|
|
345
345
|
|
|
346
346
|
return objectStatus && objectStatus;
|
|
347
347
|
};
|
|
348
|
+
|
|
349
|
+
export const transformDistance = (value : number, distanceUnit?: string) => {
|
|
350
|
+
return distanceUnit === 'mi'
|
|
351
|
+
? (value / 1.609).toFixed(2)
|
|
352
|
+
: distanceUnit === 'ft'
|
|
353
|
+
? (value * 3280.84).toFixed(0)
|
|
354
|
+
: (value).toFixed(2)
|
|
355
|
+
}
|
|
@@ -149,7 +149,7 @@ export const BusinessItemAccordion = (props: any) => {
|
|
|
149
149
|
<OButton
|
|
150
150
|
onClick={handleClickCheckout}
|
|
151
151
|
textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
|
|
152
|
-
style={{ width:
|
|
152
|
+
style={{ width: 180, flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
|
|
153
153
|
text={t('CHECKOUT', 'Checkout')}
|
|
154
154
|
bgColor={(cart?.subtotal < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
|
|
155
155
|
borderColor={theme.colors.primary}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react'
|
|
2
|
-
import { useLanguage } from 'ordering-components/native'
|
|
3
|
-
import { OText, OButton, OInput } from '../shared'
|
|
2
|
+
import { useLanguage, useUtils } from 'ordering-components/native'
|
|
3
|
+
import { OText, OButton, OInput, OIcon } from '../shared'
|
|
4
4
|
import { StyleSheet, TouchableOpacity, View } from 'react-native'
|
|
5
5
|
import AntDesignIcons from 'react-native-vector-icons/AntDesign'
|
|
6
6
|
import { useTheme } from 'styled-components/native'
|
|
@@ -14,7 +14,9 @@ import {
|
|
|
14
14
|
LikeHandsActionContainer,
|
|
15
15
|
LikeHandsButton,
|
|
16
16
|
CommentsButtonGroup,
|
|
17
|
+
LogoWrapper,
|
|
17
18
|
} from './styles'
|
|
19
|
+
import FastImage from 'react-native-fast-image'
|
|
18
20
|
|
|
19
21
|
export const SingleProductReview = (props: SingleProductReviewParams) => {
|
|
20
22
|
const {
|
|
@@ -25,6 +27,7 @@ export const SingleProductReview = (props: SingleProductReviewParams) => {
|
|
|
25
27
|
|
|
26
28
|
const [, t] = useLanguage()
|
|
27
29
|
const theme = useTheme()
|
|
30
|
+
const [{ optimizeImage }] = useUtils()
|
|
28
31
|
|
|
29
32
|
const styles = StyleSheet.create({
|
|
30
33
|
inputTextArea: {
|
|
@@ -40,6 +43,12 @@ export const SingleProductReview = (props: SingleProductReviewParams) => {
|
|
|
40
43
|
justifyContent: 'center',
|
|
41
44
|
marginVertical: 10,
|
|
42
45
|
},
|
|
46
|
+
productStyle: {
|
|
47
|
+
width: 80,
|
|
48
|
+
height: 80,
|
|
49
|
+
marginLeft: 'auto',
|
|
50
|
+
marginRight: 'auto'
|
|
51
|
+
}
|
|
43
52
|
})
|
|
44
53
|
|
|
45
54
|
const [comments, setComments] = useState<Array<any>>([])
|
|
@@ -100,6 +109,24 @@ export const SingleProductReview = (props: SingleProductReviewParams) => {
|
|
|
100
109
|
return (
|
|
101
110
|
<>
|
|
102
111
|
<ProductContainer>
|
|
112
|
+
<LogoWrapper>
|
|
113
|
+
{product?.images ? (
|
|
114
|
+
<FastImage
|
|
115
|
+
style={styles.productStyle}
|
|
116
|
+
source={{
|
|
117
|
+
uri: optimizeImage(product?.images, 'h_250,c_limit'),
|
|
118
|
+
priority: FastImage.priority.normal,
|
|
119
|
+
}}
|
|
120
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
121
|
+
/>
|
|
122
|
+
) : (
|
|
123
|
+
<OIcon
|
|
124
|
+
src={theme?.images?.dummies?.product}
|
|
125
|
+
width={80}
|
|
126
|
+
height={80}
|
|
127
|
+
/>
|
|
128
|
+
)}
|
|
129
|
+
</LogoWrapper>
|
|
103
130
|
<ProductHeader>
|
|
104
131
|
<OText numberOfLines={1} style={{ flex: 1 }} color={theme.colors.textNormal}>{product?.name}</OText>
|
|
105
132
|
<LikeHandsActionContainer>
|
|
@@ -129,7 +156,7 @@ export const SingleProductReview = (props: SingleProductReviewParams) => {
|
|
|
129
156
|
style={{ height: 35, paddingLeft: 5, paddingRight: 5, marginHorizontal: 3, marginVertical: 10 }}
|
|
130
157
|
imgRightSrc={isSelectedComment(commentItem.key) ? theme.images.general.close : null}
|
|
131
158
|
imgRightStyle={{ tintColor: theme.colors.white, right: 5, margin: 5 }}
|
|
132
|
-
onClick={() => handleChangeComment(commentItem)
|
|
159
|
+
onClick={() => handleChangeComment(commentItem)}
|
|
133
160
|
/>
|
|
134
161
|
))}
|
|
135
162
|
</CommentsButtonGroup>
|
|
@@ -15,6 +15,18 @@ export const LikeHandsActionContainer = styled.View`
|
|
|
15
15
|
flex-direction: row;
|
|
16
16
|
`
|
|
17
17
|
|
|
18
|
+
export const LogoWrapper = styled.View`
|
|
19
|
+
shadowRadius: 3;
|
|
20
|
+
shadowOffset: { width: 1, height: 4 };
|
|
21
|
+
elevation: 3;
|
|
22
|
+
borderRadius: 8;
|
|
23
|
+
shadowOpacity: 0.1;
|
|
24
|
+
overflow: hidden;
|
|
25
|
+
width: 80;
|
|
26
|
+
marginLeft: auto;
|
|
27
|
+
marginRight: auto;
|
|
28
|
+
`
|
|
29
|
+
|
|
18
30
|
export const LikeHandsButton = styled.TouchableOpacity`
|
|
19
31
|
${(props: any) => props.isLike && css`
|
|
20
32
|
margin-horizontal: 15px;
|