ordering-ui-react-native 0.11.22 → 0.11.26
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/BusinessTypeFilter/index.tsx +155 -105
- package/themes/business/src/components/OrdersOption/index.tsx +2 -0
- package/themes/business/src/components/PreviousOrders/index.tsx +13 -4
- package/themes/business/src/components/PreviousOrders/styles.tsx +6 -0
- package/themes/business/src/types/index.tsx +1 -0
- package/themes/doordash/src/components/BusinessTypeFilter/index.tsx +152 -84
- package/themes/doordash/src/components/BusinessTypeFilter/styles.tsx +1 -2
- package/themes/kiosk/src/components/BusinessMenu/index.tsx +1 -1
- package/themes/kiosk/src/components/BusinessProductsListing/index.tsx +6 -14
- package/themes/kiosk/src/components/Cart/index.tsx +75 -60
- package/themes/kiosk/src/components/Cart/styles.tsx +19 -1
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +6 -15
- package/themes/kiosk/src/components/LoginForm/index.tsx +1 -8
- package/themes/kiosk/src/components/PaymentOptions/index.tsx +2 -1
- package/themes/kiosk/src/components/shared/OCard.tsx +1 -1
- package/themes/kiosk/src/components/shared/OInput.tsx +4 -0
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +118 -44
- package/themes/original/src/components/BusinessTypeFilter/styles.tsx +4 -4
- package/themes/original/src/components/BusinessesListing/index.tsx +3 -0
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +122 -0
- package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +7 -0
- package/themes/original/src/types/index.tsx +4 -0
- package/themes/uber-eats/src/components/BusinessTypeFilter/index.tsx +151 -76
- package/themes/uber-eats/src/components/BusinessTypeFilter/styles.tsx +0 -9
|
@@ -1,22 +1,14 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react'
|
|
2
2
|
import { View, StyleSheet } from 'react-native'
|
|
3
|
-
import {
|
|
4
|
-
BusinessAndProductList,
|
|
5
|
-
useLanguage,
|
|
6
|
-
useOrder,
|
|
7
|
-
useSession,
|
|
8
|
-
useConfig,
|
|
9
|
-
useApi
|
|
10
|
-
} from 'ordering-components/native'
|
|
3
|
+
import { BusinessAndProductList, useLanguage } from 'ordering-components/native'
|
|
11
4
|
import Carousel from 'react-native-snap-carousel';
|
|
12
5
|
import { BusinessProductsListingParams, Business, Product } from '../../types'
|
|
13
|
-
import { OCard, OText } from '../shared'
|
|
6
|
+
import { OCard, OText, OIcon } from '../shared'
|
|
14
7
|
import GridContainer from '../../layouts/GridContainer'
|
|
15
8
|
import PromoCard from '../PromoCard';
|
|
16
9
|
import Spinner from 'react-native-loading-spinner-overlay';
|
|
17
10
|
import { LANDSCAPE, useDeviceOrientation } from '../../../../../src/hooks/DeviceOrientation';
|
|
18
11
|
import { useTheme } from 'styled-components/native';
|
|
19
|
-
import { OIcon } from '../shared';
|
|
20
12
|
|
|
21
13
|
const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
22
14
|
const {navigation, businessState} = props;
|
|
@@ -40,8 +32,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
40
32
|
});
|
|
41
33
|
|
|
42
34
|
const _renderTitle = (title: string): React.ReactElement => (
|
|
43
|
-
<View style={{paddingHorizontal: 20, paddingVertical:
|
|
44
|
-
<OText size={orientationState?.dimensions?.width * 0.
|
|
35
|
+
<View style={{paddingHorizontal: 20, paddingVertical: 15 }}>
|
|
36
|
+
<OText size={orientationState?.dimensions?.width * 0.022} weight="bold">
|
|
45
37
|
{title}
|
|
46
38
|
</OText>
|
|
47
39
|
</View>
|
|
@@ -69,7 +61,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
69
61
|
|
|
70
62
|
const _renderPromos = (): React.ReactElement => (
|
|
71
63
|
<>
|
|
72
|
-
{_renderTitle(t('
|
|
64
|
+
{_renderTitle(t('FEATURED', 'Featured'))}
|
|
73
65
|
<Carousel
|
|
74
66
|
keyExtractor={(item: any) => item.id}
|
|
75
67
|
ref={(c: any) => {
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
useValidationFields,
|
|
11
11
|
} from 'ordering-components/native';
|
|
12
12
|
|
|
13
|
-
import { CheckoutAction,
|
|
13
|
+
import { CheckoutAction, OrderTypeWrapper, FloatingLayout } from './styles';
|
|
14
14
|
|
|
15
15
|
import { OSBill, OSCoupon, OSTable } from '../OrderSummary/styles';
|
|
16
16
|
|
|
@@ -22,8 +22,8 @@ import CartItem from '../CartItem';
|
|
|
22
22
|
import NavBar from '../NavBar';
|
|
23
23
|
import { CouponControl } from '../CouponControl';
|
|
24
24
|
import { LANDSCAPE, PORTRAIT, useDeviceOrientation} from "../../../../../src/hooks/DeviceOrientation";
|
|
25
|
-
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
26
25
|
import { useCartBottomSheet } from '../../providers/CartBottomSheetProvider';
|
|
26
|
+
import { Container } from '../../../../../src/layouts/Container';
|
|
27
27
|
|
|
28
28
|
const CartUI = (props: any) => {
|
|
29
29
|
const {
|
|
@@ -91,16 +91,8 @@ const CartUI = (props: any) => {
|
|
|
91
91
|
const goToBack = () => navigation.goBack();
|
|
92
92
|
|
|
93
93
|
return (
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
|
|
97
|
-
>
|
|
98
|
-
<SafeAreaView style={{
|
|
99
|
-
flex: 1,
|
|
100
|
-
padding: 20,
|
|
101
|
-
backgroundColor: '#fff',
|
|
102
|
-
}}>
|
|
103
|
-
|
|
94
|
+
<>
|
|
95
|
+
<Container>
|
|
104
96
|
<NavBar
|
|
105
97
|
title={t('CONFIRM_YOUR_ORDER', 'Confirm your order')}
|
|
106
98
|
onActionLeft={goToBack}
|
|
@@ -141,29 +133,50 @@ const CartUI = (props: any) => {
|
|
|
141
133
|
/>
|
|
142
134
|
</OrderTypeWrapper>
|
|
143
135
|
|
|
144
|
-
<ScrollView
|
|
145
|
-
{
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
isCartPending={isCartPending}
|
|
149
|
-
isCartProduct
|
|
150
|
-
product={product}
|
|
151
|
-
changeQuantity={changeQuantity}
|
|
152
|
-
getProductMax={getProductMax}
|
|
153
|
-
offsetDisabled={offsetDisabled}
|
|
154
|
-
onDeleteProduct={handleDeleteClick}
|
|
155
|
-
onEditProduct={handleEditProduct}
|
|
156
|
-
/>
|
|
157
|
-
))}
|
|
158
|
-
</ScrollView>
|
|
159
|
-
|
|
160
|
-
<Actions
|
|
136
|
+
<ScrollView
|
|
137
|
+
nestedScrollEnabled={true}
|
|
138
|
+
showsVerticalScrollIndicator={false}
|
|
139
|
+
showsHorizontalScrollIndicator={false}
|
|
161
140
|
style={{
|
|
162
|
-
|
|
141
|
+
minHeight: orientationState?.dimensions?.height * 0.05,
|
|
142
|
+
maxHeight: orientationState?.dimensions?.height * 0.5,
|
|
163
143
|
}}
|
|
164
144
|
>
|
|
145
|
+
<View
|
|
146
|
+
style={{
|
|
147
|
+
display: 'flex',
|
|
148
|
+
flexDirection: 'column',
|
|
149
|
+
width: '100%',
|
|
150
|
+
opacity: 1
|
|
151
|
+
}}
|
|
152
|
+
>
|
|
153
|
+
{cart?.products?.length > 0 && cart?.products.map((product: any) => (
|
|
154
|
+
<CartItem
|
|
155
|
+
isCartProduct
|
|
156
|
+
key={product.code}
|
|
157
|
+
product={product}
|
|
158
|
+
isCartPending={isCartPending}
|
|
159
|
+
changeQuantity={changeQuantity}
|
|
160
|
+
getProductMax={getProductMax}
|
|
161
|
+
offsetDisabled={offsetDisabled}
|
|
162
|
+
onDeleteProduct={handleDeleteClick}
|
|
163
|
+
onEditProduct={handleEditProduct}
|
|
164
|
+
/>
|
|
165
|
+
))}
|
|
166
|
+
</View>
|
|
167
|
+
</ScrollView>
|
|
168
|
+
|
|
169
|
+
<View style={{ marginTop: 10 }}>
|
|
165
170
|
{cart?.valid_products && (
|
|
166
171
|
<OSBill>
|
|
172
|
+
<OSTable>
|
|
173
|
+
<OText>{t('SUBTOTAL', 'Subtotal')}</OText>
|
|
174
|
+
<OText>
|
|
175
|
+
{cart.business.tax_type === 1
|
|
176
|
+
? parsePrice((cart?.subtotal + cart?.tax) || 0)
|
|
177
|
+
: parsePrice(cart?.subtotal || 0)}
|
|
178
|
+
</OText>
|
|
179
|
+
</OSTable>
|
|
167
180
|
{cart?.discount > 0 && cart?.total >= 0 && orientationState?.orientation == PORTRAIT && (
|
|
168
181
|
<OSTable
|
|
169
182
|
style={{
|
|
@@ -260,19 +273,21 @@ const CartUI = (props: any) => {
|
|
|
260
273
|
</OSCoupon>
|
|
261
274
|
</OSTable>
|
|
262
275
|
)}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
{/* </OText>*/}
|
|
272
|
-
{/* </OSTable>*/}
|
|
273
|
-
{/*</OSTotal>*/}
|
|
276
|
+
<OSTable>
|
|
277
|
+
<OText weight='bold'>
|
|
278
|
+
{t('TOTAL', 'Total')}
|
|
279
|
+
</OText>
|
|
280
|
+
<OText weight='bold' color={theme.colors.primary}>
|
|
281
|
+
{cart?.total >= 1 && parsePrice(cart?.total)}
|
|
282
|
+
</OText>
|
|
283
|
+
</OSTable>
|
|
274
284
|
</OSBill>
|
|
275
285
|
)}
|
|
286
|
+
</View>
|
|
287
|
+
</Container>
|
|
288
|
+
|
|
289
|
+
<>
|
|
290
|
+
<FloatingLayout isIos={Platform.OS === 'ios'}>
|
|
276
291
|
<CheckoutAction>
|
|
277
292
|
<View style={{display: 'flex', flexDirection: 'row'}}>
|
|
278
293
|
{cart?.discount > 0 && cart?.total >= 0 && orientationState?.orientation == LANDSCAPE && (
|
|
@@ -337,7 +352,7 @@ const CartUI = (props: any) => {
|
|
|
337
352
|
}}>
|
|
338
353
|
<OButton
|
|
339
354
|
text={(cart?.subtotal >= cart?.minimum || !cart?.minimum) && cart?.valid_address ? (
|
|
340
|
-
`${t('
|
|
355
|
+
`${t('CONFIRM_THIS_ORDER', 'Confirm this order')}`
|
|
341
356
|
) : !cart?.valid_address ? (
|
|
342
357
|
`${t('OUT_OF_COVERAGE', 'Out of Coverage')}`
|
|
343
358
|
) : (
|
|
@@ -354,27 +369,27 @@ const CartUI = (props: any) => {
|
|
|
354
369
|
</View>
|
|
355
370
|
</View>
|
|
356
371
|
</CheckoutAction>
|
|
357
|
-
</
|
|
372
|
+
</FloatingLayout>
|
|
373
|
+
</>
|
|
358
374
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
375
|
+
<OModal
|
|
376
|
+
open={openProduct}
|
|
377
|
+
entireModal
|
|
378
|
+
customClose
|
|
379
|
+
onClose={() => setModalIsOpen(false)}
|
|
380
|
+
>
|
|
381
|
+
<ProductForm
|
|
382
|
+
productCart={curProduct}
|
|
383
|
+
businessSlug={cart?.business?.slug}
|
|
384
|
+
businessId={curProduct?.business_id}
|
|
385
|
+
categoryId={curProduct?.category_id}
|
|
386
|
+
productId={curProduct?.id}
|
|
387
|
+
onSave={handlerProductAction}
|
|
363
388
|
onClose={() => setModalIsOpen(false)}
|
|
364
|
-
|
|
365
|
-
<ProductForm
|
|
366
|
-
productCart={curProduct}
|
|
367
|
-
businessSlug={cart?.business?.slug}
|
|
368
|
-
businessId={curProduct?.business_id}
|
|
369
|
-
categoryId={curProduct?.category_id}
|
|
370
|
-
productId={curProduct?.id}
|
|
371
|
-
onSave={handlerProductAction}
|
|
372
|
-
onClose={() => setModalIsOpen(false)}
|
|
373
|
-
/>
|
|
389
|
+
/>
|
|
374
390
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
</KeyboardView>
|
|
391
|
+
</OModal>
|
|
392
|
+
</>
|
|
378
393
|
)
|
|
379
394
|
}
|
|
380
395
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import styled from 'styled-components/native';
|
|
1
|
+
import styled, { css } from 'styled-components/native';
|
|
2
2
|
|
|
3
3
|
export const CContainer = styled.View`
|
|
4
4
|
padding: 0 20px;
|
|
@@ -50,3 +50,21 @@ export const OrderTypeWrapper = styled.View`
|
|
|
50
50
|
border-bottom-width: 1px;
|
|
51
51
|
margin-bottom: 30px;
|
|
52
52
|
`;
|
|
53
|
+
|
|
54
|
+
export const FloatingLayout = styled.View`
|
|
55
|
+
position: absolute;
|
|
56
|
+
flex: 1;
|
|
57
|
+
bottom: 0px;
|
|
58
|
+
left: 0;
|
|
59
|
+
padding: 10px;
|
|
60
|
+
width: 100%;
|
|
61
|
+
display: flex;
|
|
62
|
+
align-items: center;
|
|
63
|
+
justify-content: center;
|
|
64
|
+
background-color: #FFF;
|
|
65
|
+
z-index: 1000;
|
|
66
|
+
|
|
67
|
+
${((props: any) => props.isIos && css`
|
|
68
|
+
padding-bottom: 20px;
|
|
69
|
+
`)}
|
|
70
|
+
`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import { Platform, View } from 'react-native';
|
|
3
3
|
import { useLanguage, useOrder, useUtils } from 'ordering-components/native';
|
|
4
4
|
import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons'
|
|
@@ -87,7 +87,7 @@ const CategoriesMenu = (props: any): React.ReactElement => {
|
|
|
87
87
|
}}
|
|
88
88
|
>
|
|
89
89
|
<Container nopadding nestedScrollEnabled>
|
|
90
|
-
<View style={{
|
|
90
|
+
<View style={{ paddingTop: 20 }}>
|
|
91
91
|
<NavBar
|
|
92
92
|
title={t('CATEGORY', 'Category')}
|
|
93
93
|
onActionLeft={goToBack}
|
|
@@ -114,21 +114,12 @@ const CategoriesMenu = (props: any): React.ReactElement => {
|
|
|
114
114
|
items={categories.map((category) => ({
|
|
115
115
|
text: category.name
|
|
116
116
|
}))}
|
|
117
|
-
selectedIdx={curIndexCateg}
|
|
117
|
+
selectedIdx={curIndexCateg}
|
|
118
118
|
onSelectItem={onChangeTabs}
|
|
119
119
|
/>
|
|
120
120
|
</View>
|
|
121
|
-
|
|
122
|
-
<View style={{ paddingHorizontal: 20, paddingVertical: 8 }}>
|
|
123
|
-
<OText
|
|
124
|
-
size={orientationState?.dimensions?.width * 0.048}
|
|
125
|
-
weight="bold"
|
|
126
|
-
>
|
|
127
|
-
{categories[curIndexCateg].name}
|
|
128
|
-
</OText>
|
|
129
|
-
</View>
|
|
130
121
|
|
|
131
|
-
<GridContainer>
|
|
122
|
+
<GridContainer style={{ marginTop: 20 }}>
|
|
132
123
|
{categories[curIndexCateg].products.map((product) => (
|
|
133
124
|
<OCard
|
|
134
125
|
key={product.id}
|
|
@@ -137,7 +128,7 @@ const CategoriesMenu = (props: any): React.ReactElement => {
|
|
|
137
128
|
style={{
|
|
138
129
|
width: orientationState?.orientation === LANDSCAPE
|
|
139
130
|
? orientationState?.dimensions?.width * 0.16
|
|
140
|
-
: orientationState?.dimensions?.width * 0.21
|
|
131
|
+
: orientationState?.dimensions?.width * 0.21
|
|
141
132
|
}}
|
|
142
133
|
titleStyle={{marginTop: Platform.OS === 'ios' ? 10 : 0}}
|
|
143
134
|
onPress={() => {
|
|
@@ -156,7 +147,7 @@ const CategoriesMenu = (props: any): React.ReactElement => {
|
|
|
156
147
|
</Container>
|
|
157
148
|
</View>
|
|
158
149
|
|
|
159
|
-
{bottomSheetVisibility &&
|
|
150
|
+
{bottomSheetVisibility &&
|
|
160
151
|
(<View
|
|
161
152
|
style={{
|
|
162
153
|
flex: bottomSheetVisibility && orientationState?.orientation === PORTRAIT ? 0 : 0.8,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
3
|
import { useForm, Controller } from 'react-hook-form';
|
|
4
4
|
import { useTheme } from 'styled-components/native';
|
|
5
5
|
|
|
@@ -22,7 +22,6 @@ import { LANDSCAPE, PORTRAIT, useDeviceOrientation } from '../../../../../src/ho
|
|
|
22
22
|
const LoginFormUI = (props: LoginParams) => {
|
|
23
23
|
const {
|
|
24
24
|
loginButtonText,
|
|
25
|
-
forgotButtonText,
|
|
26
25
|
formState,
|
|
27
26
|
handleButtonLoginClick,
|
|
28
27
|
} = props;
|
|
@@ -161,12 +160,6 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
161
160
|
style={{ borderRadius: 0 }}
|
|
162
161
|
textStyle={{ fontSize: 24 }}
|
|
163
162
|
/>
|
|
164
|
-
|
|
165
|
-
<Pressable>
|
|
166
|
-
<OText size={24} mBottom={18} style={styles.forgotStyle}>
|
|
167
|
-
{forgotButtonText}
|
|
168
|
-
</OText>
|
|
169
|
-
</Pressable>
|
|
170
163
|
</>
|
|
171
164
|
);
|
|
172
165
|
|
|
@@ -83,7 +83,8 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
83
83
|
}
|
|
84
84
|
}, [isOpenMethod.paymethod, placing, isLoading, paySelected]);
|
|
85
85
|
|
|
86
|
-
const includePaymethods = ['cash', 'card_delivery', 'stripe'];
|
|
86
|
+
// const includePaymethods = ['cash', 'card_delivery', 'stripe'];
|
|
87
|
+
const includePaymethods = ['cash', 'card_delivery'];
|
|
87
88
|
|
|
88
89
|
const supportedMethods = paymethodsList.paymethods.filter((p: any) =>
|
|
89
90
|
includePaymethods.includes(p.gateway),
|
|
@@ -54,6 +54,8 @@ interface Props {
|
|
|
54
54
|
onSubmitEditing?: any;
|
|
55
55
|
blurOnSubmit?: boolean;
|
|
56
56
|
inputStyle?: TextInputProps
|
|
57
|
+
onFocus?: TextInputProps
|
|
58
|
+
onBlur?: TextInputProps
|
|
57
59
|
}
|
|
58
60
|
|
|
59
61
|
const OInput = (props: Props): React.ReactElement => {
|
|
@@ -93,6 +95,8 @@ const OInput = (props: Props): React.ReactElement => {
|
|
|
93
95
|
returnKeyType={props.returnKeyType}
|
|
94
96
|
onSubmitEditing={props.onSubmitEditing}
|
|
95
97
|
blurOnSubmit={props.blurOnSubmit}
|
|
98
|
+
onFocus={props.onFocus}
|
|
99
|
+
onBlur={props.onBlur}
|
|
96
100
|
/>
|
|
97
101
|
{props.iconRight && (
|
|
98
102
|
<OIcon
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
StyleSheet,
|
|
4
4
|
FlatList,
|
|
5
5
|
View,
|
|
6
6
|
ScrollView,
|
|
7
7
|
TouchableOpacity,
|
|
8
|
+
Dimensions
|
|
8
9
|
} from 'react-native';
|
|
9
10
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
10
11
|
import {
|
|
@@ -13,20 +14,22 @@ import {
|
|
|
13
14
|
} from 'ordering-components/native';
|
|
14
15
|
import { useTheme } from 'styled-components/native';
|
|
15
16
|
import {
|
|
16
|
-
BusinessCategoriesTitle,
|
|
17
17
|
BusinessCategories,
|
|
18
18
|
Category,
|
|
19
19
|
BCContainer,
|
|
20
20
|
} from './styles';
|
|
21
|
-
import { OIcon, OText } from '../shared';
|
|
21
|
+
import { OIcon, OText, OModal } from '../shared';
|
|
22
22
|
import { BusinessTypeFilterParams } from '../../types';
|
|
23
23
|
|
|
24
|
+
const windowWidth = Dimensions.get('window').width;
|
|
25
|
+
|
|
24
26
|
export const BusinessTypeFilterUI = (props: BusinessTypeFilterParams) => {
|
|
25
27
|
const { typesState, currentTypeSelected, handleChangeBusinessType } = props;
|
|
26
28
|
|
|
27
29
|
const [, t] = useLanguage();
|
|
28
30
|
|
|
29
31
|
const theme = useTheme();
|
|
32
|
+
const [isOpenAllCategories, setIsOpenAllCategories] = useState(false)
|
|
30
33
|
|
|
31
34
|
const renderTypes = ({ item }: any) => {
|
|
32
35
|
return (
|
|
@@ -36,7 +39,7 @@ export const BusinessTypeFilterUI = (props: BusinessTypeFilterParams) => {
|
|
|
36
39
|
style={{
|
|
37
40
|
height: 34,
|
|
38
41
|
justifyContent: 'center',
|
|
39
|
-
borderBottomWidth: 1,
|
|
42
|
+
borderBottomWidth: currentTypeSelected === item.id ? 1 : 0,
|
|
40
43
|
borderBottomColor: currentTypeSelected === item.id ? theme.colors.textNormal : theme.colors.border,
|
|
41
44
|
}}>
|
|
42
45
|
<OText
|
|
@@ -58,45 +61,99 @@ export const BusinessTypeFilterUI = (props: BusinessTypeFilterParams) => {
|
|
|
58
61
|
};
|
|
59
62
|
|
|
60
63
|
return (
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
<
|
|
65
|
-
<
|
|
66
|
-
|
|
67
|
-
showsVerticalScrollIndicator={false}
|
|
68
|
-
showsHorizontalScrollIndicator={false}>
|
|
69
|
-
{[...Array(4)].map((_, i) => (
|
|
70
|
-
<View
|
|
71
|
-
key={i}
|
|
72
|
-
style={{ width: 80, borderRadius: 10, marginRight: 15 }}>
|
|
73
|
-
<PlaceholderLine height={80} noMargin />
|
|
74
|
-
</View>
|
|
75
|
-
))}
|
|
76
|
-
</ScrollView>
|
|
77
|
-
</Placeholder>
|
|
78
|
-
</View>
|
|
79
|
-
)}
|
|
80
|
-
{!typesState?.loading &&
|
|
81
|
-
!typesState?.error &&
|
|
82
|
-
typesState?.types &&
|
|
83
|
-
typesState?.types.length > 0 && (
|
|
84
|
-
<>
|
|
85
|
-
<BusinessCategoriesTitle>
|
|
86
|
-
|
|
87
|
-
</BusinessCategoriesTitle>
|
|
88
|
-
<BusinessCategories>
|
|
89
|
-
<FlatList
|
|
64
|
+
<>
|
|
65
|
+
<BCContainer>
|
|
66
|
+
{typesState?.loading && (
|
|
67
|
+
<View>
|
|
68
|
+
<Placeholder style={{ marginVertical: 10 }} Animation={Fade}>
|
|
69
|
+
<ScrollView
|
|
90
70
|
horizontal
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
71
|
+
showsVerticalScrollIndicator={false}
|
|
72
|
+
showsHorizontalScrollIndicator={false}>
|
|
73
|
+
{[...Array(4)].map((_, i) => (
|
|
74
|
+
<View
|
|
75
|
+
key={i}
|
|
76
|
+
style={{ width: 80, borderRadius: 10, marginRight: 15 }}>
|
|
77
|
+
<PlaceholderLine height={80} noMargin />
|
|
78
|
+
</View>
|
|
79
|
+
))}
|
|
80
|
+
</ScrollView>
|
|
81
|
+
</Placeholder>
|
|
82
|
+
</View>
|
|
98
83
|
)}
|
|
99
|
-
|
|
84
|
+
{!typesState?.loading &&
|
|
85
|
+
!typesState?.error &&
|
|
86
|
+
typesState?.types &&
|
|
87
|
+
typesState?.types.length > 0 && (
|
|
88
|
+
<>
|
|
89
|
+
<BusinessCategories>
|
|
90
|
+
<FlatList
|
|
91
|
+
horizontal
|
|
92
|
+
showsHorizontalScrollIndicator={false}
|
|
93
|
+
data={typesState?.types}
|
|
94
|
+
renderItem={renderTypes}
|
|
95
|
+
keyExtractor={(type) => type.name}
|
|
96
|
+
/>
|
|
97
|
+
<TouchableOpacity
|
|
98
|
+
style={{ marginLeft: 15 }}
|
|
99
|
+
onPress={() => setIsOpenAllCategories(true)}
|
|
100
|
+
>
|
|
101
|
+
<OText size={12} color={theme.colors.primary}>{t('SEE_ALL', 'See All')}</OText>
|
|
102
|
+
</TouchableOpacity>
|
|
103
|
+
</BusinessCategories>
|
|
104
|
+
</>
|
|
105
|
+
)}
|
|
106
|
+
</BCContainer>
|
|
107
|
+
<OModal
|
|
108
|
+
open={isOpenAllCategories}
|
|
109
|
+
onClose={() => setIsOpenAllCategories(false)}
|
|
110
|
+
entireModal
|
|
111
|
+
>
|
|
112
|
+
<ScrollView style={styles.allCategoriesContainer}>
|
|
113
|
+
<OText
|
|
114
|
+
size={20}
|
|
115
|
+
mBottom={30}
|
|
116
|
+
color={theme.colors.textSecondary}
|
|
117
|
+
style={{ paddingHorizontal: 10 }}
|
|
118
|
+
>
|
|
119
|
+
{t('ALL_CATEGORIES', 'All categories')}
|
|
120
|
+
</OText>
|
|
121
|
+
<View style={styles.allCategoriesWrapper}>
|
|
122
|
+
{typesState?.types.map((item: any) => (
|
|
123
|
+
<TouchableOpacity
|
|
124
|
+
key={item.id}
|
|
125
|
+
style={styles.categoryStyle}
|
|
126
|
+
onPress={() => {
|
|
127
|
+
handleChangeBusinessType(item.id)
|
|
128
|
+
isOpenAllCategories && setIsOpenAllCategories(false)
|
|
129
|
+
}}
|
|
130
|
+
>
|
|
131
|
+
{item.image ? (
|
|
132
|
+
<OIcon
|
|
133
|
+
url={item.image}
|
|
134
|
+
style={styles.logo}
|
|
135
|
+
/>
|
|
136
|
+
) : (
|
|
137
|
+
<OIcon
|
|
138
|
+
src={theme.images.categories.all}
|
|
139
|
+
style={styles.logo}
|
|
140
|
+
/>
|
|
141
|
+
)}
|
|
142
|
+
<OText
|
|
143
|
+
style={{ textAlign: 'center' }}
|
|
144
|
+
size={14}
|
|
145
|
+
color={currentTypeSelected === item.id ? theme.colors.primary : theme.colors.textSecondary}
|
|
146
|
+
numberOfLines={1}
|
|
147
|
+
ellipsizeMode='tail'
|
|
148
|
+
>
|
|
149
|
+
{t(`BUSINESS_TYPE_${item.name.replace(/\s/g, '_').toUpperCase()}`, item.name)}
|
|
150
|
+
</OText>
|
|
151
|
+
</TouchableOpacity>
|
|
152
|
+
))}
|
|
153
|
+
</View>
|
|
154
|
+
</ScrollView>
|
|
155
|
+
</OModal>
|
|
156
|
+
</>
|
|
100
157
|
);
|
|
101
158
|
};
|
|
102
159
|
|
|
@@ -105,13 +162,30 @@ const styles = StyleSheet.create({
|
|
|
105
162
|
padding: 10,
|
|
106
163
|
},
|
|
107
164
|
logo: {
|
|
108
|
-
width:
|
|
109
|
-
height:
|
|
165
|
+
width: windowWidth / 3 - 40,
|
|
166
|
+
height: windowWidth / 3 - 40,
|
|
110
167
|
marginBottom: 15,
|
|
111
|
-
borderRadius:
|
|
168
|
+
borderRadius: 8,
|
|
112
169
|
justifyContent: 'center',
|
|
113
170
|
alignItems: 'center',
|
|
114
171
|
},
|
|
172
|
+
categoryStyle: {
|
|
173
|
+
width: windowWidth / 3 - 40,
|
|
174
|
+
height: 150,
|
|
175
|
+
flexDirection: 'column',
|
|
176
|
+
justifyContent: 'center',
|
|
177
|
+
alignItems: 'center',
|
|
178
|
+
marginHorizontal: 10,
|
|
179
|
+
marginBottom: 40
|
|
180
|
+
},
|
|
181
|
+
allCategoriesContainer : {
|
|
182
|
+
paddingHorizontal: 30,
|
|
183
|
+
paddingVertical: 30
|
|
184
|
+
},
|
|
185
|
+
allCategoriesWrapper: {
|
|
186
|
+
flexDirection: 'row',
|
|
187
|
+
flexWrap: 'wrap',
|
|
188
|
+
}
|
|
115
189
|
});
|
|
116
190
|
|
|
117
191
|
export const BusinessTypeFilter = (props: BusinessTypeFilterParams) => {
|
|
@@ -7,17 +7,17 @@ export const BCContainer = styled.View`
|
|
|
7
7
|
text-align: center;
|
|
8
8
|
`
|
|
9
9
|
|
|
10
|
-
export const BusinessCategoriesTitle = styled.View`
|
|
11
|
-
flex: 1;
|
|
12
|
-
`
|
|
13
|
-
|
|
14
10
|
export const BusinessCategories = styled.View`
|
|
15
11
|
flex: 1;
|
|
16
12
|
display: flex;
|
|
17
13
|
flex-direction: row;
|
|
18
14
|
justify-content: space-between;
|
|
15
|
+
align-items: center;
|
|
19
16
|
margin: 10px 0px;
|
|
20
17
|
width: 100%;
|
|
18
|
+
min-height: 35px;
|
|
19
|
+
border-bottom-width: 1px;
|
|
20
|
+
border-bottom-color: ${(props: any) => props.theme.colors.border};
|
|
21
21
|
`
|
|
22
22
|
export const Category = styled.View`
|
|
23
23
|
height: 150px;
|
|
@@ -36,6 +36,7 @@ import { BusinessController } from '../BusinessController';
|
|
|
36
36
|
import { OrderTypeSelector } from '../OrderTypeSelector';
|
|
37
37
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
38
38
|
import { BusinessFeaturedController } from '../BusinessFeaturedController';
|
|
39
|
+
import { HighestRatedBusinesses } from '../HighestRatedBusinesses';
|
|
39
40
|
import { getTypesText } from '../../utils';
|
|
40
41
|
|
|
41
42
|
const PIXELS_TO_SCROLL = 1000;
|
|
@@ -252,6 +253,8 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
252
253
|
</FeaturedWrapper>
|
|
253
254
|
)}
|
|
254
255
|
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
|
|
256
|
+
<HighestRatedBusinesses onBusinessClick={handleBusinessClick} />
|
|
257
|
+
<View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
|
|
255
258
|
<ListWrapper>
|
|
256
259
|
<BusinessTypeFilter
|
|
257
260
|
images={props.images}
|