ordering-ui-react-native 0.16.18 → 0.16.19-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/BusinessTypeFilter/index.tsx +1 -2
- 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 -2
- 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 +103 -495
- 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 +170 -128
- 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 +10 -5
- 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/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,9 +1,9 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react'
|
|
2
|
-
import { useLanguage, BusinessSearchList, useOrder, useUtils } from 'ordering-components/native'
|
|
2
|
+
import { useLanguage, BusinessSearchList, useOrder, useUtils, showToast, ToastType } from 'ordering-components/native'
|
|
3
3
|
import { ScrollView, StyleSheet, TouchableOpacity, Platform, View, Dimensions } from 'react-native'
|
|
4
4
|
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
5
5
|
import { useTheme } from 'styled-components/native'
|
|
6
|
-
import { OButton,
|
|
6
|
+
import { OButton, OModal, OText } from '../shared'
|
|
7
7
|
import { SearchBar } from '../SearchBar';
|
|
8
8
|
import { BusinessController } from '../BusinessController'
|
|
9
9
|
import { NotFoundSource } from '../NotFoundSource'
|
|
@@ -19,21 +19,24 @@ import {
|
|
|
19
19
|
Metadata,
|
|
20
20
|
SingleBusinessContainer,
|
|
21
21
|
LoadMoreBusinessContainer,
|
|
22
|
-
ProgressContentWrapper,
|
|
23
|
-
ProgressBar,
|
|
24
22
|
TagsContainer,
|
|
25
23
|
SortContainer,
|
|
26
24
|
BrandContainer,
|
|
27
25
|
BrandItem,
|
|
28
|
-
PriceFilterWrapper
|
|
26
|
+
PriceFilterWrapper,
|
|
27
|
+
OptionTitle,
|
|
28
|
+
BContainer,
|
|
29
|
+
WrapperButtons
|
|
29
30
|
} from './styles'
|
|
30
31
|
import FastImage from 'react-native-fast-image'
|
|
31
32
|
import { convertHoursToMinutes } from '../../utils'
|
|
32
33
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
|
|
33
34
|
import { BusinessSearchParams } from '../../types'
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
import { MyOrders } from '../MyOrders'
|
|
36
|
+
import { useIsFocused } from '@react-navigation/native';
|
|
37
|
+
import { MaxSectionItem } from './MaxSectionItem'
|
|
38
|
+
import { BusinessControllerSkeletons } from './BusinessControllerSkeletons'
|
|
39
|
+
export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
|
|
37
40
|
const {
|
|
38
41
|
navigation,
|
|
39
42
|
businessesSearchList,
|
|
@@ -46,10 +49,14 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
46
49
|
filters,
|
|
47
50
|
businessTypes,
|
|
48
51
|
setFilters,
|
|
49
|
-
brandList
|
|
52
|
+
brandList,
|
|
53
|
+
onNavigationRedirect,
|
|
54
|
+
handleUpdateBusinessList,
|
|
55
|
+
handleUpdateProducts
|
|
50
56
|
} = props
|
|
51
|
-
|
|
57
|
+
|
|
52
58
|
const screenHeight = Dimensions.get('window').height;
|
|
59
|
+
const screenWidth = Dimensions.get('window').width;
|
|
53
60
|
const theme = useTheme()
|
|
54
61
|
const [orderState] = useOrder()
|
|
55
62
|
const { top } = useSafeAreaInsets();
|
|
@@ -76,6 +83,8 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
76
83
|
{ level: '5', content: '$$$$$' }
|
|
77
84
|
]
|
|
78
85
|
|
|
86
|
+
const isFocused = useIsFocused();
|
|
87
|
+
|
|
79
88
|
const styles = StyleSheet.create({
|
|
80
89
|
container: {
|
|
81
90
|
paddingHorizontal: 40,
|
|
@@ -92,10 +101,6 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
92
101
|
productsContainer: {
|
|
93
102
|
marginTop: 20
|
|
94
103
|
},
|
|
95
|
-
maxContainer: {
|
|
96
|
-
flexDirection: 'row',
|
|
97
|
-
justifyContent: 'space-between'
|
|
98
|
-
},
|
|
99
104
|
businessTypesContainer: {
|
|
100
105
|
width: '100%',
|
|
101
106
|
flexDirection: 'row',
|
|
@@ -130,7 +135,7 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
130
135
|
borderWidth: 0
|
|
131
136
|
},
|
|
132
137
|
applyButton: {
|
|
133
|
-
paddingHorizontal:
|
|
138
|
+
paddingHorizontal: 10,
|
|
134
139
|
width: '100%',
|
|
135
140
|
marginTop: 20
|
|
136
141
|
}
|
|
@@ -141,10 +146,14 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
141
146
|
}
|
|
142
147
|
|
|
143
148
|
const handleCloseFilters = () => {
|
|
144
|
-
|
|
149
|
+
clearFilters()
|
|
145
150
|
setOpenFilters(false)
|
|
146
151
|
}
|
|
147
152
|
|
|
153
|
+
const clearFilters = () => {
|
|
154
|
+
setFilters({ business_types: [], orderBy: 'default', franchise_ids: [], price_level: null })
|
|
155
|
+
}
|
|
156
|
+
|
|
148
157
|
const handleChangeActiveBusinessType = (type: any) => {
|
|
149
158
|
if (type?.id === null) {
|
|
150
159
|
handleChangeFilters('business_types', [])
|
|
@@ -177,6 +186,30 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
177
186
|
setOpenFilters(false)
|
|
178
187
|
}
|
|
179
188
|
|
|
189
|
+
const isInteger = (val: any) => Number.isInteger(Number(val)) && !!val
|
|
190
|
+
|
|
191
|
+
const onProductClick = (business: any, categoryId: any, productId: any) => {
|
|
192
|
+
if (!isInteger(business?.id) ||
|
|
193
|
+
!isInteger(categoryId) ||
|
|
194
|
+
!isInteger(productId) ||
|
|
195
|
+
!business.slug || !business.header || !business.logo) {
|
|
196
|
+
showToast(ToastType.error, t('NOT_AVAILABLE', 'Not Available'))
|
|
197
|
+
return
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
navigation.navigate('ProductDetails', {
|
|
201
|
+
isRedirect: 'business',
|
|
202
|
+
businessId: business?.id,
|
|
203
|
+
categoryId: categoryId,
|
|
204
|
+
productId: productId,
|
|
205
|
+
business: {
|
|
206
|
+
store: business.slug,
|
|
207
|
+
header: business.header,
|
|
208
|
+
logo: business.logo,
|
|
209
|
+
}
|
|
210
|
+
})
|
|
211
|
+
}
|
|
212
|
+
|
|
180
213
|
useEffect(() => {
|
|
181
214
|
if (filters.business_types?.length === 0 && filters.orderBy === 'default' && Object.keys(filters)?.length === 2 && !openFilters) {
|
|
182
215
|
handleSearchbusinessAndProducts(true)
|
|
@@ -187,56 +220,13 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
187
220
|
handleSearchbusinessAndProducts(true)
|
|
188
221
|
}, [])
|
|
189
222
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
: filter === 'max_eta'
|
|
195
|
-
? `${option} ${t('MIN', 'min')}`
|
|
196
|
-
: parsePrice(option)
|
|
197
|
-
}
|
|
198
|
-
return (
|
|
199
|
-
<View style={{ marginBottom: 20 }}>
|
|
200
|
-
<OText weight='bold' mBottom={10} size={16}>
|
|
201
|
-
{title}
|
|
202
|
-
</OText>
|
|
203
|
-
<ProgressContentWrapper>
|
|
204
|
-
<ProgressBar style={{ width: `${((options.indexOf(filters?.[filter]) / 3) * 100) ?? 100}%` }} />
|
|
205
|
-
</ProgressContentWrapper>
|
|
206
|
-
<View style={styles.maxContainer}>
|
|
207
|
-
{options.map((option: any, i: number) => (
|
|
208
|
-
<TouchableOpacity
|
|
209
|
-
onPress={() => handleChangeFilters(filter, option)}
|
|
210
|
-
key={option}
|
|
211
|
-
>
|
|
212
|
-
<OText
|
|
213
|
-
size={12}
|
|
214
|
-
weight={filters?.[filter] === option || (option === 'default' && (filters?.[filter] === 'default' || !filters?.[filter])) ? 'bold' : '500'}
|
|
215
|
-
>
|
|
216
|
-
{option === 'default' ? `${parseValue(options[i - 1])}+` : parseValue(option)}
|
|
217
|
-
</OText>
|
|
218
|
-
</TouchableOpacity>
|
|
219
|
-
))}
|
|
220
|
-
</View>
|
|
221
|
-
</View>
|
|
222
|
-
)
|
|
223
|
-
}
|
|
223
|
+
|
|
224
|
+
useEffect(() => {
|
|
225
|
+
handleChangeTermValue('')
|
|
226
|
+
}, [isFocused])
|
|
224
227
|
|
|
225
228
|
return (
|
|
226
|
-
<
|
|
227
|
-
<WrapHeader style={{ paddingTop: top + 20, marginVertical: 2 }}>
|
|
228
|
-
<TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', paddingVertical: 20 }}>
|
|
229
|
-
<OIcon src={theme.images.general.arrow_left} width={20} />
|
|
230
|
-
</TouchableOpacity>
|
|
231
|
-
<OText
|
|
232
|
-
size={20}
|
|
233
|
-
mBottom={15}
|
|
234
|
-
weight='bold'
|
|
235
|
-
style={{ marginTop: 10 }}
|
|
236
|
-
>
|
|
237
|
-
{t('SEARCH', 'Search')}
|
|
238
|
-
</OText>
|
|
239
|
-
</WrapHeader>
|
|
229
|
+
<BContainer>
|
|
240
230
|
<SearchWrapper>
|
|
241
231
|
<SearchBar
|
|
242
232
|
lazyLoad
|
|
@@ -246,7 +236,6 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
246
236
|
value={termValue}
|
|
247
237
|
iconCustomRight={<AntDesignIcon name='filter' size={16} style={{ bottom: 2 }} onPress={() => handleOpenfilters()} />}
|
|
248
238
|
/>
|
|
249
|
-
|
|
250
239
|
</SearchWrapper>
|
|
251
240
|
{
|
|
252
241
|
noResults && (
|
|
@@ -257,15 +246,32 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
257
246
|
</View>
|
|
258
247
|
)
|
|
259
248
|
}
|
|
249
|
+
{businessesSearchList.businesses?.length > 0 && termValue?.length === 0 && (
|
|
250
|
+
<MyOrders
|
|
251
|
+
hideOrders
|
|
252
|
+
businessesSearchList={businessesSearchList}
|
|
253
|
+
onNavigationRedirect={onNavigationRedirect}
|
|
254
|
+
BusinessControllerSkeletons={BusinessControllerSkeletons}
|
|
255
|
+
businessPaginationProps={paginationProps}
|
|
256
|
+
/>
|
|
257
|
+
)}
|
|
258
|
+
|
|
259
|
+
<OptionTitle isBusinessesSearchList={!!businessesSearchList}>
|
|
260
|
+
<OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10}>
|
|
261
|
+
{t('BUSINESSES', 'Businesses')}
|
|
262
|
+
</OText>
|
|
263
|
+
</OptionTitle>
|
|
260
264
|
<ScrollView horizontal>
|
|
261
265
|
{businessesSearchList.businesses?.length > 0 && businessesSearchList.businesses.map((business: any, i: number) => (
|
|
262
266
|
<BusinessController
|
|
263
267
|
key={business.id}
|
|
264
268
|
business={business}
|
|
265
269
|
isBusinessOpen={business.open}
|
|
270
|
+
enableIntersection={false}
|
|
266
271
|
handleCustomClick={() => onBusinessClick(business)}
|
|
272
|
+
handleUpdateBusinessList={handleUpdateBusinessList}
|
|
267
273
|
orderType={orderState?.options?.type}
|
|
268
|
-
style={{ width:
|
|
274
|
+
style={{ width: screenWidth - 120, marginRight: (businessesSearchList.loading || i !== businessesSearchList.businesses?.length - 1) ? 20 : 0 }}
|
|
269
275
|
/>
|
|
270
276
|
))}
|
|
271
277
|
{!businessesSearchList.loading && paginationProps?.totalPages && paginationProps?.currentPage < paginationProps?.totalPages && (
|
|
@@ -280,55 +286,7 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
280
286
|
</LoadMoreBusinessContainer>
|
|
281
287
|
)}
|
|
282
288
|
{businessesSearchList.loading && (
|
|
283
|
-
|
|
284
|
-
{[
|
|
285
|
-
...Array(
|
|
286
|
-
paginationProps.nextPageItems
|
|
287
|
-
? paginationProps.nextPageItems
|
|
288
|
-
: 3,
|
|
289
|
-
).keys(),
|
|
290
|
-
].map((item, i) => (
|
|
291
|
-
<Placeholder
|
|
292
|
-
Animation={Fade}
|
|
293
|
-
key={i}
|
|
294
|
-
style={{ width: 320, marginRight: 20, marginTop: 20 }}>
|
|
295
|
-
<View style={{ width: 320 }}>
|
|
296
|
-
<PlaceholderLine
|
|
297
|
-
height={155}
|
|
298
|
-
style={{ marginBottom: 20, borderRadius: 25 }}
|
|
299
|
-
/>
|
|
300
|
-
<View style={{ paddingHorizontal: 10 }}>
|
|
301
|
-
<View
|
|
302
|
-
style={{
|
|
303
|
-
flexDirection: 'row',
|
|
304
|
-
justifyContent: 'space-between',
|
|
305
|
-
}}>
|
|
306
|
-
<PlaceholderLine
|
|
307
|
-
height={25}
|
|
308
|
-
width={40}
|
|
309
|
-
style={{ marginBottom: 10 }}
|
|
310
|
-
/>
|
|
311
|
-
<PlaceholderLine
|
|
312
|
-
height={25}
|
|
313
|
-
width={20}
|
|
314
|
-
style={{ marginBottom: 10 }}
|
|
315
|
-
/>
|
|
316
|
-
</View>
|
|
317
|
-
<PlaceholderLine
|
|
318
|
-
height={20}
|
|
319
|
-
width={30}
|
|
320
|
-
style={{ marginBottom: 10 }}
|
|
321
|
-
/>
|
|
322
|
-
<PlaceholderLine
|
|
323
|
-
height={20}
|
|
324
|
-
width={80}
|
|
325
|
-
style={{ marginBottom: 0 }}
|
|
326
|
-
/>
|
|
327
|
-
</View>
|
|
328
|
-
</View>
|
|
329
|
-
</Placeholder>
|
|
330
|
-
))}
|
|
331
|
-
</>
|
|
289
|
+
<BusinessControllerSkeletons paginationProps={paginationProps} />
|
|
332
290
|
)}
|
|
333
291
|
</ScrollView>
|
|
334
292
|
<ProductsList>
|
|
@@ -375,16 +333,18 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
375
333
|
style={{ borderRadius: 50, paddingLeft: 5, paddingRight: 5, height: 20 }}
|
|
376
334
|
/>
|
|
377
335
|
</SingleBusinessContainer>
|
|
378
|
-
<ScrollView horizontal style={styles.productsContainer}>
|
|
336
|
+
<ScrollView horizontal style={styles.productsContainer} contentContainerStyle={{ flexGrow: 1 }}>
|
|
379
337
|
{business?.categories?.map((category: any) => category?.products?.map((product: any, i: number) => (
|
|
380
338
|
<SingleProductCard
|
|
381
339
|
key={product?.id}
|
|
382
340
|
isSoldOut={(product.inventoried && !product.quantity)}
|
|
383
341
|
product={product}
|
|
342
|
+
enableIntersection={false}
|
|
384
343
|
businessId={business?.id}
|
|
385
|
-
onProductClick={() =>
|
|
344
|
+
onProductClick={(product: any) => onProductClick(business, category?.id, product?.id)}
|
|
386
345
|
productAddedToCartLength={0}
|
|
387
|
-
|
|
346
|
+
handleUpdateProducts={(productId: number, changes: any) => handleUpdateProducts(productId, category?.id, business?.id, changes)}
|
|
347
|
+
style={{ width: screenWidth - 80, maxWidth: screenWidth - 80, marginRight: 20 }}
|
|
388
348
|
/>
|
|
389
349
|
)))}
|
|
390
350
|
|
|
@@ -452,7 +412,7 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
452
412
|
onPress={() => handleChangeFilters('orderBy', item?.value)}
|
|
453
413
|
style={{ marginBottom: 7 }}
|
|
454
414
|
>
|
|
455
|
-
<OText
|
|
415
|
+
<OText
|
|
456
416
|
weight={filters?.orderBy?.includes(item?.value) ? 'bold' : '500'}
|
|
457
417
|
mBottom={filters?.orderBy?.includes(item?.value) ? 5 : 0}
|
|
458
418
|
>
|
|
@@ -527,22 +487,28 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
527
487
|
</PriceFilterWrapper>
|
|
528
488
|
{orderState?.options?.type === 1 && (
|
|
529
489
|
<MaxSectionItem
|
|
490
|
+
filters={filters}
|
|
530
491
|
title={t('MAX_DELIVERY_FEE', 'Max delivery fee')}
|
|
531
492
|
options={maxDeliveryFeeOptions}
|
|
532
493
|
filter='max_delivery_price'
|
|
494
|
+
handleChangeFilters={handleChangeFilters}
|
|
533
495
|
/>
|
|
534
496
|
)}
|
|
535
497
|
{[1, 2].includes(orderState?.options?.type) && (
|
|
536
498
|
<MaxSectionItem
|
|
499
|
+
filters={filters}
|
|
537
500
|
title={orderState?.options?.type === 1 ? t('MAX_DELIVERY_TIME', 'Max delivery time') : t('MAX_PICKUP_TIME', 'Max pickup time')}
|
|
538
501
|
options={maxTimeOptions}
|
|
539
502
|
filter='max_eta'
|
|
503
|
+
handleChangeFilters={handleChangeFilters}
|
|
540
504
|
/>
|
|
541
505
|
)}
|
|
542
506
|
<MaxSectionItem
|
|
507
|
+
filters={filters}
|
|
543
508
|
title={t('MAX_DISTANCE', 'Max distance')}
|
|
544
509
|
options={maxDistanceOptions}
|
|
545
510
|
filter='max_distance'
|
|
511
|
+
handleChangeFilters={handleChangeFilters}
|
|
546
512
|
/>
|
|
547
513
|
{businessTypes?.length > 0 && (
|
|
548
514
|
<TagsContainer>
|
|
@@ -562,14 +528,28 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
562
528
|
</TagsContainer>
|
|
563
529
|
)}
|
|
564
530
|
</ScrollView>
|
|
565
|
-
<
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
531
|
+
<WrapperButtons>
|
|
532
|
+
<View style={{ width: '50%' }}>
|
|
533
|
+
<OButton
|
|
534
|
+
text={t('APPLY', 'Apply')}
|
|
535
|
+
parentStyle={styles.applyButton}
|
|
536
|
+
textStyle={{ color: '#fff' }}
|
|
537
|
+
onClick={() => handleApplyFilters()}
|
|
538
|
+
/>
|
|
539
|
+
</View>
|
|
540
|
+
<View style={{ width: '50%' }}>
|
|
541
|
+
<OButton
|
|
542
|
+
text={t('CLEAR_FILTERS', 'Clear')}
|
|
543
|
+
bgColor={theme.colors.white}
|
|
544
|
+
borderColor={theme.colors.primary}
|
|
545
|
+
parentStyle={styles.applyButton}
|
|
546
|
+
textStyle={{ color: theme.colors.primary }}
|
|
547
|
+
onClick={() => clearFilters()}
|
|
548
|
+
/>
|
|
549
|
+
</View>
|
|
550
|
+
</WrapperButtons>
|
|
571
551
|
</OModal>
|
|
572
|
-
</
|
|
552
|
+
</BContainer>
|
|
573
553
|
)
|
|
574
554
|
}
|
|
575
555
|
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import styled from 'styled-components/native'
|
|
1
|
+
import styled, { css } from 'styled-components/native'
|
|
2
|
+
|
|
3
|
+
export const BContainer = styled.View`
|
|
4
|
+
padding: 20px 40px;
|
|
5
|
+
`
|
|
2
6
|
|
|
3
7
|
export const WrapHeader = styled.View`
|
|
4
8
|
width: 100%;
|
|
@@ -55,18 +59,6 @@ export const LoadMoreBusinessContainer = styled.View`
|
|
|
55
59
|
margin-left: 20px;
|
|
56
60
|
`
|
|
57
61
|
|
|
58
|
-
export const ProgressBar = styled.View`
|
|
59
|
-
height: 4px;
|
|
60
|
-
background: ${(props: any) => props.theme.colors.textNormal};
|
|
61
|
-
`
|
|
62
|
-
|
|
63
|
-
export const ProgressContentWrapper = styled.View`
|
|
64
|
-
height: 4px;
|
|
65
|
-
background: #F8F9FA;
|
|
66
|
-
margin-bottom: 10px;
|
|
67
|
-
flex: 1;
|
|
68
|
-
`
|
|
69
|
-
|
|
70
62
|
export const TagsContainer = styled.View`
|
|
71
63
|
padding-bottom: 10px;
|
|
72
64
|
`
|
|
@@ -87,3 +79,16 @@ export const BrandItem = styled.TouchableOpacity`
|
|
|
87
79
|
export const PriceFilterWrapper = styled.View`
|
|
88
80
|
margin-bottom: 20px;
|
|
89
81
|
`
|
|
82
|
+
|
|
83
|
+
export const OptionTitle = styled.View`
|
|
84
|
+
margin-top: 24px;
|
|
85
|
+
${(props: any) => props.titleContent && css`
|
|
86
|
+
margin-left: ${() => props.isBusinessesSearchList ? '0' : '40px'};
|
|
87
|
+
`}
|
|
88
|
+
`
|
|
89
|
+
|
|
90
|
+
export const WrapperButtons = styled.View`
|
|
91
|
+
flex-direction: row;
|
|
92
|
+
width: 100%;
|
|
93
|
+
justify-content: space-between;
|
|
94
|
+
`
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { useTheme } from 'styled-components/native'
|
|
3
|
+
import { StyleSheet } from 'react-native'
|
|
4
|
+
import { SubCategoriesContainer, ContainerButton } from './styles'
|
|
5
|
+
import { OButton } from '../../shared'
|
|
6
|
+
import { useLanguage } from 'ordering-components/native'
|
|
7
|
+
|
|
8
|
+
function SubcategoriesComponentPropsAreEqual(prev: any, next: any) {
|
|
9
|
+
return prev.subcategoriesSelected === next.subcategoriesSelected &&
|
|
10
|
+
prev.category === next.category
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface SubcategoriesComponentParams {
|
|
14
|
+
subcategoriesSelected?: any,
|
|
15
|
+
category?: any,
|
|
16
|
+
onClickSubcategory: any
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const SubcategoriesComponent = (props : SubcategoriesComponentParams) => {
|
|
20
|
+
const {
|
|
21
|
+
subcategoriesSelected,
|
|
22
|
+
category,
|
|
23
|
+
onClickSubcategory
|
|
24
|
+
} = props
|
|
25
|
+
|
|
26
|
+
const theme = useTheme()
|
|
27
|
+
const [, t] = useLanguage()
|
|
28
|
+
const allsubcategorySelected = !subcategoriesSelected?.some((subcategory: any) => category?.id === subcategory?.parent_category_id)
|
|
29
|
+
|
|
30
|
+
const bpStyles = StyleSheet.create({
|
|
31
|
+
catWrap: { flexDirection: 'row', alignItems: 'center', marginBottom: 19 },
|
|
32
|
+
catIcon: {
|
|
33
|
+
borderRadius: 7.6,
|
|
34
|
+
shadowColor: '#000000',
|
|
35
|
+
shadowOpacity: 0.1,
|
|
36
|
+
shadowOffset: { width: 0, height: 0 },
|
|
37
|
+
shadowRadius: 1,
|
|
38
|
+
marginEnd: 13,
|
|
39
|
+
},
|
|
40
|
+
categoryButtonStyle: {
|
|
41
|
+
borderWidth: 0,
|
|
42
|
+
marginLeft: 5,
|
|
43
|
+
marginRight: 5,
|
|
44
|
+
marginBottom: 10,
|
|
45
|
+
height: 35,
|
|
46
|
+
paddingLeft: 3,
|
|
47
|
+
paddingRight: 3,
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<SubCategoriesContainer>
|
|
54
|
+
<ContainerButton
|
|
55
|
+
isSelected={allsubcategorySelected}
|
|
56
|
+
>
|
|
57
|
+
<OButton
|
|
58
|
+
onClick={() => onClickSubcategory(null, category)}
|
|
59
|
+
bgColor={allsubcategorySelected ? theme.colors.primary : theme.colors.backgroundGray}
|
|
60
|
+
text={`${t('ALL', 'All')} ${allsubcategorySelected ? 'X' : ''}`}
|
|
61
|
+
style={bpStyles.categoryButtonStyle}
|
|
62
|
+
textStyle={{ color: allsubcategorySelected ? theme.colors.white : theme.colors.textNormal, fontSize: 12 }}
|
|
63
|
+
/>
|
|
64
|
+
</ContainerButton>
|
|
65
|
+
{category?.subcategories?.map((subcategory: any) => {
|
|
66
|
+
const isSubcategorySelected = subcategoriesSelected?.find((_subcategory: any) => _subcategory?.id === subcategory?.id)
|
|
67
|
+
return (
|
|
68
|
+
<ContainerButton
|
|
69
|
+
key={subcategory?.id}
|
|
70
|
+
isSelected={isSubcategorySelected}
|
|
71
|
+
>
|
|
72
|
+
<OButton
|
|
73
|
+
onClick={() => onClickSubcategory(subcategory, category)}
|
|
74
|
+
bgColor={isSubcategorySelected ? theme.colors.primary : theme.colors.backgroundGray}
|
|
75
|
+
text={`${subcategory?.name} ${isSubcategorySelected ? 'X' : ''}`}
|
|
76
|
+
style={bpStyles.categoryButtonStyle}
|
|
77
|
+
textStyle={{ color: isSubcategorySelected ? theme.colors.white : theme.colors.textNormal, fontSize: 12 }}
|
|
78
|
+
/>
|
|
79
|
+
</ContainerButton>
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
)}
|
|
83
|
+
</SubCategoriesContainer>
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export const SubcategoriesComponentMemoized = React.memo(SubcategoriesComponent, SubcategoriesComponentPropsAreEqual)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import styled from "styled-components/native";
|
|
2
|
+
|
|
3
|
+
export const SubCategoriesContainer = styled.View`
|
|
4
|
+
flex-direction: row;
|
|
5
|
+
flex-wrap: wrap;
|
|
6
|
+
margin-bottom: 10px;
|
|
7
|
+
`
|
|
8
|
+
|
|
9
|
+
export const ContainerButton = styled.View`
|
|
10
|
+
`
|
|
11
|
+
|
|
12
|
+
export const HeaderWrapper = styled.View``
|