ordering-ui-react-native 0.12.84 → 0.12.85
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/single-business/src/components/BusinessProductsList/index.tsx +1 -1
- package/themes/single-business/src/components/BusinessProductsListing/index.tsx +1 -0
- package/themes/single-business/src/components/BusinessReviews/index.tsx +9 -3
- package/themes/single-business/src/components/MomentOption/index.tsx +41 -72
- package/themes/single-business/src/components/MomentOption/styles.tsx +12 -13
- package/themes/single-business/src/components/OrderTypeSelector/index.tsx +39 -5
- package/themes/single-business/src/types/index.tsx +3 -0
package/package.json
CHANGED
|
@@ -170,7 +170,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
170
170
|
? t('SEARCH_REDIRECT', 'Go to Businesses')
|
|
171
171
|
: t('CLEAR_FILTERS', 'Clear filters')
|
|
172
172
|
}
|
|
173
|
-
onClickButton={() =>
|
|
173
|
+
onClickButton={props.isSingleBusiness ? null : () =>
|
|
174
174
|
!searchValue
|
|
175
175
|
? handleSearchRedirect && handleSearchRedirect()
|
|
176
176
|
: handleCancelSearch && handleCancelSearch()
|
|
@@ -244,6 +244,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
244
244
|
{ id: 'featured', name: t('FEATURED', 'Featured') },
|
|
245
245
|
...business?.categories.sort((a: any, b: any) => a.rank - b.rank)
|
|
246
246
|
]}
|
|
247
|
+
isSingleBusiness={props.isSingleBusiness}
|
|
247
248
|
category={categorySelected}
|
|
248
249
|
categoryState={categoryState}
|
|
249
250
|
businessId={business.id}
|
|
@@ -24,7 +24,11 @@ import { ProgressBar, TouchableRipple } from 'react-native-paper';
|
|
|
24
24
|
import moment from 'moment';
|
|
25
25
|
|
|
26
26
|
const BusinessReviewsUI = (props: BusinessReviewsParams) => {
|
|
27
|
-
const {
|
|
27
|
+
const {
|
|
28
|
+
reviewsList,
|
|
29
|
+
businessState,
|
|
30
|
+
handleChangeSearch,
|
|
31
|
+
} = props;
|
|
28
32
|
const [, t] = useLanguage();
|
|
29
33
|
const theme = useTheme();
|
|
30
34
|
const [orderState] = useOrder();
|
|
@@ -146,11 +150,13 @@ const BusinessReviewsUI = (props: BusinessReviewsParams) => {
|
|
|
146
150
|
</StarPointsView>
|
|
147
151
|
|
|
148
152
|
<ReviewSearchView>
|
|
149
|
-
|
|
153
|
+
<OInput
|
|
150
154
|
icon={theme.images.general.search}
|
|
151
155
|
inputStyle={{ fontSize: 14 }}
|
|
152
156
|
placeholder={t('SEARCH_REVIEWS', 'Search reviews')}
|
|
153
|
-
style={{ paddingStart: 0 }}
|
|
157
|
+
style={{ paddingStart: 0 }}
|
|
158
|
+
onChange={handleChangeSearch}
|
|
159
|
+
/>
|
|
154
160
|
</ReviewSearchView>
|
|
155
161
|
<ReviewProgressView>
|
|
156
162
|
<OText style={{ marginBottom: 6 }}>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { useState, useEffect
|
|
2
|
-
import moment
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import moment from 'moment';
|
|
3
3
|
import {
|
|
4
4
|
useLanguage,
|
|
5
5
|
useConfig,
|
|
@@ -9,19 +9,17 @@ import {
|
|
|
9
9
|
} from 'ordering-components/native';
|
|
10
10
|
import { useTheme } from 'styled-components/native';
|
|
11
11
|
import {
|
|
12
|
-
|
|
12
|
+
TouchableOpacity,
|
|
13
13
|
StyleSheet,
|
|
14
14
|
useWindowDimensions,
|
|
15
15
|
View,
|
|
16
16
|
} from 'react-native';
|
|
17
|
-
import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons';
|
|
18
17
|
import Spinner from 'react-native-loading-spinner-overlay';
|
|
19
18
|
import { MomentOptionParams } from '../../types';
|
|
20
19
|
import NavBar from '../NavBar';
|
|
21
20
|
import { OIcon, OText } from '../shared';
|
|
22
21
|
import { Container } from '../../layouts/Container';
|
|
23
22
|
import {
|
|
24
|
-
HeaderTitle,
|
|
25
23
|
WrapSelectOption,
|
|
26
24
|
Days,
|
|
27
25
|
Day,
|
|
@@ -30,7 +28,6 @@ import {
|
|
|
30
28
|
Hour,
|
|
31
29
|
WrapDelveryTime,
|
|
32
30
|
} from './styles';
|
|
33
|
-
import CalendarPicker from 'react-native-calendar-picker';
|
|
34
31
|
import { TouchableRipple } from 'react-native-paper';
|
|
35
32
|
|
|
36
33
|
const MomentOptionUI = (props: MomentOptionParams) => {
|
|
@@ -65,6 +62,8 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
65
62
|
paddingHorizontal: 12,
|
|
66
63
|
paddingVertical: 9,
|
|
67
64
|
marginBottom: 12,
|
|
65
|
+
marginHorizontal: 10,
|
|
66
|
+
marginTop: 10
|
|
68
67
|
},
|
|
69
68
|
dateWrap: {
|
|
70
69
|
marginTop: 40,
|
|
@@ -89,6 +88,9 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
89
88
|
const [{ configs }] = useConfig();
|
|
90
89
|
const [{ parseTime }] = useUtils();
|
|
91
90
|
const [orderState] = useOrder();
|
|
91
|
+
const { width } = useWindowDimensions();
|
|
92
|
+
|
|
93
|
+
const [toggleTime, setToggleTime] = useState(false);
|
|
92
94
|
const [optionSelected, setOptionSelected] = useState({
|
|
93
95
|
isAsap: false,
|
|
94
96
|
isSchedule: false,
|
|
@@ -97,9 +99,9 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
97
99
|
isLoading: 0,
|
|
98
100
|
isEditing: false,
|
|
99
101
|
});
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
const
|
|
102
|
+
const momento = moment(`${dateSelected} ${timeSelected}`, 'YYYY-MM-DD HH:mm').toDate();
|
|
103
|
+
const momentUnix = momento.getTime() / 1000;
|
|
104
|
+
const momentFormat = moment.unix(momentUnix).utc().format('YYYY-MM-DD HH:mm:ss');
|
|
103
105
|
|
|
104
106
|
const goToBack = () => navigation?.canGoBack() && navigation.goBack();
|
|
105
107
|
|
|
@@ -117,29 +119,6 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
117
119
|
handleChangeTime(time);
|
|
118
120
|
};
|
|
119
121
|
|
|
120
|
-
const momento = moment(
|
|
121
|
-
`${dateSelected} ${timeSelected}`,
|
|
122
|
-
'YYYY-MM-DD HH:mm',
|
|
123
|
-
).toDate();
|
|
124
|
-
const momentUnix = momento.getTime() / 1000;
|
|
125
|
-
const momentFormat = moment
|
|
126
|
-
.unix(momentUnix)
|
|
127
|
-
.utc()
|
|
128
|
-
.format('YYYY-MM-DD HH:mm:ss');
|
|
129
|
-
|
|
130
|
-
const getTwoChar = (ori: string) => {
|
|
131
|
-
return ori.substring(0, 2);
|
|
132
|
-
};
|
|
133
|
-
const weekDays = [
|
|
134
|
-
getTwoChar(t('SUNDAY_ABBREVIATION', 'Su')),
|
|
135
|
-
getTwoChar(t('MONDAY_ABBREVIATION', 'Mo')),
|
|
136
|
-
getTwoChar(t('TUESDAY_ABBREVIATION', 'Tu')),
|
|
137
|
-
getTwoChar(t('WEDNESDAY_ABBREVIATION', 'We')),
|
|
138
|
-
getTwoChar(t('THURSDAY_ABBREVIATION', 'Th')),
|
|
139
|
-
getTwoChar(t('FRIDAY_ABBREVIATION', 'Fr')),
|
|
140
|
-
getTwoChar(t('SATURDAY_ABBREVIATION', 'Sa')),
|
|
141
|
-
];
|
|
142
|
-
|
|
143
122
|
useEffect(() => {
|
|
144
123
|
if (orderState.options?.moment) {
|
|
145
124
|
setOptionSelected({ isAsap: false, isSchedule: true });
|
|
@@ -161,15 +140,6 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
161
140
|
}
|
|
162
141
|
}, [momentState.isLoading]);
|
|
163
142
|
|
|
164
|
-
const customDayHeaderStylesCallback = () => {
|
|
165
|
-
return {
|
|
166
|
-
textStyle: {
|
|
167
|
-
color: theme.colors.disabled,
|
|
168
|
-
fontSize: 12,
|
|
169
|
-
},
|
|
170
|
-
};
|
|
171
|
-
};
|
|
172
|
-
|
|
173
143
|
return (
|
|
174
144
|
<Container style={{ paddingLeft: 40, paddingRight: 40 }}>
|
|
175
145
|
<View style={{ paddingBottom: 10 }}>
|
|
@@ -200,7 +170,11 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
200
170
|
style={{ marginEnd: 24 }}
|
|
201
171
|
/>
|
|
202
172
|
)}
|
|
203
|
-
<OText
|
|
173
|
+
<OText
|
|
174
|
+
color={optionSelected.isAsap ? theme.colors.textNormal : theme.colors.disabled}
|
|
175
|
+
>
|
|
176
|
+
{t('ASAP_ABBREVIATION', 'ASAP') + ` (${moment().format('dddd, MMM D, yyyy h:mm A')} + delivery time)`}
|
|
177
|
+
</OText>
|
|
204
178
|
</WrapSelectOption>
|
|
205
179
|
<WrapSelectOption
|
|
206
180
|
onPress={() => setOptionSelected({ isAsap: false, isSchedule: true })}
|
|
@@ -228,36 +202,31 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
228
202
|
<View style={styles.dateLabel}>
|
|
229
203
|
<OText size={12} color={theme.colors.disabled}>{dateSelected}</OText>
|
|
230
204
|
</View>
|
|
231
|
-
<
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
dayLabelsWrapper={{ borderColor: theme.colors.clear }}
|
|
257
|
-
customDayHeaderStyles={customDayHeaderStylesCallback}
|
|
258
|
-
weekdays={weekDays}
|
|
259
|
-
selectedStartDate={momento}
|
|
260
|
-
/>
|
|
205
|
+
<Days>
|
|
206
|
+
{datesList.slice(0, 6).map((date: any, i: any) => {
|
|
207
|
+
const dateParts = date.split('-')
|
|
208
|
+
const _date = new Date(dateParts[0], dateParts[1] - 1, dateParts[2])
|
|
209
|
+
const dayName = t('DAY' + (_date.getDay() >= 1 ? _date.getDay() : 7)).substring(0, 3).toUpperCase()
|
|
210
|
+
const dayNumber = (_date.getDate() < 10 ? '0' : '') + _date.getDate()
|
|
211
|
+
return (
|
|
212
|
+
<TouchableOpacity
|
|
213
|
+
key={dayNumber}
|
|
214
|
+
style={{ paddingHorizontal: 10, paddingBottom: 10, paddingTop: 10, borderColor: 'transparent', borderWidth: 1 }}
|
|
215
|
+
>
|
|
216
|
+
<Day onPress={() => handleChangeDate(date)} style={{ width: (width * 0.25) - 108 }}>
|
|
217
|
+
<OText
|
|
218
|
+
style={styles.dayNameStyle}
|
|
219
|
+
color={(dateSelected === date && optionSelected.isSchedule) ? theme.colors.primary : theme.colors.textSecondary}
|
|
220
|
+
>{dayName}</OText>
|
|
221
|
+
<OText
|
|
222
|
+
size={20}
|
|
223
|
+
color={(dateSelected === date && optionSelected.isSchedule) ? theme.colors.primary : theme.colors.textSecondary}
|
|
224
|
+
>{dayNumber}</OText>
|
|
225
|
+
</Day>
|
|
226
|
+
</TouchableOpacity>
|
|
227
|
+
)
|
|
228
|
+
})}
|
|
229
|
+
</Days>
|
|
261
230
|
</View>
|
|
262
231
|
)}
|
|
263
232
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import styled
|
|
1
|
+
import styled from 'styled-components/native'
|
|
2
2
|
|
|
3
3
|
export const Container = styled.ScrollView`
|
|
4
4
|
flex: 1;
|
|
@@ -16,23 +16,22 @@ export const WrapSelectOption = styled.TouchableOpacity`
|
|
|
16
16
|
margin-vertical: 5px;
|
|
17
17
|
`
|
|
18
18
|
export const Days = styled.View`
|
|
19
|
-
|
|
19
|
+
display: flex;
|
|
20
20
|
flex-direction: row;
|
|
21
|
-
|
|
21
|
+
width: 100%;
|
|
22
|
+
align-items: center;
|
|
23
|
+
flex-wrap: wrap;
|
|
22
24
|
`
|
|
23
25
|
export const Day = styled.TouchableOpacity`
|
|
24
26
|
display: flex;
|
|
25
|
-
flex-direction: column;
|
|
26
|
-
align-items: center;
|
|
27
27
|
justify-content: center;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
`}
|
|
28
|
+
align-items: center;
|
|
29
|
+
padding-top: 10px;
|
|
30
|
+
border: 1px solid ${(props: any) => props.theme.colors.border};
|
|
31
|
+
text-transform: capitalize;
|
|
32
|
+
min-height: 60px;
|
|
33
|
+
min-width: 60px;
|
|
34
|
+
border-radius: 8px;
|
|
36
35
|
`
|
|
37
36
|
export const WrapHours = styled.ScrollView`
|
|
38
37
|
border-width: 1px;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react'
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
2
|
import {
|
|
3
3
|
OrderTypeControl,
|
|
4
4
|
useLanguage,
|
|
@@ -25,13 +25,14 @@ const OrderTypeSelectorUI = (props: OrderTypeSelectParams) => {
|
|
|
25
25
|
const theme = useTheme();
|
|
26
26
|
const [orderState] = useOrder();
|
|
27
27
|
const [, t] = useLanguage();
|
|
28
|
+
const [isTypeChanging, setTypeChanging] = useState(false);
|
|
28
29
|
const _orderTypes = orderTypes.filter((type: any) => configTypes?.includes(type.value));
|
|
29
30
|
|
|
30
31
|
const items = _orderTypes.map((type) => {
|
|
31
32
|
return {
|
|
32
33
|
value: type.value,
|
|
33
|
-
label:
|
|
34
|
-
description:
|
|
34
|
+
label: type.content,
|
|
35
|
+
description: type.description
|
|
35
36
|
}
|
|
36
37
|
})
|
|
37
38
|
|
|
@@ -40,9 +41,16 @@ const OrderTypeSelectorUI = (props: OrderTypeSelectParams) => {
|
|
|
40
41
|
const handleChangeOrderTypeCallback = (orderType: number) => {
|
|
41
42
|
if (!orderState.loading) {
|
|
42
43
|
handleChangeOrderType(orderType)
|
|
44
|
+
setTypeChanging(true)
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
47
|
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (isTypeChanging && !orderState.loading) {
|
|
50
|
+
typeSelected === orderState?.options?.type && goToBack()
|
|
51
|
+
}
|
|
52
|
+
}, [orderState, typeSelected]);
|
|
53
|
+
|
|
46
54
|
return (
|
|
47
55
|
<Wrapper>
|
|
48
56
|
<NavBar
|
|
@@ -81,11 +89,37 @@ const OrderTypeSelectorUI = (props: OrderTypeSelectParams) => {
|
|
|
81
89
|
}
|
|
82
90
|
|
|
83
91
|
export const OrderTypeSelector = (props: any) => {
|
|
84
|
-
|
|
92
|
+
const [, t] = useLanguage()
|
|
85
93
|
const orderTypeProps = {
|
|
86
94
|
...props,
|
|
87
95
|
UIComponent: OrderTypeSelectorUI,
|
|
88
|
-
orderTypes: props.
|
|
96
|
+
orderTypes: props.orderTypes || [
|
|
97
|
+
{
|
|
98
|
+
value: 1,
|
|
99
|
+
content: t('DELIVERY', 'Delivery'),
|
|
100
|
+
description: t('ORDERTYPE_DESCRIPTION_DELIVERY', 'Lorem ipsum dolor sit amet, consectetur.')
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
value: 2,
|
|
104
|
+
content: t('PICKUP', 'Pickup'),
|
|
105
|
+
description: t('ORDERTYPE_DESCRIPTION_PICKUP', 'Lorem ipsum dolor sit amet, consectetur.')
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
value: 3,
|
|
109
|
+
content: t('EAT_IN', 'Eat in'),
|
|
110
|
+
description: t('ORDERTYPE_DESCRIPTION_EATIN', 'Lorem ipsum dolor sit amet, consectetur.')
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
value: 4,
|
|
114
|
+
content: t('CURBSIDE', 'Curbside'),
|
|
115
|
+
description: t('ORDERTYPE_DESCRIPTION_CURBSIDE', 'Lorem ipsum dolor sit amet, consectetur.')
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
value: 5,
|
|
119
|
+
content: t('DRIVE_THRU', 'Drive thru'),
|
|
120
|
+
description: t('ORDERTYPE_DESCRIPTION_DRIVETHRU', 'Lorem ipsum dolor sit amet, consectetur.')
|
|
121
|
+
}
|
|
122
|
+
]
|
|
89
123
|
}
|
|
90
124
|
|
|
91
125
|
return <OrderTypeControl {...orderTypeProps} />
|
|
@@ -161,6 +161,7 @@ export interface BusinessProductsListingParams {
|
|
|
161
161
|
categorySelected: any;
|
|
162
162
|
handleSearchRedirect: any;
|
|
163
163
|
errorQuantityProducts?: boolean;
|
|
164
|
+
isSingleBusiness?: boolean;
|
|
164
165
|
isFranchiseApp?: boolean;
|
|
165
166
|
header?: any;
|
|
166
167
|
logo?: any;
|
|
@@ -207,6 +208,7 @@ export interface BusinessProductsListParams {
|
|
|
207
208
|
handleClearSearch?: (value: any) => {};
|
|
208
209
|
isBusinessLoading?: any,
|
|
209
210
|
errorQuantityProducts?: boolean,
|
|
211
|
+
isSingleBusiness?: boolean,
|
|
210
212
|
handleCancelSearch?: () => void
|
|
211
213
|
categoriesLayout?: any
|
|
212
214
|
setCategoriesLayout?: any
|
|
@@ -227,6 +229,7 @@ export interface BusinessInformationParams {
|
|
|
227
229
|
export interface BusinessReviewsParams {
|
|
228
230
|
businessState: { business: any, loading: boolean, error: null };
|
|
229
231
|
reviewsList: { reviews: any, loading: boolean, error: null };
|
|
232
|
+
handleChangeSearch: any;
|
|
230
233
|
}
|
|
231
234
|
export interface SearchBarParams {
|
|
232
235
|
searchValue?: any;
|