ordering-ui-react-native 0.16.15-release → 0.16.16-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 +1 -1
- package/src/components/BusinessInformation/index.tsx +11 -4
- package/src/components/BusinessInformation/styles.tsx +2 -2
- package/themes/business/src/components/MapView/index.tsx +11 -0
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +8 -3
- package/themes/business/src/types/index.tsx +1 -0
- package/themes/original/src/components/BusinessProductsListing/index.tsx +9 -6
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +0 -4
- package/themes/original/src/components/OrderDetails/index.tsx +22 -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;
|
|
@@ -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 }}>
|
|
@@ -337,9 +337,14 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
337
337
|
</OText>
|
|
338
338
|
)}
|
|
339
339
|
{!!order?.comment && (
|
|
340
|
-
|
|
341
|
-
{
|
|
342
|
-
|
|
340
|
+
<>
|
|
341
|
+
<OText weight='500' style={{ marginBottom: 5 }}>
|
|
342
|
+
{t('ORDER_COMMENT', 'Order Comment')}
|
|
343
|
+
</OText>
|
|
344
|
+
<OText style={{ fontStyle: 'italic', opacity: 0.6, marginBottom: 20 }}>
|
|
345
|
+
{order?.comment}
|
|
346
|
+
</OText>
|
|
347
|
+
</>
|
|
343
348
|
)}
|
|
344
349
|
</View>
|
|
345
350
|
)}
|
|
@@ -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>,
|
|
@@ -1,6 +1,7 @@
|
|
|
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
3
|
import { IOScrollView } from 'react-native-intersection-observer'
|
|
4
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
4
5
|
import { useTheme } from 'styled-components/native';
|
|
5
6
|
import {
|
|
6
7
|
BusinessAndProductList,
|
|
@@ -68,6 +69,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
68
69
|
onBusinessClick
|
|
69
70
|
} = props
|
|
70
71
|
|
|
72
|
+
const insets = useSafeAreaInsets()
|
|
71
73
|
const theme = useTheme();
|
|
72
74
|
const [, t] = useLanguage()
|
|
73
75
|
const [{ auth }] = useSession()
|
|
@@ -245,12 +247,13 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
245
247
|
|
|
246
248
|
return (
|
|
247
249
|
<>
|
|
248
|
-
<
|
|
249
|
-
style={{ flex: 1 }}
|
|
250
|
-
isOpenFiltProducts={isOpenFiltProducts}
|
|
251
|
-
>
|
|
250
|
+
<View style={{ flex: 1 }}>
|
|
252
251
|
<Animated.View style={{ position: 'relative' }}>
|
|
253
|
-
<TopHeader
|
|
252
|
+
<TopHeader
|
|
253
|
+
style={{
|
|
254
|
+
marginTop: Platform.OS === 'ios' ? insets.top : 40
|
|
255
|
+
}}
|
|
256
|
+
>
|
|
254
257
|
{!isOpenSearchBar && (
|
|
255
258
|
<>
|
|
256
259
|
<TopActions onPress={() => handleBackNavigation()}>
|
|
@@ -512,7 +515,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
512
515
|
onAccept={() => setAlertState({ open: false, content: [] })}
|
|
513
516
|
onClose={() => setAlertState({ open: false, content: [] })}
|
|
514
517
|
/>
|
|
515
|
-
</
|
|
518
|
+
</View>
|
|
516
519
|
<OModal
|
|
517
520
|
open={openService}
|
|
518
521
|
onClose={() => setOpenService(false)}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components/native'
|
|
2
2
|
|
|
3
|
-
export const ContainerSafeAreaView = styled.SafeAreaView`
|
|
4
|
-
`
|
|
5
|
-
|
|
6
3
|
export const WrapHeader = styled.View`
|
|
7
4
|
position: relative;
|
|
8
5
|
`
|
|
@@ -14,7 +11,6 @@ export const TopHeader = styled.View`
|
|
|
14
11
|
z-index: 1;
|
|
15
12
|
height: 60px;
|
|
16
13
|
min-height: 60px;
|
|
17
|
-
margin-top: ${(props : any) => props.isIos ? '0' : '40px'};
|
|
18
14
|
`
|
|
19
15
|
export const AddressInput = styled.TouchableOpacity`
|
|
20
16
|
flex: 1;
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
useConfig
|
|
11
11
|
} from 'ordering-components/native';
|
|
12
12
|
import { useTheme } from 'styled-components/native';
|
|
13
|
+
import { showLocation } from 'react-native-map-link';
|
|
13
14
|
import {
|
|
14
15
|
OrderDetailsContainer,
|
|
15
16
|
Header,
|
|
@@ -116,6 +117,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
116
117
|
const { order, businessData } = props.order;
|
|
117
118
|
const mapValidStatuses = [9, 19, 23]
|
|
118
119
|
const placeSpotTypes = [3, 4, 5]
|
|
120
|
+
const directionTypes = [2, 3, 4, 5]
|
|
119
121
|
|
|
120
122
|
const walletName: any = {
|
|
121
123
|
cash: {
|
|
@@ -743,6 +745,26 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
743
745
|
{order?.business?.address}
|
|
744
746
|
</OText>
|
|
745
747
|
</View>
|
|
748
|
+
{directionTypes.includes(order?.delivery_type) && (
|
|
749
|
+
<OButton
|
|
750
|
+
text={t('GET_DIRECTIONS', 'Get Directions')}
|
|
751
|
+
imgRightSrc=''
|
|
752
|
+
textStyle={{ color: theme.colors.white }}
|
|
753
|
+
style={{
|
|
754
|
+
alignSelf: 'center',
|
|
755
|
+
borderRadius: 10,
|
|
756
|
+
marginTop: 30
|
|
757
|
+
}}
|
|
758
|
+
onClick={() => showLocation({
|
|
759
|
+
latitude: order?.business?.location?.lat,
|
|
760
|
+
longitude: order?.business?.location?.lng,
|
|
761
|
+
naverCallerName: 'com.reactnativeappstemplate5',
|
|
762
|
+
dialogTitle: t('GET_DIRECTIONS', 'Get Directions'),
|
|
763
|
+
dialogMessage: t('WHAT_APP_WOULD_YOU_USE', 'What app would you like to use?'),
|
|
764
|
+
cancelText: t('CANCEL', 'Cancel'),
|
|
765
|
+
})}
|
|
766
|
+
/>
|
|
767
|
+
)}
|
|
746
768
|
</OrderBusiness>
|
|
747
769
|
|
|
748
770
|
{placeSpotTypes.includes(order?.delivery_type) && (
|