ordering-ui-react-native 0.12.14 → 0.12.18
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/AddressList/index.tsx +3 -1
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +168 -156
- package/themes/business/src/components/NewOrderNotification/index.tsx +14 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +3 -1
- package/themes/business/src/components/OrdersOption/index.tsx +19 -15
- package/themes/business/src/components 2/AcceptOrRejectOrder/index.tsx +389 -0
- package/themes/business/src/components 2/AcceptOrRejectOrder/styles.tsx +36 -0
- package/themes/business/src/components 2/BusinessController/index.tsx +155 -0
- package/themes/business/src/components 2/BusinessController/styles.tsx +19 -0
- package/themes/business/src/components 2/Chat/index.tsx +1152 -0
- package/themes/business/src/components 2/Chat/styles.tsx +12 -0
- package/themes/business/src/components 2/Contacts/index.tsx +299 -0
- package/themes/business/src/components 2/Contacts/styles.tsx +42 -0
- package/themes/business/src/components 2/DriverMap/index.tsx +525 -0
- package/themes/business/src/components 2/FloatingButton/index.tsx +141 -0
- package/themes/business/src/components 2/FloatingButton/styles.tsx +35 -0
- package/themes/business/src/components 2/ForgotPasswordForm/index.tsx +204 -0
- package/themes/business/src/components 2/ForgotPasswordForm/styles.tsx +11 -0
- package/themes/business/src/components 2/GoogleMap/index.tsx +347 -0
- package/themes/business/src/components 2/Home/index.tsx +111 -0
- package/themes/business/src/components 2/Home/styles.tsx +27 -0
- package/themes/business/src/components 2/LanguageSelector/index.tsx +124 -0
- package/themes/business/src/components 2/LanguageSelector/lang_country.json +152 -0
- package/themes/business/src/components 2/LanguageSelector/styles.tsx +17 -0
- package/themes/business/src/components 2/LoginForm/index.tsx +663 -0
- package/themes/business/src/components 2/LoginForm/styles.tsx +48 -0
- package/themes/business/src/components 2/LogoutButton/index.tsx +63 -0
- package/themes/business/src/components 2/MapView/index.tsx +317 -0
- package/themes/business/src/components 2/MessagesOption/index.tsx +337 -0
- package/themes/business/src/components 2/MessagesOption/styles.tsx +27 -0
- package/themes/business/src/components 2/NewOrderNotification/index.tsx +167 -0
- package/themes/business/src/components 2/NewOrderNotification/styles.tsx +8 -0
- package/themes/business/src/components 2/NotFoundSource/index.tsx +52 -0
- package/themes/business/src/components 2/NotFoundSource/styles.tsx +17 -0
- package/themes/business/src/components 2/OrderDetails/Business.tsx +683 -0
- package/themes/business/src/components 2/OrderDetails/Delivery.tsx +454 -0
- package/themes/business/src/components 2/OrderDetails/OrderContentComponent.tsx +391 -0
- package/themes/business/src/components 2/OrderDetails/OrderHeaderComponent.tsx +148 -0
- package/themes/business/src/components 2/OrderDetails/styles.tsx +84 -0
- package/themes/business/src/components 2/OrderMessage/index.tsx +344 -0
- package/themes/business/src/components 2/OrderMessage/styles.tsx +5 -0
- package/themes/business/src/components 2/OrderSummary/index.tsx +700 -0
- package/themes/business/src/components 2/OrderSummary/styles.tsx +61 -0
- package/themes/business/src/components 2/OrdersOption/index.tsx +755 -0
- package/themes/business/src/components 2/OrdersOption/styles.tsx +54 -0
- package/themes/business/src/components 2/OrdersOptionBusiness/index.tsx +51 -0
- package/themes/business/src/components 2/OrdersOptionBusiness/styles.tsx +8 -0
- package/themes/business/src/components 2/OrdersOptionCity/index.tsx +52 -0
- package/themes/business/src/components 2/OrdersOptionCity/styles.tsx +8 -0
- package/themes/business/src/components 2/OrdersOptionDate/index.tsx +52 -0
- package/themes/business/src/components 2/OrdersOptionDate/styles.tsx +8 -0
- package/themes/business/src/components 2/OrdersOptionDelivery/index.tsx +35 -0
- package/themes/business/src/components 2/OrdersOptionDelivery/styles.tsx +8 -0
- package/themes/business/src/components 2/OrdersOptionDriver/index.tsx +50 -0
- package/themes/business/src/components 2/OrdersOptionDriver/styles.tsx +8 -0
- package/themes/business/src/components 2/OrdersOptionPaymethod/index.tsx +49 -0
- package/themes/business/src/components 2/OrdersOptionPaymethod/styles.tsx +8 -0
- package/themes/business/src/components 2/OrdersOptionStatus/index.tsx +46 -0
- package/themes/business/src/components 2/OrdersOptionStatus/styles.tsx +8 -0
- package/themes/business/src/components 2/PhoneInputNumber/index.tsx +160 -0
- package/themes/business/src/components 2/PhoneInputNumber/styles.tsx +3 -0
- package/themes/business/src/components 2/PreviousMessages/index.tsx +304 -0
- package/themes/business/src/components 2/PreviousMessages/styles.tsx +32 -0
- package/themes/business/src/components 2/PreviousOrders/index.tsx +180 -0
- package/themes/business/src/components 2/PreviousOrders/styles.tsx +38 -0
- package/themes/business/src/components 2/ProductItemAccordion/index.tsx +301 -0
- package/themes/business/src/components 2/ProductItemAccordion/styles.tsx +61 -0
- package/themes/business/src/components 2/SearchBar/index.tsx +112 -0
- package/themes/business/src/components 2/SignupForm/index.tsx +530 -0
- package/themes/business/src/components 2/SignupForm/styles.tsx +16 -0
- package/themes/business/src/components 2/StoresList/index.tsx +208 -0
- package/themes/business/src/components 2/StoresList/styles.tsx +26 -0
- package/themes/business/src/components 2/UserFormDetails/index.tsx +513 -0
- package/themes/business/src/components 2/UserFormDetails/styles.tsx +40 -0
- package/themes/business/src/components 2/UserProfileForm/index.tsx +496 -0
- package/themes/business/src/components 2/UserProfileForm/styles.tsx +36 -0
- package/themes/business/src/components 2/VerifyPhone/index.tsx +201 -0
- package/themes/business/src/components 2/VerifyPhone/styles.tsx +43 -0
- package/themes/business/src/components 2/shared/OAlert.tsx +52 -0
- package/themes/business/src/components 2/shared/OButton.tsx +149 -0
- package/themes/business/src/components 2/shared/OChatBubble.tsx +100 -0
- package/themes/business/src/components 2/shared/ODropDown.tsx +195 -0
- package/themes/business/src/components 2/shared/ODropDownCalendar.tsx +328 -0
- package/themes/business/src/components 2/shared/OFab.tsx +54 -0
- package/themes/business/src/components 2/shared/OIcon.tsx +67 -0
- package/themes/business/src/components 2/shared/OIconButton.tsx +127 -0
- package/themes/business/src/components 2/shared/OInput.tsx +144 -0
- package/themes/business/src/components 2/shared/OLink.tsx +76 -0
- package/themes/business/src/components 2/shared/OModal.tsx +275 -0
- package/themes/business/src/components 2/shared/OSegment.tsx +86 -0
- package/themes/business/src/components 2/shared/OText.tsx +55 -0
- package/themes/business/src/components 2/shared/OTextarea.tsx +46 -0
- package/themes/business/src/components 2/shared/OToast.tsx +92 -0
- package/themes/business/src/components 2/shared/index.tsx +27 -0
- package/themes/business/src/types/index.tsx +4 -1
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +128 -83
- package/themes/kiosk/src/components/DrawerView/index.tsx +57 -0
- package/themes/kiosk/src/components/DrawerView/styles.tsx +30 -0
- package/themes/kiosk/src/components/LanguageSelector/index.tsx +78 -58
- package/themes/kiosk/src/components/OrderDetails/index.tsx +3 -1
- package/themes/kiosk/src/components/ProductForm/index.tsx +129 -127
- package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +9 -6
- package/themes/original/src/components/OrderProgress/index.tsx +32 -18
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { View, StyleSheet, Dimensions } from 'react-native';
|
|
3
|
+
import { ScrollView } from 'react-native-gesture-handler';
|
|
4
|
+
import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
|
|
5
|
+
import NetInfo from '@react-native-community/netinfo';
|
|
6
|
+
import { useTheme } from 'styled-components/native';
|
|
7
|
+
import {
|
|
8
|
+
ToastType,
|
|
9
|
+
useToast,
|
|
10
|
+
useLanguage,
|
|
11
|
+
useOrder,
|
|
12
|
+
BusinessList,
|
|
13
|
+
} from 'ordering-components/native';
|
|
14
|
+
import { NotFoundSource } from '../NotFoundSource';
|
|
15
|
+
import { SearchBar } from '../SearchBar';
|
|
16
|
+
import { BusinessController } from '../BusinessController';
|
|
17
|
+
import { OText } from '../shared';
|
|
18
|
+
import { BusinessesListingParams } from '../../types';
|
|
19
|
+
|
|
20
|
+
const StoresListUI = (props: BusinessesListingParams) => {
|
|
21
|
+
const {
|
|
22
|
+
navigation,
|
|
23
|
+
businessesList,
|
|
24
|
+
searchValue,
|
|
25
|
+
getBusinesses,
|
|
26
|
+
handleChangeBusinessType,
|
|
27
|
+
handleBusinessClick,
|
|
28
|
+
paginationProps,
|
|
29
|
+
handleChangeSearch,
|
|
30
|
+
} = props;
|
|
31
|
+
|
|
32
|
+
const { loading, error, businesses } = businessesList;
|
|
33
|
+
const [isConnected, setIsConnected] = useState<boolean | null>(false);
|
|
34
|
+
|
|
35
|
+
NetInfo.fetch().then((state: any) => {
|
|
36
|
+
setIsConnected(state.isConnected);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const [, t] = useLanguage();
|
|
40
|
+
const [orderState] = useOrder();
|
|
41
|
+
const theme = useTheme();
|
|
42
|
+
const [, { showToast }] = useToast();
|
|
43
|
+
const [isUpdateStore, setIsUpdateStore] = useState(false);
|
|
44
|
+
|
|
45
|
+
const [loadBusinesses, setLoadBusinesses] = useState(loading);
|
|
46
|
+
const [orientation, setOrientation] = useState(
|
|
47
|
+
Dimensions.get('window').width < Dimensions.get('window').height
|
|
48
|
+
? 'Portrait'
|
|
49
|
+
: 'Landscape',
|
|
50
|
+
);
|
|
51
|
+
const [windowsHeight, setWindowsHeight] = useState(
|
|
52
|
+
parseInt(parseFloat(String(Dimensions.get('window').height)).toFixed(0)),
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
const handleScroll = ({ nativeEvent }: any) => {
|
|
56
|
+
const y = nativeEvent.contentOffset.y;
|
|
57
|
+
const height = nativeEvent.contentSize.height;
|
|
58
|
+
const hasMore = !(
|
|
59
|
+
paginationProps.totalPages === paginationProps.currentPage
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
if (y + windowsHeight > height && !businessesList?.loading && hasMore) {
|
|
63
|
+
setLoadBusinesses(true);
|
|
64
|
+
getBusinesses();
|
|
65
|
+
showToast(
|
|
66
|
+
ToastType.Info,
|
|
67
|
+
t('LOADING_MORE_BUSINESSES', 'Loading more businesses'),
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
if (error) {
|
|
73
|
+
showToast(
|
|
74
|
+
ToastType.Error,
|
|
75
|
+
error || error[0] || t('NETWORK_ERROR', 'Network Error'),
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (loadBusinesses && !loading) {
|
|
80
|
+
setLoadBusinesses(false);
|
|
81
|
+
}
|
|
82
|
+
}, [loading]);
|
|
83
|
+
|
|
84
|
+
Dimensions.addEventListener('change', ({ window: { width, height } }) => {
|
|
85
|
+
setWindowsHeight(
|
|
86
|
+
parseInt(parseFloat(String(Dimensions.get('window').width)).toFixed(0)),
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
if (width < height) {
|
|
90
|
+
setOrientation('Portrait');
|
|
91
|
+
} else {
|
|
92
|
+
setOrientation('Landscape');
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
const styles = StyleSheet.create({
|
|
97
|
+
container: {
|
|
98
|
+
paddingBottom: 20,
|
|
99
|
+
marginBottom: 0,
|
|
100
|
+
flex: 1,
|
|
101
|
+
},
|
|
102
|
+
header: {
|
|
103
|
+
flexDirection: 'row',
|
|
104
|
+
justifyContent: 'space-between',
|
|
105
|
+
marginBottom: 10,
|
|
106
|
+
},
|
|
107
|
+
sectionTitle: {
|
|
108
|
+
fontStyle: 'normal',
|
|
109
|
+
fontWeight: '600',
|
|
110
|
+
fontSize: 26,
|
|
111
|
+
color: theme.colors.textGray,
|
|
112
|
+
},
|
|
113
|
+
icons: {
|
|
114
|
+
flexDirection: 'row',
|
|
115
|
+
},
|
|
116
|
+
borderStyle: {
|
|
117
|
+
borderColor: theme.colors.red,
|
|
118
|
+
borderWidth: 0,
|
|
119
|
+
borderRadius: 10,
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
return (
|
|
124
|
+
<>
|
|
125
|
+
<View style={styles.header}>
|
|
126
|
+
<OText style={styles.sectionTitle}>{t('STORES', 'Stores')}</OText>
|
|
127
|
+
|
|
128
|
+
{isConnected && (
|
|
129
|
+
<View style={{ flexDirection: 'row', justifyContent: 'flex-end' }}>
|
|
130
|
+
<SearchBar
|
|
131
|
+
borderStyle={styles.borderStyle}
|
|
132
|
+
onSearch={handleChangeSearch}
|
|
133
|
+
searchValue={searchValue}
|
|
134
|
+
lazyLoad
|
|
135
|
+
isCancelXButtonShow={!!searchValue}
|
|
136
|
+
onCancel={() => handleChangeSearch('')}
|
|
137
|
+
placeholder={t('FIND_BUSINESS', 'Find a business')}
|
|
138
|
+
/>
|
|
139
|
+
</View>
|
|
140
|
+
)}
|
|
141
|
+
</View>
|
|
142
|
+
<ScrollView
|
|
143
|
+
showsVerticalScrollIndicator={false}
|
|
144
|
+
style={styles.container}
|
|
145
|
+
onScroll={(e: any) => handleScroll(e)}>
|
|
146
|
+
{!loading && !loadBusinesses && businesses?.length === 0 && (
|
|
147
|
+
<NotFoundSource
|
|
148
|
+
content={
|
|
149
|
+
!isConnected
|
|
150
|
+
? t('NETWORK_ERROR', 'Network Error')
|
|
151
|
+
: t('NO_RESULTS_FOUND', 'Sorry, no results found')
|
|
152
|
+
}
|
|
153
|
+
image={theme.images.general.notFound}
|
|
154
|
+
conditioned={false}
|
|
155
|
+
/>
|
|
156
|
+
)}
|
|
157
|
+
|
|
158
|
+
{!error &&
|
|
159
|
+
businesses?.map((business: any) => (
|
|
160
|
+
<BusinessController
|
|
161
|
+
key={business?.id}
|
|
162
|
+
business={business}
|
|
163
|
+
handleCustomClick={handleBusinessClick}
|
|
164
|
+
orderType={orderState?.options?.type}
|
|
165
|
+
isBusinessOpen={business?.open}
|
|
166
|
+
setIsUpdateStore={setIsUpdateStore}
|
|
167
|
+
isUpdateStore={isUpdateStore}
|
|
168
|
+
/>
|
|
169
|
+
))}
|
|
170
|
+
|
|
171
|
+
{(loading || loadBusinesses) && isConnected && (
|
|
172
|
+
<View>
|
|
173
|
+
{[...Array(6)].map((item, i) => (
|
|
174
|
+
<Placeholder key={i} Animation={Fade}>
|
|
175
|
+
<View
|
|
176
|
+
style={{ flex: 1, flexDirection: 'row', marginBottom: 10 }}>
|
|
177
|
+
<PlaceholderLine
|
|
178
|
+
width={orientation === 'Portrait' ? 22 : 11}
|
|
179
|
+
height={74}
|
|
180
|
+
style={{
|
|
181
|
+
marginRight: 20,
|
|
182
|
+
marginBottom: 20,
|
|
183
|
+
borderRadius: 7.6,
|
|
184
|
+
}}
|
|
185
|
+
/>
|
|
186
|
+
<Placeholder>
|
|
187
|
+
<PlaceholderLine width={30} style={{ marginTop: 5 }} />
|
|
188
|
+
<PlaceholderLine width={50} />
|
|
189
|
+
<PlaceholderLine width={20} />
|
|
190
|
+
</Placeholder>
|
|
191
|
+
</View>
|
|
192
|
+
</Placeholder>
|
|
193
|
+
))}
|
|
194
|
+
</View>
|
|
195
|
+
)}
|
|
196
|
+
</ScrollView>
|
|
197
|
+
</>
|
|
198
|
+
);
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
export const StoresList = (props: BusinessesListingParams) => {
|
|
202
|
+
const BusinessesListProps = {
|
|
203
|
+
...props,
|
|
204
|
+
UIComponent: StoresListUI,
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
return <BusinessList {...BusinessesListProps} />;
|
|
208
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import styled from 'styled-components/native';
|
|
2
|
+
|
|
3
|
+
export const OptionTitle = styled.View``;
|
|
4
|
+
|
|
5
|
+
export const FiltersTab = styled.View`
|
|
6
|
+
margin-bottom: 15px;
|
|
7
|
+
`;
|
|
8
|
+
|
|
9
|
+
export const OTabs = styled.View`
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: row;
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
export const TagsContainer = styled.ScrollView`
|
|
15
|
+
margin-bottom: 10px;
|
|
16
|
+
`;
|
|
17
|
+
|
|
18
|
+
export const Tag = styled.Pressable`
|
|
19
|
+
background-color: ${({ isSelected }: { isSelected: string }) => isSelected};
|
|
20
|
+
justify-content: center;
|
|
21
|
+
align-items: center;
|
|
22
|
+
min-height: 34px;
|
|
23
|
+
padding: 4px 10px;
|
|
24
|
+
border-radius: 50px;
|
|
25
|
+
margin-right: 15px;
|
|
26
|
+
`;
|