ordering-ui-react-native 0.18.20 → 0.18.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +1 -1
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +4 -2
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +8 -0
- package/themes/original/src/components/BusinessController/index.tsx +5 -3
- package/themes/original/src/components/BusinessController/styles.tsx +8 -0
- package/themes/original/src/components/BusinessFeaturedController/index.tsx +4 -2
- package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
- package/themes/original/src/components/BusinessProductsList/index.tsx +4 -2
- package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -0
- package/themes/original/src/components/Checkout/index.tsx +1 -0
- package/themes/original/src/components/SingleProductCard/index.tsx +6 -4
- package/themes/original/src/components/SingleProductCard/styles.tsx +9 -1
- package/themes/original/src/components/UserDetails/index.tsx +3 -1
- package/themes/original/src/components/UserFormDetails/index.tsx +4 -12
- package/themes/original/src/utils/index.tsx +39 -1
package/package.json
CHANGED
|
@@ -522,7 +522,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
|
|
|
522
522
|
style={{ borderRadius: 7, height: 45 }}
|
|
523
523
|
parentStyle={{ width: '100%' }}
|
|
524
524
|
textStyle={{ color: '#FFF', fontSize: 18 }}
|
|
525
|
-
isDisabled={
|
|
525
|
+
isDisabled={showTextArea && !comments}
|
|
526
526
|
onClick={() => handleAcceptOrReject()}
|
|
527
527
|
/>
|
|
528
528
|
</View>
|
|
@@ -5,7 +5,7 @@ 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';
|
|
@@ -351,13 +351,15 @@ export const BusinessBasicInformation = (
|
|
|
351
351
|
{business?.ribbon?.enabled && (
|
|
352
352
|
<RibbonBox
|
|
353
353
|
bgColor={business?.ribbon?.color}
|
|
354
|
+
colorText={lightenDarkenColor(business?.ribbon?.color)}
|
|
355
|
+
borderRibbon={lightenDarkenColor(business?.ribbon?.color)}
|
|
354
356
|
isRoundRect={business?.ribbon?.shape === shape?.rectangleRound}
|
|
355
357
|
isCapsule={business?.ribbon?.shape === shape?.capsuleShape}
|
|
356
358
|
>
|
|
357
359
|
<OText
|
|
358
360
|
size={10}
|
|
359
361
|
weight={'400'}
|
|
360
|
-
color={theme.colors.white}
|
|
362
|
+
color={lightenDarkenColor(business?.ribbon?.color) ? theme.colors.black : theme.colors.white}
|
|
361
363
|
numberOfLines={2}
|
|
362
364
|
ellipsizeMode='tail'
|
|
363
365
|
lineHeight={13}
|
|
@@ -64,6 +64,14 @@ export const RibbonBox = styled.View`
|
|
|
64
64
|
${(props: any) => props.isCapsule && css`
|
|
65
65
|
border-radius: 50px;
|
|
66
66
|
`}
|
|
67
|
+
|
|
68
|
+
${(props: any) => props.colorText && css`
|
|
69
|
+
color: ${props.colorText ? 'black' : 'white'};
|
|
70
|
+
`}
|
|
71
|
+
|
|
72
|
+
${(props: any) => props.borderRibbon && css`
|
|
73
|
+
border: 1px solid ${props.borderRibbon ? 'black' : 'white'};
|
|
74
|
+
`}
|
|
67
75
|
`
|
|
68
76
|
|
|
69
77
|
export const SocialListWrapper = styled.ScrollView`
|
|
@@ -14,7 +14,7 @@ import { OIcon, OText } from '../shared';
|
|
|
14
14
|
import { Dimensions, StyleSheet, Vibration, 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
18
|
|
|
19
19
|
import {
|
|
20
20
|
BusinessHero,
|
|
@@ -185,13 +185,15 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
185
185
|
{business?.ribbon?.enabled && (
|
|
186
186
|
<RibbonBox
|
|
187
187
|
bgColor={business?.ribbon?.color}
|
|
188
|
+
colorText={lightenDarkenColor(business?.ribbon?.color)}
|
|
189
|
+
borderRibbon={lightenDarkenColor(business?.ribbon?.color)}
|
|
188
190
|
isRoundRect={business?.ribbon?.shape === shape?.rectangleRound}
|
|
189
191
|
isCapsule={business?.ribbon?.shape === shape?.capsuleShape}
|
|
190
192
|
>
|
|
191
193
|
<OText
|
|
192
194
|
size={10}
|
|
193
195
|
weight={'400'}
|
|
194
|
-
color={theme.colors.white}
|
|
196
|
+
color={lightenDarkenColor(business?.ribbon?.color) ? theme.colors.black : theme.colors.white}
|
|
195
197
|
numberOfLines={2}
|
|
196
198
|
ellipsizeMode='tail'
|
|
197
199
|
lineHeight={13}
|
|
@@ -207,7 +209,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
207
209
|
source={(businessHeader || business?.header || typeof theme.images.dummies.businessHeader === 'string') ? {
|
|
208
210
|
uri: optimizeImage(businessHeader || business?.header || theme.images.dummies.businessHeader, 'h_500,c_limit'),
|
|
209
211
|
priority: FastImage.priority.normal,
|
|
210
|
-
} : theme.images.dummies.businessHeader}
|
|
212
|
+
} : theme.images.dummies.businessHeader}
|
|
211
213
|
resizeMode={FastImage.resizeMode.cover}
|
|
212
214
|
/>
|
|
213
215
|
)}
|
|
@@ -72,6 +72,14 @@ 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`
|
|
@@ -9,7 +9,7 @@ import { useTheme } from 'styled-components/native';
|
|
|
9
9
|
import { OIcon, OText } from '../shared';
|
|
10
10
|
import { StyleSheet, useWindowDimensions, View } from 'react-native';
|
|
11
11
|
import { BusinessControllerParams } from '../../types';
|
|
12
|
-
import { convertHoursToMinutes, shape } from '../../utils';
|
|
12
|
+
import { convertHoursToMinutes, lightenDarkenColor, shape } from '../../utils';
|
|
13
13
|
import {
|
|
14
14
|
Card,
|
|
15
15
|
BusinessHero,
|
|
@@ -101,13 +101,15 @@ export const BusinessFeaturedCtrlUI = (props: BusinessControllerParams) => {
|
|
|
101
101
|
{business?.ribbon?.enabled && (
|
|
102
102
|
<RibbonBox
|
|
103
103
|
bgColor={business?.ribbon?.color}
|
|
104
|
+
colorText={lightenDarkenColor(business?.ribbon?.color)}
|
|
105
|
+
borderRibbon={lightenDarkenColor(business?.ribbon?.color)}
|
|
104
106
|
isRoundRect={business?.ribbon?.shape === shape?.rectangleRound}
|
|
105
107
|
isCapsule={business?.ribbon?.shape === shape?.capsuleShape}
|
|
106
108
|
>
|
|
107
109
|
<OText
|
|
108
110
|
size={10}
|
|
109
111
|
weight={'400'}
|
|
110
|
-
color={theme.colors.white}
|
|
112
|
+
color={lightenDarkenColor(business?.ribbon?.color) ? theme.colors.black : theme.colors.white}
|
|
111
113
|
numberOfLines={2}
|
|
112
114
|
ellipsizeMode='tail'
|
|
113
115
|
lineHeight={13}
|
|
@@ -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
|
`
|
|
@@ -9,7 +9,7 @@ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
|
9
9
|
import { View, ScrollView } from 'react-native';
|
|
10
10
|
import { StyleSheet } from 'react-native';
|
|
11
11
|
import { useTheme } from 'styled-components/native';
|
|
12
|
-
import { shape } from '../../utils'
|
|
12
|
+
import { lightenDarkenColor, shape } from '../../utils'
|
|
13
13
|
import { CategoryDescriptionMemoized } from './CategoryDescription';
|
|
14
14
|
import { OrderItAgain } from '../OrderItAgain'
|
|
15
15
|
import { SubcategoriesComponentMemoized } from './SubcategoriesComponent';
|
|
@@ -186,13 +186,15 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
|
|
|
186
186
|
{category?.ribbon?.enabled && (
|
|
187
187
|
<RibbonBox
|
|
188
188
|
bgColor={category?.ribbon?.color}
|
|
189
|
+
colorText={lightenDarkenColor(category?.ribbon?.color)}
|
|
190
|
+
borderRibbon={lightenDarkenColor(category?.ribbon?.color)}
|
|
189
191
|
isRoundRect={category?.ribbon?.shape === shape?.rectangleRound}
|
|
190
192
|
isCapsule={category?.ribbon?.shape === shape?.capsuleShape}
|
|
191
193
|
>
|
|
192
194
|
<OText
|
|
193
195
|
size={10}
|
|
194
196
|
weight={'400'}
|
|
195
|
-
color={theme.colors.white}
|
|
197
|
+
color={lightenDarkenColor(category?.ribbon?.color) ? theme.colors.black : theme.colors.white}
|
|
196
198
|
numberOfLines={2}
|
|
197
199
|
ellipsizeMode='tail'
|
|
198
200
|
lineHeight={13}
|
|
@@ -30,6 +30,14 @@ export const RibbonBox = styled.View`
|
|
|
30
30
|
${(props: any) => props.isCapsule && css`
|
|
31
31
|
border-radius: 50px;
|
|
32
32
|
`}
|
|
33
|
+
|
|
34
|
+
${(props: any) => props.colorText && css`
|
|
35
|
+
color: ${props.colorText ? 'black' : 'white'};
|
|
36
|
+
`}
|
|
37
|
+
|
|
38
|
+
${(props: any) => props.borderRibbon && css`
|
|
39
|
+
border: 1px solid ${props.borderRibbon ? 'black' : 'white'};
|
|
40
|
+
`}
|
|
33
41
|
`
|
|
34
42
|
|
|
35
43
|
export const SubCategoriesContainer = styled.View`
|
|
@@ -17,7 +17,7 @@ import { InView } from 'react-native-intersection-observer'
|
|
|
17
17
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
18
18
|
import { OButton, OIcon, OText } from '../shared';
|
|
19
19
|
import FastImage from 'react-native-fast-image'
|
|
20
|
-
import { shape } from '../../utils';
|
|
20
|
+
import { lightenDarkenColor, shape } from '../../utils';
|
|
21
21
|
import { LottieAnimation } from '../LottieAnimation';
|
|
22
22
|
import { CardAnimation } from '../shared/CardAnimation'
|
|
23
23
|
|
|
@@ -109,7 +109,7 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
|
|
|
109
109
|
},
|
|
110
110
|
productTagsStyle: {
|
|
111
111
|
width: 30,
|
|
112
|
-
|
|
112
|
+
height: 30,
|
|
113
113
|
marginRight: 5
|
|
114
114
|
}
|
|
115
115
|
});
|
|
@@ -222,7 +222,7 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
|
|
|
222
222
|
showsHorizontalScrollIndicator={false}
|
|
223
223
|
horizontal
|
|
224
224
|
style={{ marginLeft: 10 }}
|
|
225
|
-
contentContainerStyle={{flexGrow: 1}}
|
|
225
|
+
contentContainerStyle={{ flexGrow: 1 }}
|
|
226
226
|
>
|
|
227
227
|
{product?.tags.map((tag: any, i: any) => (
|
|
228
228
|
<TouchableWithoutFeedback key={i}>
|
|
@@ -266,13 +266,15 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
|
|
|
266
266
|
{!!product?.ribbon?.enabled && (
|
|
267
267
|
<RibbonBox
|
|
268
268
|
bgColor={product?.ribbon?.color}
|
|
269
|
+
colorText={lightenDarkenColor(product?.ribbon?.color)}
|
|
270
|
+
borderRibbon={lightenDarkenColor(product?.ribbon?.color)}
|
|
269
271
|
isRoundRect={product?.ribbon?.shape === shape?.rectangleRound}
|
|
270
272
|
isCapsule={product?.ribbon?.shape === shape?.capsuleShape}
|
|
271
273
|
>
|
|
272
274
|
<OText
|
|
273
275
|
size={textSize}
|
|
274
276
|
weight={'400'}
|
|
275
|
-
color={theme.colors.white}
|
|
277
|
+
color={lightenDarkenColor(product?.ribbon?.color) ? theme.colors.black : theme.colors.white}
|
|
276
278
|
numberOfLines={2}
|
|
277
279
|
ellipsizeMode='tail'
|
|
278
280
|
lineHeight={13}
|
|
@@ -18,7 +18,7 @@ export const QuantityContainer = styled.View`
|
|
|
18
18
|
background: ${({ theme }: any) => theme.colors.primary};
|
|
19
19
|
align-items: center;
|
|
20
20
|
justify-content: center;
|
|
21
|
-
${({businessSingleId}
|
|
21
|
+
${({ businessSingleId }: any) => businessSingleId ? css`
|
|
22
22
|
left: 0;
|
|
23
23
|
` : css`
|
|
24
24
|
right: 0;
|
|
@@ -66,4 +66,12 @@ export const RibbonBox = styled.View`
|
|
|
66
66
|
${(props: any) => props.isCapsule && css`
|
|
67
67
|
border-radius: 50px;
|
|
68
68
|
`}
|
|
69
|
+
|
|
70
|
+
${(props: any) => props.colorText && css`
|
|
71
|
+
color: ${props.colorText ? 'black' : 'white'};
|
|
72
|
+
`}
|
|
73
|
+
|
|
74
|
+
${(props: any) => props.borderRibbon && css`
|
|
75
|
+
border: 1px solid ${props.borderRibbon ? 'black' : 'white'};
|
|
76
|
+
`}
|
|
69
77
|
`
|
|
@@ -34,7 +34,8 @@ const UserDetailsUI = (props: any) => {
|
|
|
34
34
|
isCheckout,
|
|
35
35
|
handleSendVerifyCode,
|
|
36
36
|
verifyPhoneState,
|
|
37
|
-
setFormState
|
|
37
|
+
setFormState,
|
|
38
|
+
setIsOpen
|
|
38
39
|
} = props
|
|
39
40
|
|
|
40
41
|
const theme = useTheme();
|
|
@@ -209,6 +210,7 @@ const UserDetailsUI = (props: any) => {
|
|
|
209
210
|
isCheckout={isCheckout}
|
|
210
211
|
setWillVerifyOtpState={setWillVerifyOtpState}
|
|
211
212
|
setIsSubmit={setIsSubmit}
|
|
213
|
+
setIsOpen={setIsOpen}
|
|
212
214
|
/>
|
|
213
215
|
)}
|
|
214
216
|
</UDContainer>
|
|
@@ -30,7 +30,8 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
30
30
|
hideUpdateButton,
|
|
31
31
|
setWillVerifyOtpState,
|
|
32
32
|
handlePlaceOrderAsGuest,
|
|
33
|
-
isCheckout
|
|
33
|
+
isCheckout,
|
|
34
|
+
setIsOpen
|
|
34
35
|
} = props;
|
|
35
36
|
|
|
36
37
|
const theme = useTheme();
|
|
@@ -221,10 +222,7 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
221
222
|
formState.result?.result &&
|
|
222
223
|
showToast(ToastType.Error, formState.result?.result[0]);
|
|
223
224
|
if (isCheckout) {
|
|
224
|
-
|
|
225
|
-
open: true,
|
|
226
|
-
content: formState.result?.result[0]
|
|
227
|
-
})
|
|
225
|
+
setIsOpen && setIsOpen(false)
|
|
228
226
|
cleanFormState && cleanFormState({ changes: {} })
|
|
229
227
|
}
|
|
230
228
|
}
|
|
@@ -476,13 +474,7 @@ export const UserFormDetailsUI = (props: any) => {
|
|
|
476
474
|
/>
|
|
477
475
|
</ScrollView>
|
|
478
476
|
</OModal>
|
|
479
|
-
|
|
480
|
-
open={alertState.open}
|
|
481
|
-
title=''
|
|
482
|
-
content={[alertState.content]}
|
|
483
|
-
onAccept={() => setAlertState({ open: false, content: '' })}
|
|
484
|
-
onClose={() => setAlertState({ open: false, content: '' })}
|
|
485
|
-
/>
|
|
477
|
+
|
|
486
478
|
</>
|
|
487
479
|
);
|
|
488
480
|
};
|
|
@@ -564,8 +564,46 @@ export const getOrderStatus = (s: string) => {
|
|
|
564
564
|
image: theme.images.order.status8
|
|
565
565
|
}
|
|
566
566
|
];
|
|
567
|
-
|
|
567
|
+
|
|
568
568
|
const objectStatus = orderStatus.find((o) => o.key === status);
|
|
569
569
|
|
|
570
570
|
return objectStatus && objectStatus;
|
|
571
571
|
}
|
|
572
|
+
|
|
573
|
+
/**
|
|
574
|
+
* Function to get brightness of color.
|
|
575
|
+
*/
|
|
576
|
+
export const lightenDarkenColor = (color: any) => {
|
|
577
|
+
|
|
578
|
+
let r, g, b, hsp
|
|
579
|
+
if (!color) return
|
|
580
|
+
if (color.match(/^rgb/)) {
|
|
581
|
+
// If HEX --> store the red, green, blue values in separate variables
|
|
582
|
+
color = color.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/)
|
|
583
|
+
|
|
584
|
+
r = color[1]
|
|
585
|
+
g = color[2]
|
|
586
|
+
b = color[3]
|
|
587
|
+
} else {
|
|
588
|
+
// If RGB --> Convert it to HEX
|
|
589
|
+
color = +("0x" + color.slice(1).replace(color.length < 5 && /./g, '$&$&'))
|
|
590
|
+
|
|
591
|
+
r = color >> 16
|
|
592
|
+
g = color >> 8 & 255
|
|
593
|
+
b = color & 255
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
// HSP (Highly Sensitive Poo) equation
|
|
597
|
+
hsp = Math.sqrt(
|
|
598
|
+
0.299 * (r * r) +
|
|
599
|
+
0.587 * (g * g) +
|
|
600
|
+
0.114 * (b * b)
|
|
601
|
+
)
|
|
602
|
+
|
|
603
|
+
// Using the HSP value, determine whether the color is light or dark
|
|
604
|
+
if (hsp > 197) {
|
|
605
|
+
return true //is light color
|
|
606
|
+
} else {
|
|
607
|
+
return false
|
|
608
|
+
}
|
|
609
|
+
}
|