ordering-ui-react-native 0.17.11 → 0.17.13

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.17.11",
3
+ "version": "0.17.13",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -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 scheduleFormatted = ({ hour, minute } : {hour : number | string, minute : number | string}) => {
39
- const checkTime = (val : number | string) => val < 10 ? `0${val}` : val
40
- return `${checkTime(hour)}:${checkTime(minute)}`
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: 500px;
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: 100px;
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;
@@ -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
- <OText style={{ fontStyle: 'italic', opacity: 0.6, marginBottom: 5 }}>
341
- {order?.comment}
342
- </OText>
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,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;