ordering-ui-react-native 0.16.21 → 0.16.22-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 +7 -4
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/ActiveOrders/index.tsx +61 -63
- package/src/components/ActiveOrders/styles.tsx +8 -14
- package/src/components/AddressForm/index.tsx +18 -2
- package/src/components/BusinessBasicInformation/index.tsx +11 -19
- package/src/components/BusinessController/index.tsx +10 -8
- package/src/components/BusinessInformation/index.tsx +33 -4
- package/src/components/BusinessInformation/styles.tsx +2 -2
- package/src/components/BusinessProductsList/index.tsx +10 -10
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/Checkout/index.tsx +2 -1
- package/src/components/LanguageSelector/index.tsx +21 -16
- package/src/components/LoginForm/index.tsx +118 -30
- package/src/components/LoginForm/styles.tsx +6 -0
- package/src/components/Messages/index.tsx +2 -2
- package/src/components/NotificationSetting/index.tsx +85 -0
- package/src/components/OrderDetails/index.tsx +2 -20
- package/src/components/OrdersOption/index.tsx +54 -56
- package/src/components/PaymentOptions/index.tsx +335 -365
- package/src/components/PaymentOptionsWebView/index.tsx +120 -121
- package/src/components/ReviewDriver/index.tsx +1 -1
- package/src/components/ReviewOrder/index.tsx +2 -1
- package/src/components/ReviewProducts/index.tsx +11 -0
- package/src/components/SignupForm/index.tsx +143 -61
- package/src/components/SingleProductReview/index.tsx +8 -5
- package/src/components/StripeElementsForm/index.tsx +25 -16
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OBottomPopup.tsx +6 -2
- package/src/index.tsx +2 -0
- package/src/pages/BusinessesListing.tsx +7 -6
- package/src/pages/OrderDetails.tsx +1 -1
- package/src/pages/ReviewDriver.tsx +2 -2
- package/src/pages/ReviewOrder.tsx +2 -2
- package/src/theme.json +0 -1
- package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
- package/src/types/index.tsx +13 -9
- package/src/utils/index.tsx +0 -1
- package/themes/business/index.tsx +4 -0
- package/themes/business/src/components/BusinessController/index.tsx +2 -2
- package/themes/business/src/components/Chat/index.tsx +42 -34
- package/themes/business/src/components/DriverMap/index.tsx +7 -5
- package/themes/business/src/components/DriverSchedule/index.tsx +71 -0
- package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
- package/themes/business/src/components/LoginForm/index.tsx +111 -74
- package/themes/business/src/components/MapView/index.tsx +12 -1
- package/themes/business/src/components/MessagesOption/index.tsx +11 -1
- package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +3 -3
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +25 -19
- package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
- package/themes/business/src/components/OrdersOption/index.tsx +65 -21
- package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
- package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
- package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
- package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
- package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
- package/themes/business/src/components/PreviousOrders/index.tsx +21 -23
- package/themes/business/src/components/ProductItemAccordion/index.tsx +5 -4
- package/themes/business/src/components/ReviewCustomer/index.tsx +1 -1
- package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
- package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
- package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
- package/themes/business/src/components/shared/ODropDown.tsx +42 -8
- package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
- package/themes/business/src/components/shared/OModal.tsx +40 -37
- package/themes/business/src/types/index.tsx +15 -9
- package/themes/business/src/utils/index.tsx +10 -0
- package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/kiosk/src/components/BusinessMenu/index.tsx +2 -1
- package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +1 -0
- package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
- package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
- package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
- package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
- package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
- package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/kiosk/src/types/index.d.ts +2 -0
- package/themes/original/index.tsx +12 -0
- package/themes/original/src/components/AddressForm/index.tsx +136 -133
- package/themes/original/src/components/AddressList/index.tsx +1 -1
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +302 -160
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
- package/themes/original/src/components/BusinessController/index.tsx +173 -108
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +8 -6
- package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
- package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
- package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
- package/themes/original/src/components/BusinessListingSearch/index.tsx +106 -126
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +18 -13
- package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
- package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
- package/themes/original/src/components/BusinessProductsList/index.tsx +49 -52
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +287 -175
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -8
- package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +109 -40
- package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +561 -0
- package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -10
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +676 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
- package/themes/original/src/components/BusinessesListing/index.tsx +105 -519
- package/themes/original/src/components/Cart/index.tsx +42 -10
- package/themes/original/src/components/Cart/styles.tsx +4 -0
- package/themes/original/src/components/CartContent/index.tsx +22 -16
- package/themes/original/src/components/Checkout/index.tsx +106 -66
- package/themes/original/src/components/Checkout/styles.tsx +0 -1
- package/themes/original/src/components/DriverTips/index.tsx +4 -4
- package/themes/original/src/components/DriverTips/styles.tsx +2 -1
- package/themes/original/src/components/Favorite/index.tsx +1 -0
- package/themes/original/src/components/Favorite/styles.tsx +1 -0
- package/themes/original/src/components/FavoriteList/index.tsx +142 -93
- package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
- package/themes/original/src/components/GPSButton/index.tsx +20 -19
- package/themes/original/src/components/GoogleMap/index.tsx +20 -12
- package/themes/original/src/components/HelpAccountAndPayment/index.tsx +8 -3
- package/themes/original/src/components/HelpGuide/index.tsx +8 -3
- package/themes/original/src/components/HelpOrder/index.tsx +8 -3
- package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
- package/themes/original/src/components/LoginForm/Otp/index.tsx +3 -2
- package/themes/original/src/components/LoginForm/index.tsx +82 -44
- package/themes/original/src/components/Messages/index.tsx +17 -17
- package/themes/original/src/components/MomentSelector/index.tsx +197 -0
- package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
- package/themes/original/src/components/MultiCheckout/index.tsx +6 -0
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -16
- package/themes/original/src/components/MyOrders/index.tsx +68 -6
- package/themes/original/src/components/NavBar/index.tsx +15 -9
- package/themes/original/src/components/NetworkError/index.tsx +5 -3
- package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
- package/themes/original/src/components/Notifications/index.tsx +148 -0
- package/themes/original/src/components/Notifications/styles.tsx +17 -0
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
- package/themes/original/src/components/OrderDetails/index.tsx +200 -42
- package/themes/original/src/components/OrderDetails/styles.tsx +15 -2
- package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
- package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
- package/themes/original/src/components/OrderProgress/index.tsx +8 -2
- package/themes/original/src/components/OrderSummary/index.tsx +1 -34
- package/themes/original/src/components/OrderTypeSelector/index.tsx +85 -36
- package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +100 -106
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +17 -12
- package/themes/original/src/components/OrdersOption/index.tsx +71 -55
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +57 -37
- package/themes/original/src/components/PhoneInputNumber/index.tsx +4 -10
- package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
- package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
- package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
- package/themes/original/src/components/ProductForm/index.tsx +712 -655
- package/themes/original/src/components/ProductForm/styles.tsx +9 -7
- package/themes/original/src/components/ProductItemAccordion/index.tsx +198 -127
- package/themes/original/src/components/ProductOption/index.tsx +1 -1
- package/themes/original/src/components/ProfessionalFilter/index.tsx +129 -0
- package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
- package/themes/original/src/components/ProfessionalProfile/index.tsx +309 -0
- package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
- package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
- package/themes/original/src/components/ReviewOrder/index.tsx +18 -3
- package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
- package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
- package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
- package/themes/original/src/components/SearchBar/index.tsx +5 -3
- package/themes/original/src/components/ServiceForm/index.tsx +631 -0
- package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
- package/themes/original/src/components/SignupForm/index.tsx +350 -206
- package/themes/original/src/components/SingleOrderCard/index.tsx +214 -179
- package/themes/original/src/components/SingleProductCard/index.tsx +194 -108
- package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
- package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
- package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
- package/themes/original/src/components/StripeElementsForm/index.tsx +15 -7
- package/themes/original/src/components/UpsellingProducts/index.tsx +14 -4
- package/themes/original/src/components/UserDetails/index.tsx +31 -17
- package/themes/original/src/components/UserFormDetails/index.tsx +74 -81
- package/themes/original/src/components/UserProfile/index.tsx +57 -29
- package/themes/original/src/components/UserProfile/styles.ts +17 -0
- package/themes/original/src/components/UserProfileForm/index.tsx +15 -10
- package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
- package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
- package/themes/original/src/components/Wallets/index.tsx +174 -162
- package/themes/original/src/components/Wallets/styles.tsx +10 -8
- package/themes/original/src/components/shared/OBottomPopup.tsx +47 -14
- package/themes/original/src/components/shared/OButton.tsx +10 -3
- package/themes/original/src/components/shared/OIcon.tsx +8 -1
- package/themes/original/src/components/shared/OInput.tsx +3 -2
- package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
- package/themes/original/src/types/index.tsx +124 -30
- package/themes/original/src/utils/index.tsx +77 -0
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react'
|
|
1
|
+
import React, { useEffect } from 'react'
|
|
2
2
|
import {
|
|
3
3
|
OrderTypeControl,
|
|
4
4
|
useLanguage,
|
|
@@ -6,28 +6,32 @@ import {
|
|
|
6
6
|
} from 'ordering-components/native'
|
|
7
7
|
import { useTheme } from 'styled-components/native';
|
|
8
8
|
import { Platform, View } from 'react-native'
|
|
9
|
-
import { BgImage, ListWrapper, MaskCont, OrderTypeWrapper, Wrapper } from './styles'
|
|
9
|
+
import { BgImage, ListWrapper, MaskCont, OrderTypeWrapper, OTab, OTabs, TabBtn, Wrapper } from './styles'
|
|
10
10
|
import { OrderTypeSelectParams } from '../../types'
|
|
11
11
|
import { OIcon, OText } from '../shared'
|
|
12
12
|
import NavBar from '../NavBar';
|
|
13
13
|
import { ORDER_TYPES } from '../../config/constants';
|
|
14
|
+
import AntDesignIcon from 'react-native-vector-icons/AntDesign'
|
|
14
15
|
|
|
15
16
|
const OrderTypeSelectorUI = (props: OrderTypeSelectParams) => {
|
|
16
17
|
const {
|
|
17
18
|
navigation,
|
|
18
19
|
handleChangeOrderType,
|
|
20
|
+
handleChangeType,
|
|
19
21
|
typeSelected,
|
|
20
22
|
defaultValue,
|
|
21
23
|
configTypes,
|
|
22
24
|
orderTypes,
|
|
23
|
-
setOrderTypeValue
|
|
25
|
+
setOrderTypeValue,
|
|
26
|
+
isChewLayout,
|
|
27
|
+
chewOrderTypes
|
|
24
28
|
} = props
|
|
25
29
|
|
|
26
30
|
const theme = useTheme();
|
|
27
31
|
const [orderState] = useOrder();
|
|
28
32
|
const [, t] = useLanguage();
|
|
29
33
|
const _orderTypes = orderTypes.filter((type: any) => configTypes?.includes(type.value));
|
|
30
|
-
|
|
34
|
+
|
|
31
35
|
const items = _orderTypes.map((type) => {
|
|
32
36
|
return {
|
|
33
37
|
value: type.value,
|
|
@@ -42,43 +46,88 @@ const OrderTypeSelectorUI = (props: OrderTypeSelectParams) => {
|
|
|
42
46
|
if (!orderState.loading) {
|
|
43
47
|
setOrderTypeValue && setOrderTypeValue(orderType)
|
|
44
48
|
handleChangeOrderType(orderType)
|
|
45
|
-
|
|
49
|
+
if (!isChewLayout) {
|
|
50
|
+
goToBack();
|
|
51
|
+
}
|
|
46
52
|
}
|
|
47
53
|
}
|
|
48
54
|
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
handleChangeType && handleChangeType(typeSelected)
|
|
57
|
+
}, [typeSelected])
|
|
58
|
+
|
|
49
59
|
return (
|
|
50
60
|
<Wrapper>
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
<OText
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
61
|
+
{isChewLayout ? (
|
|
62
|
+
<View>
|
|
63
|
+
<OTabs
|
|
64
|
+
horizontal
|
|
65
|
+
showsHorizontalScrollIndicator={false}
|
|
66
|
+
>
|
|
67
|
+
{chewOrderTypes?.map((type: any) => (
|
|
68
|
+
<TabBtn
|
|
69
|
+
key={type.value}
|
|
70
|
+
onPress={() => handleChangeOrderTypeCallback(type.value)}
|
|
71
|
+
>
|
|
72
|
+
<OTab
|
|
73
|
+
style={{
|
|
74
|
+
borderBottomColor:
|
|
75
|
+
type.value === typeSelected
|
|
76
|
+
? theme.colors.textNormal
|
|
77
|
+
: theme.colors.border,
|
|
78
|
+
}}>
|
|
79
|
+
<OText
|
|
80
|
+
size={14}
|
|
81
|
+
color={
|
|
82
|
+
type.value === typeSelected
|
|
83
|
+
? theme.colors.textNormal
|
|
84
|
+
: theme.colors.disabled
|
|
85
|
+
}
|
|
86
|
+
weight={type.value === typeSelected ? 'bold' : 'normal'}>
|
|
87
|
+
{type.name}
|
|
88
|
+
</OText>
|
|
89
|
+
</OTab>
|
|
90
|
+
</TabBtn>
|
|
91
|
+
))}
|
|
92
|
+
</OTabs>
|
|
93
|
+
</View>
|
|
94
|
+
) : (
|
|
95
|
+
<>
|
|
96
|
+
<NavBar
|
|
97
|
+
onActionLeft={() => goToBack()}
|
|
98
|
+
btnStyle={{ paddingLeft: 0, width: 50 }}
|
|
99
|
+
paddingTop={0}
|
|
100
|
+
style={{ paddingBottom: 0 }}
|
|
101
|
+
title={t('HOW_WILL_YOU_DELIVERY_TYPE', 'How will your order type?')}
|
|
102
|
+
titleAlign={'center'}
|
|
103
|
+
titleStyle={{ fontSize: 14 }}
|
|
104
|
+
noMargin
|
|
105
|
+
/>
|
|
106
|
+
{
|
|
107
|
+
items.length > 0 && (
|
|
108
|
+
<ListWrapper>
|
|
109
|
+
{
|
|
110
|
+
items && items.map((item: any, idx: number) =>
|
|
111
|
+
<OrderTypeWrapper activeOpacity={0.8} key={idx} disabled={orderState.loading} onPress={() => handleChangeOrderTypeCallback(item.value)}>
|
|
112
|
+
<BgImage source={theme.images.orderTypes[`type${item?.value || 1}`]} resizeMode={'cover'} style={{ opacity: item?.value == typeSelected || typeSelected === undefined ? 1 : 0.4 }}>
|
|
113
|
+
<MaskCont>
|
|
114
|
+
<OText size={12} lineHeight={18} color={theme.colors.white} weight={Platform.OS === 'android' ? 'bold' : '600'}>{item?.label}</OText>
|
|
115
|
+
<OText size={10} lineHeight={15} color={theme.colors.white}>{item?.description}</OText>
|
|
116
|
+
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
|
117
|
+
<OText size={10} lineHeight={15} color={theme.colors.white}>{t('START_MY_ORDER', 'Start my order')}</OText>
|
|
118
|
+
<AntDesignIcon name='arrowleft' size={26} color={theme.colors.white} style={{ transform: [{ rotate: '180deg' }], marginStart: 4 }} />
|
|
119
|
+
</View>
|
|
120
|
+
</MaskCont>
|
|
121
|
+
</BgImage>
|
|
122
|
+
</OrderTypeWrapper>
|
|
123
|
+
)
|
|
124
|
+
}
|
|
125
|
+
</ListWrapper>
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
</>
|
|
129
|
+
)}
|
|
130
|
+
|
|
82
131
|
</Wrapper>
|
|
83
132
|
)
|
|
84
133
|
}
|
|
@@ -24,4 +24,22 @@ export const MaskCont = styled.View`
|
|
|
24
24
|
padding: 16px 39px;
|
|
25
25
|
background-color: #0000004D;
|
|
26
26
|
height: 100%;
|
|
27
|
-
`;
|
|
27
|
+
`;
|
|
28
|
+
|
|
29
|
+
export const OTabs = styled.View`
|
|
30
|
+
flex-direction: row;
|
|
31
|
+
width: 100%;
|
|
32
|
+
margin-bottom: -1px;
|
|
33
|
+
justify-content: space-between;
|
|
34
|
+
`;
|
|
35
|
+
|
|
36
|
+
export const OTab = styled.View`
|
|
37
|
+
padding-bottom: 10px;
|
|
38
|
+
border-bottom-width: 1px;
|
|
39
|
+
padding-horizontal: 10px;
|
|
40
|
+
`;
|
|
41
|
+
|
|
42
|
+
export const TabBtn = styled.TouchableOpacity`
|
|
43
|
+
min-height: 30px;
|
|
44
|
+
height: 30px;
|
|
45
|
+
`;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import {
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { useOrder } from 'ordering-components/native'
|
|
3
3
|
import { BusinessController } from '../../BusinessController'
|
|
4
4
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
5
5
|
|
|
@@ -7,32 +7,100 @@ import { ListWrapper } from './styles'
|
|
|
7
7
|
import {
|
|
8
8
|
View,
|
|
9
9
|
StyleSheet,
|
|
10
|
-
ScrollView
|
|
10
|
+
ScrollView,
|
|
11
|
+
Dimensions
|
|
11
12
|
} from 'react-native';
|
|
12
13
|
import { PreviousBusinessOrderedParams } from '../../../types';
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
const BusinessControllerList = ({ businesses, onBusinessClick, navigation, orderState, handleCustomUpdate, style }: any) => {
|
|
16
|
+
return (
|
|
17
|
+
<>
|
|
18
|
+
{businesses?.result?.map((business: any, i: number) => (
|
|
19
|
+
<BusinessController
|
|
20
|
+
key={`${business.id}_` + i}
|
|
21
|
+
business={business}
|
|
22
|
+
isBusinessOpen={business.open}
|
|
23
|
+
handleCustomClick={() => onBusinessClick(business)}
|
|
24
|
+
orderType={orderState?.options?.type}
|
|
25
|
+
navigation={navigation}
|
|
26
|
+
businessHeader={business?.header}
|
|
27
|
+
businessFeatured={business?.featured}
|
|
28
|
+
businessLogo={business?.logo}
|
|
29
|
+
businessReviews={business?.reviews}
|
|
30
|
+
businessDeliveryPrice={business?.delivery_price}
|
|
31
|
+
businessDeliveryTime={business?.delivery_time}
|
|
32
|
+
businessPickupTime={business?.pickup_time}
|
|
33
|
+
businessDistance={business?.distance}
|
|
34
|
+
handleCustomUpdate={handleCustomUpdate}
|
|
35
|
+
style={style}
|
|
36
|
+
/>
|
|
37
|
+
))}
|
|
38
|
+
</>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const BusinessSkeletons = () => {
|
|
43
|
+
return (
|
|
44
|
+
<>
|
|
45
|
+
{[...Array(4).keys()].map((item, i) => (
|
|
46
|
+
<Placeholder
|
|
47
|
+
Animation={Fade}
|
|
48
|
+
key={i}
|
|
49
|
+
style={{ marginBottom: 20 }}>
|
|
50
|
+
<View style={{ width: '100%' }}>
|
|
51
|
+
<PlaceholderLine
|
|
52
|
+
height={200}
|
|
53
|
+
style={{ marginBottom: 20, borderRadius: 25 }}
|
|
54
|
+
/>
|
|
55
|
+
<View style={{ paddingHorizontal: 10 }}>
|
|
56
|
+
<View
|
|
57
|
+
style={{
|
|
58
|
+
flexDirection: 'row',
|
|
59
|
+
justifyContent: 'space-between',
|
|
60
|
+
}}>
|
|
61
|
+
<PlaceholderLine
|
|
62
|
+
height={25}
|
|
63
|
+
width={40}
|
|
64
|
+
style={{ marginBottom: 10 }}
|
|
65
|
+
/>
|
|
66
|
+
<PlaceholderLine
|
|
67
|
+
height={25}
|
|
68
|
+
width={20}
|
|
69
|
+
style={{ marginBottom: 10 }}
|
|
70
|
+
/>
|
|
71
|
+
</View>
|
|
72
|
+
<PlaceholderLine
|
|
73
|
+
height={20}
|
|
74
|
+
width={30}
|
|
75
|
+
style={{ marginBottom: 10 }}
|
|
76
|
+
/>
|
|
77
|
+
<PlaceholderLine
|
|
78
|
+
height={20}
|
|
79
|
+
width={80}
|
|
80
|
+
style={{ marginBottom: 10 }}
|
|
81
|
+
/>
|
|
82
|
+
</View>
|
|
83
|
+
</View>
|
|
84
|
+
</Placeholder>
|
|
85
|
+
))}
|
|
86
|
+
</>
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export const PreviousBusinessOrdered = (props: PreviousBusinessOrderedParams) => {
|
|
15
91
|
const {
|
|
16
92
|
navigation,
|
|
17
|
-
|
|
18
|
-
setBusinessLoading,
|
|
19
|
-
businessId,
|
|
93
|
+
businesses,
|
|
20
94
|
onNavigationRedirect,
|
|
21
95
|
isBusinessesSearchList,
|
|
22
|
-
|
|
96
|
+
handleUpdateBusinesses,
|
|
23
97
|
} = props
|
|
24
98
|
|
|
25
99
|
const [orderState] = useOrder()
|
|
100
|
+
const windowWidth = Dimensions.get('window').width;
|
|
26
101
|
const onBusinessClick = (business: any) => {
|
|
27
|
-
onNavigationRedirect('Business', { store: business.slug })
|
|
102
|
+
onNavigationRedirect('Business', { store: business.slug, logo: business.logo, header: business.header })
|
|
28
103
|
}
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
if (businessesList?.loading && businessesList?.businesses?.length === 0) {
|
|
31
|
-
setBusinessLoading(true)
|
|
32
|
-
} else {
|
|
33
|
-
setBusinessLoading(false)
|
|
34
|
-
}
|
|
35
|
-
}, [businessesList?.loading])
|
|
36
104
|
|
|
37
105
|
const styles = StyleSheet.create({
|
|
38
106
|
container: {
|
|
@@ -40,95 +108,33 @@ export const PreviousBusinessOrderedUI = (props : PreviousBusinessOrderedParams)
|
|
|
40
108
|
},
|
|
41
109
|
});
|
|
42
110
|
|
|
43
|
-
const BusinessControllerList = ({ style }: any) => {
|
|
44
|
-
return (
|
|
45
|
-
<>
|
|
46
|
-
{businessesList.businesses?.filter((business: any) => businessId?.includes(business?.id))?.map((business: any, i: number) => (
|
|
47
|
-
<BusinessController
|
|
48
|
-
key={`${business.id}_` + i}
|
|
49
|
-
business={business}
|
|
50
|
-
isBusinessOpen={business.open}
|
|
51
|
-
handleCustomClick={() => onBusinessClick(business)}
|
|
52
|
-
orderType={orderState?.options?.type}
|
|
53
|
-
navigation={navigation}
|
|
54
|
-
businessHeader={business?.header}
|
|
55
|
-
businessFeatured={business?.featured}
|
|
56
|
-
businessLogo={business?.logo}
|
|
57
|
-
businessReviews={business?.reviews}
|
|
58
|
-
businessDeliveryPrice={business?.delivery_price}
|
|
59
|
-
businessDeliveryTime={business?.delivery_time}
|
|
60
|
-
businessPickupTime={business?.pickup_time}
|
|
61
|
-
businessDistance={business?.distance}
|
|
62
|
-
style={style}
|
|
63
|
-
/>
|
|
64
|
-
))}
|
|
65
|
-
</>
|
|
66
|
-
)
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const BusinessSkeletons = () => {
|
|
70
|
-
return (
|
|
71
|
-
<>
|
|
72
|
-
{[...Array(4).keys()].map((item, i) => (
|
|
73
|
-
<Placeholder
|
|
74
|
-
Animation={Fade}
|
|
75
|
-
key={i}
|
|
76
|
-
style={{ marginBottom: 20 }}>
|
|
77
|
-
<View style={{ width: '100%' }}>
|
|
78
|
-
<PlaceholderLine
|
|
79
|
-
height={200}
|
|
80
|
-
style={{ marginBottom: 20, borderRadius: 25 }}
|
|
81
|
-
/>
|
|
82
|
-
<View style={{ paddingHorizontal: 10 }}>
|
|
83
|
-
<View
|
|
84
|
-
style={{
|
|
85
|
-
flexDirection: 'row',
|
|
86
|
-
justifyContent: 'space-between',
|
|
87
|
-
}}>
|
|
88
|
-
<PlaceholderLine
|
|
89
|
-
height={25}
|
|
90
|
-
width={40}
|
|
91
|
-
style={{ marginBottom: 10 }}
|
|
92
|
-
/>
|
|
93
|
-
<PlaceholderLine
|
|
94
|
-
height={25}
|
|
95
|
-
width={20}
|
|
96
|
-
style={{ marginBottom: 10 }}
|
|
97
|
-
/>
|
|
98
|
-
</View>
|
|
99
|
-
<PlaceholderLine
|
|
100
|
-
height={20}
|
|
101
|
-
width={30}
|
|
102
|
-
style={{ marginBottom: 10 }}
|
|
103
|
-
/>
|
|
104
|
-
<PlaceholderLine
|
|
105
|
-
height={20}
|
|
106
|
-
width={80}
|
|
107
|
-
style={{ marginBottom: 10 }}
|
|
108
|
-
/>
|
|
109
|
-
</View>
|
|
110
|
-
</View>
|
|
111
|
-
</Placeholder>
|
|
112
|
-
))}
|
|
113
|
-
</>
|
|
114
|
-
)
|
|
115
|
-
}
|
|
116
|
-
|
|
117
111
|
return (
|
|
118
112
|
<ScrollView horizontal={isBusinessesSearchList} style={styles.container} showsVerticalScrollIndicator={false}>
|
|
119
113
|
{isBusinessesSearchList ? (
|
|
120
114
|
<>
|
|
121
|
-
{!
|
|
115
|
+
{!businesses?.loading && (
|
|
122
116
|
<BusinessControllerList
|
|
123
|
-
style={{ width:
|
|
117
|
+
style={{ width: windowWidth - 120, marginRight: 20 }}
|
|
118
|
+
onBusinessClick={onBusinessClick}
|
|
119
|
+
orderState={orderState}
|
|
120
|
+
navigation={navigation}
|
|
121
|
+
businesses={businesses}
|
|
122
|
+
handleCustomUpdate={handleUpdateBusinesses}
|
|
124
123
|
/>
|
|
125
124
|
)}
|
|
126
125
|
</>
|
|
127
126
|
) : (
|
|
128
127
|
<ListWrapper>
|
|
129
|
-
|
|
130
|
-
{businessesList.loading && (
|
|
128
|
+
{businesses?.loading ? (
|
|
131
129
|
<BusinessSkeletons />
|
|
130
|
+
) : (
|
|
131
|
+
<BusinessControllerList
|
|
132
|
+
onBusinessClick={onBusinessClick}
|
|
133
|
+
orderState={orderState}
|
|
134
|
+
navigation={navigation}
|
|
135
|
+
businesses={businesses}
|
|
136
|
+
handleCustomUpdate={handleUpdateBusinesses}
|
|
137
|
+
/>
|
|
132
138
|
)}
|
|
133
139
|
</ListWrapper>
|
|
134
140
|
)}
|
|
@@ -136,15 +142,3 @@ export const PreviousBusinessOrderedUI = (props : PreviousBusinessOrderedParams)
|
|
|
136
142
|
</ScrollView>
|
|
137
143
|
)
|
|
138
144
|
}
|
|
139
|
-
|
|
140
|
-
export const PreviousBusinessOrdered = (props) => {
|
|
141
|
-
const previousBusinessOrderedController = {
|
|
142
|
-
...props,
|
|
143
|
-
UIComponent: PreviousBusinessOrderedUI,
|
|
144
|
-
paginationSettings: { initialPage: 1, pageSize: 50, controlType: 'infinity' }
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
return (
|
|
148
|
-
<BusinessListController {...previousBusinessOrderedController} />
|
|
149
|
-
)
|
|
150
|
-
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { ScrollView, StyleSheet } from 'react-native'
|
|
2
|
+
import { ScrollView, StyleSheet, Dimensions } from 'react-native'
|
|
3
3
|
import {
|
|
4
4
|
ListWrapper
|
|
5
5
|
} from './styles'
|
|
@@ -7,13 +7,16 @@ import {
|
|
|
7
7
|
import { SingleProductCard } from '../../SingleProductCard'
|
|
8
8
|
import { PreviousProductsOrderedParams } from '../../../types'
|
|
9
9
|
|
|
10
|
-
export const PreviousProductsOrdered = (props
|
|
10
|
+
export const PreviousProductsOrdered = (props: PreviousProductsOrderedParams) => {
|
|
11
11
|
const {
|
|
12
12
|
products,
|
|
13
13
|
onProductClick,
|
|
14
|
+
handleUpdateProducts,
|
|
14
15
|
isBusinessesSearchList
|
|
15
16
|
} = props
|
|
16
17
|
|
|
18
|
+
const windowWidth = Dimensions.get('window').width;
|
|
19
|
+
|
|
17
20
|
const styles = StyleSheet.create({
|
|
18
21
|
container: {
|
|
19
22
|
marginBottom: 0,
|
|
@@ -24,15 +27,17 @@ export const PreviousProductsOrdered = (props : PreviousProductsOrderedParams) =
|
|
|
24
27
|
return (
|
|
25
28
|
<>
|
|
26
29
|
{products?.map((product: any) => (
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
<SingleProductCard
|
|
31
|
+
key={product?.id}
|
|
32
|
+
isProductId
|
|
33
|
+
isSoldOut={(product.inventoried && !product.quantity)}
|
|
34
|
+
product={product}
|
|
35
|
+
businessId={product?.business?.id}
|
|
36
|
+
onProductClick={onProductClick}
|
|
37
|
+
style={style}
|
|
38
|
+
productAddedToCartLength={0}
|
|
39
|
+
handleUpdateProducts={handleUpdateProducts}
|
|
40
|
+
/>
|
|
36
41
|
))}
|
|
37
42
|
</>
|
|
38
43
|
)
|
|
@@ -40,7 +45,7 @@ export const PreviousProductsOrdered = (props : PreviousProductsOrderedParams) =
|
|
|
40
45
|
return (
|
|
41
46
|
<ScrollView horizontal={isBusinessesSearchList} style={styles.container} showsVerticalScrollIndicator={false}>
|
|
42
47
|
{isBusinessesSearchList ? (
|
|
43
|
-
<ProductList style={{ width:
|
|
48
|
+
<ProductList style={{ width: windowWidth - 80, marginRight: 20 }} />
|
|
44
49
|
) : (
|
|
45
50
|
<ListWrapper isBusinessesSearchList={isBusinessesSearchList}>
|
|
46
51
|
<ProductList />
|