ordering-ui-react-native 0.18.2 → 0.18.3-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 +9 -7
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessInformation/index.tsx +10 -9
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/OrderCreating/index.tsx +0 -20
- package/src/components/PaymentOptionsWebView/index.tsx +29 -8
- package/src/components/PhoneInputNumber/index.tsx +6 -2
- package/src/components/StripeMethodForm/index.tsx +136 -102
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OToast.tsx +3 -2
- package/src/types/index.tsx +5 -0
- package/src/utils/index.tsx +7 -2
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +36 -26
- package/themes/business/src/components/BusinessController/index.tsx +19 -17
- package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
- package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
- package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
- package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
- package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
- package/themes/business/src/components/Chat/index.tsx +163 -123
- package/themes/business/src/components/DriverMap/index.tsx +17 -6
- package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
- package/themes/business/src/components/FloatingButton/index.tsx +34 -31
- package/themes/business/src/components/GoogleMap/index.tsx +58 -57
- package/themes/business/src/components/LoginForm/index.tsx +5 -2
- package/themes/business/src/components/MapView/index.tsx +14 -10
- package/themes/business/src/components/MessagesOption/index.tsx +22 -94
- package/themes/business/src/components/NewOrderNotification/index.tsx +123 -96
- package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
- package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +205 -12
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +67 -39
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +47 -23
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +9 -4
- package/themes/business/src/components/OrderMessage/index.tsx +1 -1
- package/themes/business/src/components/OrderSummary/index.tsx +114 -123
- package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
- package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
- package/themes/business/src/components/OrdersOption/index.tsx +43 -32
- package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
- package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +21 -29
- package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
- package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
- package/themes/business/src/components/PreviousOrders/index.tsx +193 -221
- package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
- package/themes/business/src/components/ReviewCustomer/index.tsx +3 -1
- package/themes/business/src/components/SearchBar/index.tsx +2 -1
- package/themes/business/src/components/StoresList/index.tsx +6 -5
- package/themes/business/src/components/UserProfileForm/index.tsx +14 -15
- package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
- package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
- package/themes/business/src/components/shared/OModal.tsx +16 -9
- package/themes/business/src/types/index.tsx +8 -0
- package/themes/business/src/utils/index.tsx +4 -4
- 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/Checkout/index.tsx +6 -0
- package/themes/kiosk/src/components/Intro/index.tsx +16 -1
- package/themes/kiosk/src/components/LoginForm/index.tsx +7 -5
- 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/PhoneInputNumber/index.tsx +2 -2
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/original/index.tsx +7 -3
- package/themes/original/src/components/AddressDetails/index.tsx +19 -3
- package/themes/original/src/components/AddressForm/index.tsx +33 -15
- package/themes/original/src/components/AddressForm/styles.tsx +1 -1
- package/themes/original/src/components/AddressList/index.tsx +5 -8
- package/themes/original/src/components/AddressList/styles.tsx +4 -4
- package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +74 -38
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +11 -13
- package/themes/original/src/components/BusinessController/index.tsx +35 -44
- package/themes/original/src/components/BusinessController/styles.tsx +12 -5
- package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
- package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
- package/themes/original/src/components/BusinessInformation/index.tsx +140 -85
- package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +25 -26
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
- package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
- package/themes/original/src/components/BusinessListingSearch/index.tsx +133 -438
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -19
- package/themes/original/src/components/BusinessPreorder/index.tsx +105 -22
- package/themes/original/src/components/BusinessPreorder/styles.tsx +14 -0
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -3
- package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
- package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
- package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
- package/themes/original/src/components/BusinessProductsListing/index.tsx +162 -39
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +4 -5
- package/themes/original/src/components/BusinessReviews/index.tsx +4 -2
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +37 -404
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +49 -47
- package/themes/original/src/components/CartContent/index.tsx +99 -38
- package/themes/original/src/components/CartContent/styles.tsx +6 -6
- package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +324 -43
- package/themes/original/src/components/Checkout/styles.tsx +17 -0
- package/themes/original/src/components/CitiesControl/index.tsx +1 -1
- package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
- package/themes/original/src/components/CouponControl/index.tsx +10 -3
- package/themes/original/src/components/DatePicker/index.tsx +17 -0
- package/themes/original/src/components/DatePicker/styles.tsx +20 -0
- package/themes/original/src/components/DriverTips/index.tsx +6 -3
- package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
- package/themes/original/src/components/Favorite/index.tsx +4 -9
- package/themes/original/src/components/Favorite/styles.tsx +0 -2
- package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
- package/themes/original/src/components/GPSButton/index.tsx +7 -5
- package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +42 -5
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +3 -1
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +84 -8
- package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
- package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
- package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
- package/themes/original/src/components/GoogleMap/index.tsx +63 -7
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
- package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
- package/themes/original/src/components/Home/index.tsx +14 -5
- package/themes/original/src/components/LastOrder/index.tsx +2 -1
- package/themes/original/src/components/LastOrders/index.tsx +2 -1
- package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -25
- package/themes/original/src/components/LoginForm/index.tsx +64 -34
- package/themes/original/src/components/LottieAnimation/index.tsx +88 -63
- package/themes/original/src/components/MessageListing/index.tsx +9 -2
- package/themes/original/src/components/Messages/index.tsx +15 -4
- package/themes/original/src/components/Messages/styles.tsx +1 -1
- package/themes/original/src/components/MomentOption/index.tsx +9 -10
- package/themes/original/src/components/MomentSelector/index.tsx +1 -1
- package/themes/original/src/components/MultiCart/index.tsx +1 -1
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +161 -49
- package/themes/original/src/components/MultiCheckout/index.tsx +348 -70
- package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +2 -2
- package/themes/original/src/components/MyOrders/index.tsx +16 -5
- package/themes/original/src/components/NavBar/index.tsx +20 -13
- package/themes/original/src/components/NetworkError/index.tsx +2 -3
- package/themes/original/src/components/NetworkError/styles.tsx +2 -2
- package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
- package/themes/original/src/components/Notifications/index.tsx +4 -8
- package/themes/original/src/components/Notifications/styles.tsx +0 -1
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +22 -6
- package/themes/original/src/components/OrderDetails/index.tsx +721 -670
- package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
- package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
- package/themes/original/src/components/OrderProgress/index.tsx +34 -25
- package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
- package/themes/original/src/components/OrderSummary/index.tsx +62 -57
- package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +13 -13
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
- package/themes/original/src/components/OrdersOption/index.tsx +44 -21
- package/themes/original/src/components/OrdersOption/styles.tsx +2 -2
- package/themes/original/src/components/PageBanner/index.tsx +65 -29
- package/themes/original/src/components/PageBanner/styles.tsx +0 -3
- package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
- package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +100 -34
- package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
- package/themes/original/src/components/ProductForm/ActionButton.tsx +120 -0
- package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
- package/themes/original/src/components/ProductForm/index.tsx +106 -170
- package/themes/original/src/components/ProductForm/styles.tsx +3 -3
- package/themes/original/src/components/ProductItemAccordion/index.tsx +13 -6
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +49 -20
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
- package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
- package/themes/original/src/components/Promotions/index.tsx +6 -6
- package/themes/original/src/components/Promotions/styles.tsx +3 -3
- package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
- package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
- package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
- package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
- package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
- package/themes/original/src/components/ServiceForm/index.tsx +2 -2
- package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
- package/themes/original/src/components/SignupForm/index.tsx +27 -16
- package/themes/original/src/components/SingleOrderCard/index.tsx +44 -20
- package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
- package/themes/original/src/components/SingleProductCard/index.tsx +13 -10
- package/themes/original/src/components/SingleProductCard/styles.tsx +8 -3
- package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
- package/themes/original/src/components/StripeCardsList/index.tsx +61 -5
- package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
- package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
- package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
- package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +86 -0
- package/themes/original/src/components/UpsellingProducts/index.tsx +16 -205
- package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
- package/themes/original/src/components/UserDetails/index.tsx +3 -1
- package/themes/original/src/components/UserFormDetails/index.tsx +100 -22
- package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
- package/themes/original/src/components/UserProfile/index.tsx +8 -26
- package/themes/original/src/components/UserProfileForm/index.tsx +30 -31
- package/themes/original/src/components/UserVerification/index.tsx +55 -50
- package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
- package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
- package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
- package/themes/original/src/components/Wallets/index.tsx +48 -60
- package/themes/original/src/components/Wallets/styles.tsx +3 -4
- package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
- package/themes/original/src/components/shared/OButton.tsx +3 -3
- package/themes/original/src/components/shared/OInput.tsx +4 -5
- package/themes/original/src/components/shared/OModal.tsx +15 -17
- package/themes/original/src/layouts/Container.tsx +5 -3
- package/themes/original/src/types/index.tsx +28 -6
- package/themes/original/src/utils/index.tsx +180 -13
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
- package/src/navigators/BottomNavigator.tsx +0 -117
- package/src/navigators/CheckoutNavigator.tsx +0 -66
- package/src/navigators/HomeNavigator.tsx +0 -202
- package/src/navigators/NavigationRef.tsx +0 -7
- package/src/navigators/RootNavigator.tsx +0 -269
- package/src/pages/Account.tsx +0 -34
- package/src/pages/AddressForm.tsx +0 -62
- package/src/pages/AddressList.tsx +0 -24
- package/src/pages/BusinessProductsList.tsx +0 -81
- package/src/pages/BusinessesListing.tsx +0 -43
- package/src/pages/CartList.tsx +0 -49
- package/src/pages/Checkout.tsx +0 -101
- package/src/pages/ForgotPassword.tsx +0 -24
- package/src/pages/Help.tsx +0 -23
- package/src/pages/HelpAccountAndPayment.tsx +0 -23
- package/src/pages/HelpGuide.tsx +0 -23
- package/src/pages/HelpOrder.tsx +0 -23
- package/src/pages/Home.tsx +0 -36
- package/src/pages/IntroductoryTutorial.tsx +0 -170
- package/src/pages/Login.tsx +0 -47
- package/src/pages/MomentOption.tsx +0 -30
- package/src/pages/MultiCheckout.tsx +0 -31
- package/src/pages/MultiOrdersDetails.tsx +0 -27
- package/src/pages/MyOrders.tsx +0 -40
- package/src/pages/NetworkError.tsx +0 -24
- package/src/pages/NotFound.tsx +0 -22
- package/src/pages/OrderDetails.tsx +0 -25
- package/src/pages/ProductDetails.tsx +0 -55
- package/src/pages/Profile.tsx +0 -36
- package/src/pages/ReviewDriver.tsx +0 -30
- package/src/pages/ReviewOrder.tsx +0 -32
- package/src/pages/ReviewProducts.tsx +0 -30
- package/src/pages/Sessions.tsx +0 -22
- package/src/pages/Signup.tsx +0 -53
- package/src/pages/SpinnerLoader.tsx +0 -10
- package/src/pages/Splash.tsx +0 -21
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import { StyleSheet, View, TouchableOpacity, Linking, Pressable } from 'react-native';
|
|
2
|
+
import { StyleSheet, View, TouchableOpacity, Linking, Pressable, Image } from 'react-native';
|
|
3
3
|
import FastImage from 'react-native-fast-image'
|
|
4
4
|
import { useUtils, useOrder, useLanguage } from 'ordering-components/native';
|
|
5
5
|
import { useTheme } from 'styled-components/native';
|
|
6
6
|
import { OIcon, OText, OModal } from '../shared';
|
|
7
7
|
import { BusinessBasicInformationParams } from '../../types';
|
|
8
|
-
import { convertHoursToMinutes, shape } from '../../utils';
|
|
8
|
+
import { convertHoursToMinutes, lightenDarkenColor, shape } from '../../utils';
|
|
9
9
|
import MaterialComIcon from 'react-native-vector-icons/MaterialCommunityIcons'
|
|
10
10
|
import dayjs from 'dayjs';
|
|
11
11
|
import timezone from 'dayjs/plugin/timezone';
|
|
@@ -21,7 +21,6 @@ import {
|
|
|
21
21
|
BusinessInfo,
|
|
22
22
|
BusinessInfoItem,
|
|
23
23
|
WrapReviews,
|
|
24
|
-
WrapBusinessInfo,
|
|
25
24
|
TitleWrapper,
|
|
26
25
|
RibbonBox,
|
|
27
26
|
SocialListWrapper
|
|
@@ -46,6 +45,7 @@ export const BusinessBasicInformation = (
|
|
|
46
45
|
const [openBusinessReviews, setOpenBusinessReviews] = useState(false);
|
|
47
46
|
const [businessInformationObtained, setBusinessInformationObtained] = useState(false)
|
|
48
47
|
const [businessReviewsObtained, setBusinessReviewsObtainedbtained] = useState(false)
|
|
48
|
+
const [imageRealSize, setImageRealSize] = useState({ width: 16, height: 9, loading: true })
|
|
49
49
|
const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
50
50
|
const hideLogo = theme?.business_view?.components?.header?.components?.business?.components?.logo?.hidden
|
|
51
51
|
const hideDeliveryFee = theme?.business_view?.components?.header?.components?.business?.components?.fee?.hidden
|
|
@@ -62,7 +62,7 @@ export const BusinessBasicInformation = (
|
|
|
62
62
|
height: 150,
|
|
63
63
|
},
|
|
64
64
|
headerStyle: {
|
|
65
|
-
|
|
65
|
+
aspectRatio: imageRealSize?.width / imageRealSize?.height
|
|
66
66
|
},
|
|
67
67
|
logoStyle: {
|
|
68
68
|
width: 72,
|
|
@@ -72,7 +72,7 @@ export const BusinessBasicInformation = (
|
|
|
72
72
|
alignItems: 'flex-start'
|
|
73
73
|
},
|
|
74
74
|
businessInfo: {
|
|
75
|
-
paddingHorizontal:
|
|
75
|
+
paddingHorizontal: 20,
|
|
76
76
|
paddingTop: isChewLayout ? 0 : 56,
|
|
77
77
|
},
|
|
78
78
|
bullet: {
|
|
@@ -95,17 +95,17 @@ export const BusinessBasicInformation = (
|
|
|
95
95
|
width: '100%',
|
|
96
96
|
top: 0,
|
|
97
97
|
zIndex: 100,
|
|
98
|
-
left:
|
|
98
|
+
left: 20
|
|
99
99
|
},
|
|
100
100
|
socialIcon: {
|
|
101
101
|
borderRadius: 3,
|
|
102
102
|
borderColor: theme.colors.border,
|
|
103
103
|
borderWidth: isChewLayout ? 0 : 1,
|
|
104
|
-
width:
|
|
105
|
-
height:
|
|
104
|
+
width: 30,
|
|
105
|
+
height: 30,
|
|
106
106
|
justifyContent: 'center',
|
|
107
107
|
alignItems: 'center',
|
|
108
|
-
marginRight:
|
|
108
|
+
marginRight: 10,
|
|
109
109
|
marginBottom: 7
|
|
110
110
|
},
|
|
111
111
|
tiktokIcon: {
|
|
@@ -146,7 +146,7 @@ export const BusinessBasicInformation = (
|
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
const getBusinessType = () => {
|
|
149
|
-
if (Object.keys(business).length <= 0) return t('GENERAL', 'General');
|
|
149
|
+
if (Object.keys(business || {}).length <= 0) return t('GENERAL', 'General');
|
|
150
150
|
const _types: any = [];
|
|
151
151
|
types.forEach(
|
|
152
152
|
(type) =>
|
|
@@ -166,7 +166,7 @@ export const BusinessBasicInformation = (
|
|
|
166
166
|
<MaterialComIcon
|
|
167
167
|
name={iconTitle}
|
|
168
168
|
color={isChewLayout ? theme.colors.black : theme.colors.textNormal}
|
|
169
|
-
size={isChewLayout ?
|
|
169
|
+
size={isChewLayout ? 25 : 22}
|
|
170
170
|
/>
|
|
171
171
|
</TouchableOpacity>
|
|
172
172
|
)
|
|
@@ -196,6 +196,20 @@ export const BusinessBasicInformation = (
|
|
|
196
196
|
}
|
|
197
197
|
}, [businessState?.business])
|
|
198
198
|
|
|
199
|
+
useEffect(() => {
|
|
200
|
+
const bannerImage = header || businessState?.business?.header
|
|
201
|
+
if (!bannerImage) {
|
|
202
|
+
setImageRealSize({ width: 16, height: 9, loading: false })
|
|
203
|
+
return
|
|
204
|
+
}
|
|
205
|
+
Image.getSize(bannerImage, (width: number, height: number) => {
|
|
206
|
+
setImageRealSize({ width: width, height: height, loading: false });
|
|
207
|
+
}, (error: any) => {
|
|
208
|
+
setImageRealSize({ ...imageRealSize, loading: false });
|
|
209
|
+
console.log(error);
|
|
210
|
+
});
|
|
211
|
+
}, [header, businessState?.business?.header])
|
|
212
|
+
|
|
199
213
|
const SocialIcons = () => {
|
|
200
214
|
return (
|
|
201
215
|
<>
|
|
@@ -203,7 +217,7 @@ export const BusinessBasicInformation = (
|
|
|
203
217
|
<Placeholder Animation={Fade}>
|
|
204
218
|
<View style={{ flexDirection: 'row' }}>
|
|
205
219
|
{[...Array(5).keys()].map(i => (
|
|
206
|
-
<View style={styles.socialIcon} key={i}>
|
|
220
|
+
<View style={{ ...styles.socialIcon, borderWidth: 0 }} key={i}>
|
|
207
221
|
<PlaceholderLine width={100} height={20} style={{ marginBottom: 0 }} />
|
|
208
222
|
</View>
|
|
209
223
|
))}
|
|
@@ -284,18 +298,13 @@ export const BusinessBasicInformation = (
|
|
|
284
298
|
? styles.businesInfoheaderStyle
|
|
285
299
|
: { ...styles.headerStyle, backgroundColor: theme.colors.backgroundGray }
|
|
286
300
|
}
|
|
287
|
-
{...(!loading && {
|
|
288
|
-
source: (header || businessState?.business?.header) ? {
|
|
289
|
-
uri:
|
|
301
|
+
{...(!loading && !imageRealSize?.loading && {
|
|
302
|
+
source: (header || businessState?.business?.header || typeof theme?.images?.dummies?.businessHeader === 'string') ? {
|
|
303
|
+
uri: optimizeImage(businessState?.business?.header, 'h_250,c_limit') || header || theme?.images?.dummies?.businessHeader
|
|
290
304
|
} : theme?.images?.dummies?.businessHeader
|
|
291
305
|
})}
|
|
292
306
|
imageStyle={{ opacity: isChewLayout ? 0.5 : 1 }}
|
|
293
307
|
>
|
|
294
|
-
{!isBusinessInfoShow && !hideInfoIcon && !isChewLayout && (
|
|
295
|
-
<WrapBusinessInfo onPress={() => handleClickBusinessInformation()}>
|
|
296
|
-
<OIcon src={theme.images.general.info} width={24} />
|
|
297
|
-
</WrapBusinessInfo>
|
|
298
|
-
)}
|
|
299
308
|
{isChewLayout && !loading && (
|
|
300
309
|
<View style={styles.headerChewStyle}>
|
|
301
310
|
<OText size={24} weight={'600'} mBottom={-5}>
|
|
@@ -317,21 +326,31 @@ export const BusinessBasicInformation = (
|
|
|
317
326
|
{!hideLogo && (
|
|
318
327
|
<BusinessLogo isChewLayout={isChewLayout}>
|
|
319
328
|
{!isBusinessInfoShow && (
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
style={styles.logoStyle}
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
329
|
+
<>
|
|
330
|
+
{loading ? (
|
|
331
|
+
<View style={styles.logoStyle}>
|
|
332
|
+
<Placeholder Animation={Fade}>
|
|
333
|
+
<PlaceholderLine height={72} style={{ borderRadius: 8 }} />
|
|
334
|
+
</Placeholder>
|
|
335
|
+
</View>
|
|
336
|
+
) : (
|
|
337
|
+
logo || businessState?.business?.logo || typeof theme.images.dummies.businessLogo === 'string' ?
|
|
338
|
+
<FastImage
|
|
339
|
+
style={styles.logoStyle}
|
|
340
|
+
source={{
|
|
341
|
+
uri: logo || optimizeImage(businessState?.business?.logo, 'h_70,c_limit') || theme.images.dummies.businessLogo,
|
|
342
|
+
priority: FastImage.priority.high,
|
|
343
|
+
cache: FastImage.cacheControl.web
|
|
344
|
+
}}
|
|
345
|
+
resizeMode={FastImage.resizeMode.contain}
|
|
346
|
+
/>
|
|
347
|
+
:
|
|
348
|
+
<OIcon
|
|
349
|
+
src={theme?.images?.dummies?.businessLogo}
|
|
350
|
+
style={styles.logoStyle}
|
|
351
|
+
/>
|
|
352
|
+
)}
|
|
353
|
+
</>
|
|
335
354
|
)}
|
|
336
355
|
</BusinessLogo>
|
|
337
356
|
)}
|
|
@@ -351,13 +370,15 @@ export const BusinessBasicInformation = (
|
|
|
351
370
|
{business?.ribbon?.enabled && (
|
|
352
371
|
<RibbonBox
|
|
353
372
|
bgColor={business?.ribbon?.color}
|
|
373
|
+
colorText={lightenDarkenColor(business?.ribbon?.color)}
|
|
374
|
+
borderRibbon={lightenDarkenColor(business?.ribbon?.color)}
|
|
354
375
|
isRoundRect={business?.ribbon?.shape === shape?.rectangleRound}
|
|
355
376
|
isCapsule={business?.ribbon?.shape === shape?.capsuleShape}
|
|
356
377
|
>
|
|
357
378
|
<OText
|
|
358
379
|
size={10}
|
|
359
380
|
weight={'400'}
|
|
360
|
-
color={theme.colors.white}
|
|
381
|
+
color={lightenDarkenColor(business?.ribbon?.color) ? theme.colors.black : theme.colors.white}
|
|
361
382
|
numberOfLines={2}
|
|
362
383
|
ellipsizeMode='tail'
|
|
363
384
|
lineHeight={13}
|
|
@@ -451,13 +472,28 @@ export const BusinessBasicInformation = (
|
|
|
451
472
|
</>
|
|
452
473
|
)}
|
|
453
474
|
{!hideReviewsPopup && (
|
|
454
|
-
|
|
475
|
+
<>
|
|
476
|
+
<TouchableOpacity onPress={() => handleClickBusinessReviews()}>
|
|
477
|
+
<OText
|
|
478
|
+
color={theme.colors.primary}
|
|
479
|
+
style={{ textDecorationColor: theme.colors.primary, textDecorationLine: 'underline' }}
|
|
480
|
+
size={12}
|
|
481
|
+
>
|
|
482
|
+
{t('REVIEWS', 'Reviews')}
|
|
483
|
+
</OText>
|
|
484
|
+
</TouchableOpacity>
|
|
485
|
+
<OText size={12} color={theme.colors.textSecondary}>{' \u2022 '}</OText>
|
|
486
|
+
</>
|
|
487
|
+
)}
|
|
488
|
+
|
|
489
|
+
{!isBusinessInfoShow && !hideInfoIcon && !isChewLayout && (
|
|
490
|
+
<TouchableOpacity onPress={() => handleClickBusinessInformation()}>
|
|
455
491
|
<OText
|
|
456
492
|
color={theme.colors.primary}
|
|
457
493
|
style={{ textDecorationColor: theme.colors.primary, textDecorationLine: 'underline' }}
|
|
458
494
|
size={12}
|
|
459
495
|
>
|
|
460
|
-
{t('
|
|
496
|
+
{t('INFORMATION', 'Information')}
|
|
461
497
|
</OText>
|
|
462
498
|
</TouchableOpacity>
|
|
463
499
|
)}
|
|
@@ -8,13 +8,10 @@ export const BusinessContainer = styled.View`
|
|
|
8
8
|
export const BusinessHeader = styled.ImageBackground`
|
|
9
9
|
width: 100%;
|
|
10
10
|
position: relative;
|
|
11
|
-
max-height: 258px;
|
|
12
|
-
height: 258px;
|
|
13
|
-
resize-mode: cover;
|
|
14
11
|
`;
|
|
15
12
|
export const BusinessLogo = styled.View`
|
|
16
13
|
position: absolute;
|
|
17
|
-
start:
|
|
14
|
+
start: 20px;
|
|
18
15
|
top: -36px;
|
|
19
16
|
z-index: 50;
|
|
20
17
|
box-shadow: 0 0 2px ${Platform.OS == 'android' ? '#000000DD' : '#0000001A'};
|
|
@@ -36,25 +33,18 @@ export const WrapReviews = styled.View`
|
|
|
36
33
|
align-items: center;
|
|
37
34
|
justify-content: flex-start;
|
|
38
35
|
`;
|
|
39
|
-
export const WrapBusinessInfo = styled.TouchableOpacity`
|
|
40
|
-
position: absolute;
|
|
41
|
-
top: 16px;
|
|
42
|
-
end: 39px;
|
|
43
|
-
`;
|
|
44
36
|
|
|
45
37
|
export const TitleWrapper = styled.View`
|
|
46
38
|
width: 100%;
|
|
47
|
-
flex-direction:
|
|
48
|
-
align-items: center;
|
|
49
|
-
justify-content: space-between;
|
|
39
|
+
flex-direction: column;
|
|
50
40
|
`
|
|
51
41
|
|
|
52
42
|
export const RibbonBox = styled.View`
|
|
53
|
-
margin-left: 5px;
|
|
54
43
|
background-color: ${(props: any) => props.theme.colors.primary};
|
|
55
44
|
padding: 2px 8px;
|
|
56
45
|
max-width: 180px;
|
|
57
46
|
align-self: flex-start;
|
|
47
|
+
margin-bottom: 5px;
|
|
58
48
|
|
|
59
49
|
${(props: any) => props.bgColor && css`
|
|
60
50
|
background-color: ${props.bgColor};
|
|
@@ -67,6 +57,14 @@ export const RibbonBox = styled.View`
|
|
|
67
57
|
${(props: any) => props.isCapsule && css`
|
|
68
58
|
border-radius: 50px;
|
|
69
59
|
`}
|
|
60
|
+
|
|
61
|
+
${(props: any) => props.colorText && css`
|
|
62
|
+
color: ${props.colorText ? 'black' : 'white'};
|
|
63
|
+
`}
|
|
64
|
+
|
|
65
|
+
${(props: any) => props.borderRibbon && css`
|
|
66
|
+
border: 1px solid ${props.borderRibbon ? 'black' : 'white'};
|
|
67
|
+
`}
|
|
70
68
|
`
|
|
71
69
|
|
|
72
70
|
export const SocialListWrapper = styled.ScrollView`
|
|
@@ -11,10 +11,11 @@ import {
|
|
|
11
11
|
ToastType
|
|
12
12
|
} from 'ordering-components/native';
|
|
13
13
|
import { OIcon, OText } from '../shared';
|
|
14
|
-
import { Dimensions, StyleSheet,
|
|
14
|
+
import { Dimensions, StyleSheet, View } from 'react-native';
|
|
15
15
|
import { InView } from 'react-native-intersection-observer'
|
|
16
16
|
import { BusinessControllerParams } from '../../types';
|
|
17
|
-
import { convertHoursToMinutes, shape } from '../../utils';
|
|
17
|
+
import { convertHoursToMinutes, lightenDarkenColor, shape } from '../../utils';
|
|
18
|
+
import ReactNativeHapticFeedback from "react-native-haptic-feedback";
|
|
18
19
|
|
|
19
20
|
import {
|
|
20
21
|
BusinessHero,
|
|
@@ -41,7 +42,6 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
41
42
|
navigation,
|
|
42
43
|
isBusinessOpen,
|
|
43
44
|
style,
|
|
44
|
-
isCustomLayout,
|
|
45
45
|
businessHeader,
|
|
46
46
|
businessFeatured,
|
|
47
47
|
businessLogo,
|
|
@@ -75,7 +75,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
75
75
|
const hideBusinessHeader = theme?.business_listing_view?.components?.business?.components?.header?.hidden
|
|
76
76
|
const hideBusinessFavoriteBadge = theme?.business_listing_view?.components?.business?.components?.featured_badge?.hidden
|
|
77
77
|
|
|
78
|
-
const textSize =
|
|
78
|
+
const textSize = 12
|
|
79
79
|
const cardHeight = windowHeight * 0.3
|
|
80
80
|
|
|
81
81
|
const styles = StyleSheet.create({
|
|
@@ -151,8 +151,16 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
151
151
|
return _types.join(', ');
|
|
152
152
|
};
|
|
153
153
|
|
|
154
|
+
const vibrateApp = (impact?: string) => {
|
|
155
|
+
const options = {
|
|
156
|
+
enableVibrateFallback: true,
|
|
157
|
+
ignoreAndroidSystemSettings: false
|
|
158
|
+
};
|
|
159
|
+
ReactNativeHapticFeedback.trigger(impact || "impactLight", options);
|
|
160
|
+
}
|
|
161
|
+
|
|
154
162
|
const handleBusinessClick = (selectedBusiness: any) => {
|
|
155
|
-
|
|
163
|
+
vibrateApp()
|
|
156
164
|
if (business?.open) handleClick && handleClick(selectedBusiness)
|
|
157
165
|
else {
|
|
158
166
|
if (configState?.configs?.preorder_status_enabled?.value === '1') {
|
|
@@ -185,13 +193,15 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
185
193
|
{business?.ribbon?.enabled && (
|
|
186
194
|
<RibbonBox
|
|
187
195
|
bgColor={business?.ribbon?.color}
|
|
196
|
+
colorText={lightenDarkenColor(business?.ribbon?.color)}
|
|
197
|
+
borderRibbon={lightenDarkenColor(business?.ribbon?.color)}
|
|
188
198
|
isRoundRect={business?.ribbon?.shape === shape?.rectangleRound}
|
|
189
199
|
isCapsule={business?.ribbon?.shape === shape?.capsuleShape}
|
|
190
200
|
>
|
|
191
201
|
<OText
|
|
192
202
|
size={10}
|
|
193
203
|
weight={'400'}
|
|
194
|
-
color={theme.colors.white}
|
|
204
|
+
color={lightenDarkenColor(business?.ribbon?.color) ? theme.colors.black : theme.colors.white}
|
|
195
205
|
numberOfLines={2}
|
|
196
206
|
ellipsizeMode='tail'
|
|
197
207
|
lineHeight={13}
|
|
@@ -203,9 +213,9 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
203
213
|
<BusinessHero>
|
|
204
214
|
{!hideBusinessHeader && (
|
|
205
215
|
<FastImage
|
|
206
|
-
style={{ height:
|
|
207
|
-
source={(businessHeader || business?.header) ? {
|
|
208
|
-
uri: optimizeImage(businessHeader || business?.header, 'h_500,c_limit'),
|
|
216
|
+
style={{ height: cardHeight * 0.66 }}
|
|
217
|
+
source={(businessHeader || business?.header || typeof theme.images.dummies.businessHeader === 'string') ? {
|
|
218
|
+
uri: optimizeImage(businessHeader || business?.header || theme.images.dummies.businessHeader, 'h_500,c_limit'),
|
|
209
219
|
priority: FastImage.priority.normal,
|
|
210
220
|
} : theme.images.dummies.businessHeader}
|
|
211
221
|
resizeMode={FastImage.resizeMode.cover}
|
|
@@ -216,19 +226,23 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
216
226
|
<FontAwesomeIcon name="crown" size={26} color="gold" />
|
|
217
227
|
</View>
|
|
218
228
|
)}
|
|
219
|
-
{
|
|
229
|
+
{!hideBusinessOffer && (
|
|
220
230
|
getBusinessOffer((business?.offers)) &&
|
|
221
|
-
<OfferBox
|
|
231
|
+
<OfferBox
|
|
232
|
+
isClosed={!isBusinessOpen && (configState?.configs?.preorder_status_enabled?.value === '1')}
|
|
233
|
+
isRibbon={business?.ribbon?.enabled && !!business?.ribbon?.text}
|
|
234
|
+
>
|
|
222
235
|
<OText
|
|
223
236
|
size={10}
|
|
224
237
|
weight={'400'}
|
|
238
|
+
color={theme.colors.textThird}
|
|
225
239
|
numberOfLines={2}
|
|
226
240
|
ellipsizeMode='tail'
|
|
227
241
|
lineHeight={13}
|
|
228
242
|
>{getBusinessOffer((business?.offers)) || parsePrice(0)}</OText>
|
|
229
243
|
</OfferBox>
|
|
230
244
|
)}
|
|
231
|
-
<BusinessState>
|
|
245
|
+
<BusinessState isRibbon={business?.ribbon?.enabled && !!business?.ribbon?.text}>
|
|
232
246
|
{!isBusinessOpen && (configState?.configs?.preorder_status_enabled?.value === '1') && (
|
|
233
247
|
<View style={styles.businessStateView}>
|
|
234
248
|
<OText
|
|
@@ -242,51 +256,28 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
242
256
|
</BusinessState>
|
|
243
257
|
</BusinessHero>
|
|
244
258
|
<BusinessContent>
|
|
245
|
-
<BusinessInfo style={
|
|
259
|
+
<BusinessInfo style={{ position: 'absolute', bottom: 85, left: 15 }}>
|
|
246
260
|
{!hideBusinessLogo && (
|
|
247
261
|
<BusinessLogo style={styles.businessLogo}>
|
|
248
262
|
<FastImage
|
|
249
263
|
style={{ width: 56, height: 56 }}
|
|
250
|
-
source={(businessLogo || business?.logo) ? {
|
|
251
|
-
uri: optimizeImage(businessLogo || business?.logo, 'h_150,c_limit'),
|
|
264
|
+
source={(businessLogo || business?.logo || typeof theme.images.dummies.businessLogo === 'string') ? {
|
|
265
|
+
uri: optimizeImage(businessLogo || business?.logo || theme.images.dummies.businessLogo, 'h_150,c_limit'),
|
|
252
266
|
priority: FastImage.priority.normal,
|
|
253
267
|
} : theme.images.dummies.businessLogo}
|
|
254
268
|
resizeMode={FastImage.resizeMode.cover}
|
|
255
269
|
/>
|
|
256
270
|
</BusinessLogo>
|
|
257
271
|
)}
|
|
258
|
-
{!isCustomLayout && (!hideBusinessFavorite || !hideBusinessReviews) && (
|
|
259
|
-
<ReviewAndFavorite>
|
|
260
|
-
{(businessReviews?.reviews?.total > 0 ?? business?.reviews?.total > 0) && !hideBusinessReviews && (
|
|
261
|
-
<Reviews>
|
|
262
|
-
<OIcon src={theme.images.general.star} width={12} style={styles.starIcon} />
|
|
263
|
-
<OText size={10} style={{ lineHeight: 15 }}>
|
|
264
|
-
{parseNumber(businessReviews?.reviews?.total ?? business?.reviews?.total, { separator: '.' })}
|
|
265
|
-
</OText>
|
|
266
|
-
</Reviews>
|
|
267
|
-
)}
|
|
268
|
-
{!hideBusinessFavorite && (
|
|
269
|
-
<LottieAnimation
|
|
270
|
-
type='favorite'
|
|
271
|
-
onClick={handleChangeFavorite}
|
|
272
|
-
initialValue={business?.favorite ? 0.75 : 0}
|
|
273
|
-
toValue={business?.favorite ? 0 : 0.75}
|
|
274
|
-
disableAnimation={!auth}
|
|
275
|
-
iconProps={{ color: theme.colors.danger5, size: 18 }}
|
|
276
|
-
isActive={business?.favorite}
|
|
277
|
-
/>
|
|
278
|
-
)}
|
|
279
|
-
</ReviewAndFavorite>
|
|
280
|
-
)}
|
|
281
272
|
</BusinessInfo>
|
|
282
|
-
<View style={
|
|
273
|
+
<View style={{ width: '100%', flexDirection: 'row', justifyContent: 'space-between', marginTop: 5, alignItems: 'flex-start' }}>
|
|
283
274
|
<OText
|
|
284
275
|
size={textSize + 2}
|
|
285
|
-
style={{ lineHeight: 18, marginBottom: 6 }}
|
|
276
|
+
style={{ lineHeight: 18, marginBottom: 6, width: '90%' }}
|
|
286
277
|
weight={'500'}>
|
|
287
278
|
{business?.name}
|
|
288
279
|
</OText>
|
|
289
|
-
{
|
|
280
|
+
{(!hideBusinessFavorite || !hideBusinessReviews) && (
|
|
290
281
|
<ReviewAndFavorite>
|
|
291
282
|
{(businessReviews?.reviews?.total > 0 ?? business?.reviews?.total > 0) && !hideBusinessReviews && (
|
|
292
283
|
<Reviews>
|
|
@@ -300,8 +291,8 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
300
291
|
<LottieAnimation
|
|
301
292
|
type='favorite'
|
|
302
293
|
onClick={handleChangeFavorite}
|
|
303
|
-
initialValue={business?.favorite ? 0.
|
|
304
|
-
toValue={business?.favorite ? 0 : 0.
|
|
294
|
+
initialValue={business?.favorite ? 0.5 : 0}
|
|
295
|
+
toValue={business?.favorite ? 0 : 0.5}
|
|
305
296
|
disableAnimation={!auth}
|
|
306
297
|
iconProps={{ color: theme.colors.danger5, size: 18 }}
|
|
307
298
|
isActive={business?.favorite}
|
|
@@ -310,7 +301,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
310
301
|
</ReviewAndFavorite>
|
|
311
302
|
)}
|
|
312
303
|
</View>
|
|
313
|
-
<OText size={textSize} style={{ lineHeight: 15, marginBottom: 3 }} numberOfLines={
|
|
304
|
+
<OText size={textSize} style={{ lineHeight: 15, marginBottom: 3 }} numberOfLines={1}>
|
|
314
305
|
{business?.address}
|
|
315
306
|
</OText>
|
|
316
307
|
<Metadata>
|
|
@@ -34,8 +34,8 @@ export const Metadata = styled.View`
|
|
|
34
34
|
|
|
35
35
|
export const BusinessState = styled.View`
|
|
36
36
|
position: absolute;
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
top: ${(props: any) => props.isRibbon ? '32px' : '15px'};
|
|
38
|
+
right: 15px;
|
|
39
39
|
`
|
|
40
40
|
|
|
41
41
|
export const BusinessLogo = styled.View`
|
|
@@ -72,15 +72,22 @@ export const RibbonBox = styled.View`
|
|
|
72
72
|
${(props: any) => props.isCapsule && css`
|
|
73
73
|
border-radius: 50px;
|
|
74
74
|
`}
|
|
75
|
+
|
|
76
|
+
${(props: any) => props.colorText && css`
|
|
77
|
+
color: ${props.colorText ? 'black' : 'white'};
|
|
78
|
+
`}
|
|
79
|
+
|
|
80
|
+
${(props: any) => props.borderRibbon && css`
|
|
81
|
+
border: 1px solid ${props.borderRibbon ? 'black' : 'white'};
|
|
82
|
+
`}
|
|
75
83
|
`
|
|
76
84
|
|
|
77
85
|
export const OfferBox = styled.View`
|
|
78
86
|
position: absolute;
|
|
79
87
|
z-index: 1;
|
|
80
|
-
top: 20px;
|
|
81
|
-
right: 10px;
|
|
82
88
|
border-radius: 50px;
|
|
83
|
-
|
|
89
|
+
top: ${(props: any) => props.isRibbon ? '32px' : '15px'};
|
|
90
|
+
right: ${(props: any) => props.isClosed ? '110px' : '15px'};
|
|
84
91
|
background: ${(props: any) => props.theme.colors.inputBorderColor};
|
|
85
92
|
padding: 3px 8px;
|
|
86
93
|
max-width: 180px;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { StyleSheet, useWindowDimensions, View } from 'react-native';
|
|
2
3
|
import {
|
|
3
4
|
BusinessController as BusinessSingleCard,
|
|
4
5
|
useUtils,
|
|
@@ -6,33 +7,29 @@ import {
|
|
|
6
7
|
useLanguage,
|
|
7
8
|
} from 'ordering-components/native';
|
|
8
9
|
import { useTheme } from 'styled-components/native';
|
|
9
|
-
import
|
|
10
|
-
|
|
10
|
+
import FastImage from 'react-native-fast-image'
|
|
11
|
+
|
|
12
|
+
import { OText } from '../shared';
|
|
11
13
|
import { BusinessControllerParams } from '../../types';
|
|
12
|
-
import { convertHoursToMinutes, shape } from '../../utils';
|
|
14
|
+
import { convertHoursToMinutes, lightenDarkenColor, shape } from '../../utils';
|
|
13
15
|
import {
|
|
14
16
|
Card,
|
|
15
17
|
BusinessHero,
|
|
16
18
|
BusinessContent,
|
|
17
|
-
BusinessCategory,
|
|
18
19
|
BusinessInfo,
|
|
19
20
|
Metadata,
|
|
20
|
-
BusinessState,
|
|
21
21
|
BusinessLogo,
|
|
22
|
-
Reviews,
|
|
23
22
|
RibbonBox
|
|
24
23
|
} from './styles';
|
|
25
24
|
|
|
26
25
|
export const BusinessFeaturedCtrlUI = (props: BusinessControllerParams) => {
|
|
27
26
|
const { business, handleClick, isBusinessOpen } = props;
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
|
|
28
|
+
const [{ parsePrice, parseDistance, optimizeImage }] = useUtils();
|
|
30
29
|
const [orderState] = useOrder();
|
|
31
30
|
const [, t] = useLanguage();
|
|
32
|
-
|
|
33
31
|
const theme = useTheme();
|
|
34
32
|
|
|
35
|
-
|
|
36
33
|
const styles = StyleSheet.create({
|
|
37
34
|
headerStyle: {
|
|
38
35
|
borderTopLeftRadius: 25,
|
|
@@ -79,35 +76,28 @@ export const BusinessFeaturedCtrlUI = (props: BusinessControllerParams) => {
|
|
|
79
76
|
justifyContent: 'flex-start',
|
|
80
77
|
width: '100%',
|
|
81
78
|
},
|
|
79
|
+
productStyle: {
|
|
80
|
+
height: 40,
|
|
81
|
+
width: 40
|
|
82
|
+
}
|
|
82
83
|
});
|
|
83
84
|
|
|
84
|
-
const types = ['food', 'laundry', 'alcohol', 'groceries'];
|
|
85
|
-
|
|
86
85
|
const { width } = useWindowDimensions();
|
|
87
86
|
|
|
88
|
-
const getBusinessType = () => {
|
|
89
|
-
if (Object.keys(business).length <= 0) return t('GENERAL', 'General');
|
|
90
|
-
const _types: any = [];
|
|
91
|
-
types.forEach((type) => {
|
|
92
|
-
if (business[type]) {
|
|
93
|
-
_types.push(t(type.toUpperCase(), type));
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
return _types.join(', ');
|
|
97
|
-
};
|
|
98
|
-
|
|
99
87
|
return (
|
|
100
88
|
<Card activeOpacity={1} onPress={() => handleClick(business)}>
|
|
101
89
|
{business?.ribbon?.enabled && (
|
|
102
90
|
<RibbonBox
|
|
103
91
|
bgColor={business?.ribbon?.color}
|
|
92
|
+
colorText={lightenDarkenColor(business?.ribbon?.color)}
|
|
93
|
+
borderRibbon={lightenDarkenColor(business?.ribbon?.color)}
|
|
104
94
|
isRoundRect={business?.ribbon?.shape === shape?.rectangleRound}
|
|
105
95
|
isCapsule={business?.ribbon?.shape === shape?.capsuleShape}
|
|
106
96
|
>
|
|
107
97
|
<OText
|
|
108
98
|
size={10}
|
|
109
99
|
weight={'400'}
|
|
110
|
-
color={theme.colors.white}
|
|
100
|
+
color={lightenDarkenColor(business?.ribbon?.color) ? theme.colors.black : theme.colors.white}
|
|
111
101
|
numberOfLines={2}
|
|
112
102
|
ellipsizeMode='tail'
|
|
113
103
|
lineHeight={13}
|
|
@@ -118,10 +108,13 @@ export const BusinessFeaturedCtrlUI = (props: BusinessControllerParams) => {
|
|
|
118
108
|
)}
|
|
119
109
|
<BusinessHero>
|
|
120
110
|
<BusinessLogo>
|
|
121
|
-
<
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
111
|
+
<FastImage
|
|
112
|
+
style={styles.productStyle}
|
|
113
|
+
source={{
|
|
114
|
+
uri: optimizeImage(business?.logo, 'h_100,c_limit'),
|
|
115
|
+
priority: FastImage.priority.normal,
|
|
116
|
+
}}
|
|
117
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
125
118
|
/>
|
|
126
119
|
</BusinessLogo>
|
|
127
120
|
<BusinessContent style={{ width: width * 0.6 }}>
|
|
@@ -129,23 +122,7 @@ export const BusinessFeaturedCtrlUI = (props: BusinessControllerParams) => {
|
|
|
129
122
|
<OText size={12} ellipsizeMode={'tail'} numberOfLines={2}>
|
|
130
123
|
{business?.name}
|
|
131
124
|
</OText>
|
|
132
|
-
{/* {business?.reviews?.total > 0 && (
|
|
133
|
-
<Reviews>
|
|
134
|
-
<IconAntDesign
|
|
135
|
-
name="star"
|
|
136
|
-
color={theme.colors.primary}
|
|
137
|
-
size={16}
|
|
138
|
-
style={styles.starIcon}
|
|
139
|
-
/>
|
|
140
|
-
<OText>
|
|
141
|
-
{parseNumber(business?.reviews?.total, { separator: '.' })}
|
|
142
|
-
</OText>
|
|
143
|
-
</Reviews>
|
|
144
|
-
)} */}
|
|
145
125
|
</BusinessInfo>
|
|
146
|
-
{/* <BusinessCategory>
|
|
147
|
-
<OText>{getBusinessType()}</OText>
|
|
148
|
-
</BusinessCategory> */}
|
|
149
126
|
<Metadata>
|
|
150
127
|
{!isBusinessOpen ? (
|
|
151
128
|
<View style={styles.closed}>
|
|
@@ -155,7 +132,6 @@ export const BusinessFeaturedCtrlUI = (props: BusinessControllerParams) => {
|
|
|
155
132
|
</View>
|
|
156
133
|
) : (
|
|
157
134
|
<View style={styles.bullet}>
|
|
158
|
-
{/* <MaterialComIcon name="alarm" size={16} /> */}
|
|
159
135
|
<OText size={10} color={theme.colors.textSecondary}>
|
|
160
136
|
{t('DELIVERY_FEE', 'Delivery Fee')}
|
|
161
137
|
</OText>
|
|
@@ -184,15 +160,6 @@ export const BusinessFeaturedCtrlUI = (props: BusinessControllerParams) => {
|
|
|
184
160
|
)}
|
|
185
161
|
</Metadata>
|
|
186
162
|
</BusinessContent>
|
|
187
|
-
{/* <BusinessState>
|
|
188
|
-
{!business?.open && (
|
|
189
|
-
<View style={styles.businessStateView}>
|
|
190
|
-
<OText color={theme.colors.white} size={20} style={styles.businessStateText}>
|
|
191
|
-
{t('PREORDER', 'PREORDER')}
|
|
192
|
-
</OText>
|
|
193
|
-
</View>
|
|
194
|
-
)}
|
|
195
|
-
</BusinessState> */}
|
|
196
163
|
</BusinessHero>
|
|
197
164
|
</Card>
|
|
198
165
|
);
|
|
@@ -70,4 +70,12 @@ export const RibbonBox = styled.View`
|
|
|
70
70
|
${(props: any) => props.isCapsule && css`
|
|
71
71
|
border-radius: 50px;
|
|
72
72
|
`}
|
|
73
|
+
|
|
74
|
+
${(props: any) => props.colorText && css`
|
|
75
|
+
color: ${props.colorText ? 'black' : 'white'};
|
|
76
|
+
`}
|
|
77
|
+
|
|
78
|
+
${(props: any) => props.borderRibbon && css`
|
|
79
|
+
border: 1px solid ${props.borderRibbon ? 'black' : 'white'};
|
|
80
|
+
`}
|
|
73
81
|
`
|