ordering-ui-react-native 0.18.20 → 0.18.22

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.
Files changed (29) hide show
  1. package/package.json +1 -1
  2. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +1 -1
  3. package/themes/original/src/components/BusinessBasicInformation/index.tsx +4 -2
  4. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +8 -0
  5. package/themes/original/src/components/BusinessController/index.tsx +9 -7
  6. package/themes/original/src/components/BusinessController/styles.tsx +8 -0
  7. package/themes/original/src/components/BusinessFeaturedController/index.tsx +4 -2
  8. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  9. package/themes/original/src/components/BusinessListingSearch/index.tsx +5 -2
  10. package/themes/original/src/components/BusinessProductsList/index.tsx +4 -2
  11. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -0
  12. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +2 -2
  13. package/themes/original/src/components/CartContent/index.tsx +7 -15
  14. package/themes/original/src/components/CartContent/styles.tsx +2 -6
  15. package/themes/original/src/components/Checkout/index.tsx +1 -0
  16. package/themes/original/src/components/LoginForm/index.tsx +1 -1
  17. package/themes/original/src/components/LottieAnimation/index.tsx +82 -63
  18. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  19. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +13 -13
  20. package/themes/original/src/components/OrdersOption/index.tsx +7 -9
  21. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  22. package/themes/original/src/components/SignupForm/index.tsx +1 -1
  23. package/themes/original/src/components/SingleOrderCard/index.tsx +2 -2
  24. package/themes/original/src/components/SingleProductCard/index.tsx +8 -6
  25. package/themes/original/src/components/SingleProductCard/styles.tsx +9 -1
  26. package/themes/original/src/components/UserDetails/index.tsx +3 -1
  27. package/themes/original/src/components/UserFormDetails/index.tsx +4 -12
  28. package/themes/original/src/types/index.tsx +2 -0
  29. package/themes/original/src/utils/index.tsx +39 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.18.20",
3
+ "version": "0.18.22",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -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={!rejectReason && showTextArea}
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
  )}
@@ -269,8 +271,8 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
269
271
  <LottieAnimation
270
272
  type='favorite'
271
273
  onClick={handleChangeFavorite}
272
- initialValue={business?.favorite ? 0.75 : 0}
273
- toValue={business?.favorite ? 0 : 0.75}
274
+ initialValue={business?.favorite ? 0.5 : 0}
275
+ toValue={business?.favorite ? 0 : 0.5}
274
276
  disableAnimation={!auth}
275
277
  iconProps={{ color: theme.colors.danger5, size: 18 }}
276
278
  isActive={business?.favorite}
@@ -300,8 +302,8 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
300
302
  <LottieAnimation
301
303
  type='favorite'
302
304
  onClick={handleChangeFavorite}
303
- initialValue={business?.favorite ? 0.75 : 0}
304
- toValue={business?.favorite ? 0 : 0.75}
305
+ initialValue={business?.favorite ? 0.5 : 0}
306
+ toValue={business?.favorite ? 0 : 0.5}
305
307
  disableAnimation={!auth}
306
308
  iconProps={{ color: theme.colors.danger5, size: 18 }}
307
309
  isActive={business?.favorite}
@@ -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
  `
@@ -275,7 +275,6 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
275
275
  }}
276
276
  />
277
277
  )}
278
-
279
278
  {businessesSearchList.businesses?.length > 0 && (
280
279
  <OptionTitle isBusinessesSearchList={!!businessesSearchList}>
281
280
  <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10}>
@@ -372,7 +371,11 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
372
371
  onProductClick={(product: any) => onProductClick(business, category?.id, product?.id, product)}
373
372
  productAddedToCartLength={0}
374
373
  handleUpdateProducts={(productId: number, changes: any) => handleUpdateProducts(productId, category?.id, business?.id, changes)}
375
- style={{ width: screenWidth - 80, maxWidth: screenWidth - 80, marginRight: 20 }}
374
+ style={{
375
+ width: screenWidth - (category?.products?.length > 1 ? 120 : 80),
376
+ maxWidth: screenWidth - (category?.products?.length > 1 ? 120 : 80),
377
+ marginRight: 20
378
+ }}
376
379
  />
377
380
  )))}
378
381
 
@@ -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`
@@ -585,7 +585,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
585
585
  setBusinessTypes={setBusinessTypes}
586
586
  />
587
587
  )}
588
- {!businessesList.loading && businessesList.businesses.length === 0 && (
588
+ {!businessesList.loading && businessesList.businesses.length === 0 && businessesList?.fetched && (
589
589
  <NotFoundSource
590
590
  content={t(
591
591
  'NOT_FOUND_BUSINESSES',
@@ -618,7 +618,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
618
618
  />
619
619
  )
620
620
  )}
621
- {businessesList.loading && (
621
+ {(businessesList.loading || !businessesList?.fetched) && (
622
622
  <>
623
623
  {[
624
624
  ...Array(
@@ -7,6 +7,7 @@ import { CCContainer, CCNotCarts, CCList, CheckoutAction } from './styles';
7
7
  import { Cart } from '../Cart';
8
8
  import { OButton, OText } from '../shared';
9
9
  import Spinner from 'react-native-loading-spinner-overlay';
10
+ import { NotFoundSource } from '../NotFoundSource';
10
11
 
11
12
  export const CartContent = (props: any) => {
12
13
  const {
@@ -103,21 +104,12 @@ export const CartContent = (props: any) => {
103
104
  )}
104
105
  {(!carts || carts?.length === 0) && (
105
106
  <CCNotCarts>
106
- <OText size={24} style={{ textAlign: 'center' }}>
107
- {t('CARTS_NOT_FOUND', 'You don\'t have carts available')}
108
- </OText>
109
- <OButton
110
- text={t('START_SHOPPING', 'Start shopping')}
111
- bgColor={theme.colors.primary}
112
- borderColor={theme.colors.primary}
113
- textStyle={{
114
- color: theme.colors.white,
115
- fontSize: 14,
116
- paddingRight: 0
117
- }}
118
- style={{ height: 35, marginVertical: 20, borderRadius: 8 }}
119
- imgRightSrc={null}
120
- onClick={() => onNavigationRedirect('BusinessList')}
107
+ <NotFoundSource
108
+ hideImage
109
+ btnStyle={{ borderRadius: 8 }}
110
+ content={t('CARTS_NOT_FOUND', 'You don\'t have carts available')}
111
+ btnTitle={t('START_SHOPPING', 'Start shopping')}
112
+ onClickButton={() => onNavigationRedirect('BusinessList')}
121
113
  />
122
114
  </CCNotCarts>
123
115
  )}
@@ -5,13 +5,9 @@ export const CCContainer = styled.View`
5
5
  `
6
6
 
7
7
  export const CCNotCarts = styled.View`
8
- height: 300px;
9
- display: flex;
10
8
  flex-direction: column;
11
- justify-content: center;
12
- align-items: center;
13
- width: 80%;
14
- margin: auto;
9
+ align-items: center;
10
+ margin-top: 40px;
15
11
  `
16
12
 
17
13
  export const CCList = styled.ScrollView`
@@ -822,6 +822,7 @@ const CheckoutUI = (props: any) => {
822
822
  setIsOpen(false)
823
823
  handlePlaceOrder(null, true)
824
824
  }}
825
+ setIsOpen={setIsOpen}
825
826
  />
826
827
  </View>
827
828
  </OModal>
@@ -222,7 +222,7 @@ const LoginFormUI = (props: LoginParams) => {
222
222
  };
223
223
 
224
224
  const handleChangeInputEmail = (value: string, onChange: any) => {
225
- onChange(value.toLowerCase().replace(/[&,()%";:ç?<>{}\\[\]\s]/g, ''));
225
+ onChange(value.toLowerCase().trim().replace(/[&,()%";:ç?<>{}\\[\]\s]/g, ''));
226
226
  };
227
227
 
228
228
  const handleOpenRecaptcha = () => {
@@ -5,74 +5,93 @@ import IconAntDesign from 'react-native-vector-icons/AntDesign'
5
5
  import { useTheme } from 'styled-components';
6
6
 
7
7
  interface Props {
8
- initialValue: number,
9
- onClick: any,
10
- disableAnimation?: boolean
11
- toValue: number,
12
- style?: ViewStyle,
13
- duration?: number,
14
- type: 'favorite', // animation types
15
- isActive: boolean,
16
- animationType?: ((value: number) => number);
17
- useNativeDriver?: boolean,
18
- iconProps?: { color?: string, size?: number, style?: ViewStyle }
8
+ initialValue: number,
9
+ onClick: any,
10
+ disableAnimation?: boolean
11
+ toValue: number,
12
+ style?: ViewStyle,
13
+ duration?: number,
14
+ type: 'favorite', // animation types
15
+ isActive: boolean,
16
+ animationType?: ((value: number) => number);
17
+ useNativeDriver?: boolean,
18
+ iconProps?: { color?: string, size?: number, style?: ViewStyle }
19
19
  }
20
20
 
21
21
  export const LottieAnimation = (props: Props) => {
22
- const {
23
- initialValue,
24
- onClick,
25
- disableAnimation,
26
- toValue,
27
- style,
28
- duration,
29
- type,
30
- isActive,
31
- useNativeDriver,
32
- animationType,
33
- iconProps
34
- } = props
35
- const theme = useTheme()
36
- const animationProgress = useRef(new Animated.Value(initialValue))
37
- const [isHide, setIsHide] = useState(true)
38
- const favoriteArray = ['heart', 'hearto']
39
- const icon = type === 'favorite' ? favoriteArray : []
40
- const animationGif = type === 'favorite' ? theme.images?.general?.heart : ''
41
- const onPressLottie = () => {
42
- if (!disableAnimation) {
43
- setIsHide(false)
44
- Animated.timing(animationProgress.current, {
45
- toValue,
46
- duration: duration || 5000,
47
- easing: animationType || Easing.linear,
48
- useNativeDriver: useNativeDriver ?? true
49
- }).start();
50
- hideLottie()
51
- }
52
- onClick()
53
- }
22
+ const {
23
+ initialValue,
24
+ onClick,
25
+ disableAnimation,
26
+ toValue,
27
+ style,
28
+ duration,
29
+ type,
30
+ isActive,
31
+ useNativeDriver,
32
+ animationType,
33
+ iconProps
34
+ } = props
35
+
36
+ const theme = useTheme()
37
+ const animationProgress = useRef(new Animated.Value(initialValue))
38
+ const favRef = useRef<Lottie>(null)
39
+ const [isHide, setIsHide] = useState(true)
54
40
 
55
- const hideLottie = () => {
56
- setTimeout(() => setIsHide(true), 4500)
41
+ const favoriteArray = ['heart', 'hearto']
42
+ const icon = type === 'favorite' ? favoriteArray : []
43
+ const animationGif = type === 'favorite' ? theme.images?.general?.heart : ''
44
+
45
+ const onPressLottie = () => {
46
+ if (!disableAnimation) {
47
+ if (type === 'favorite') {
48
+ favRef.current?.play()
49
+ } else {
50
+ setIsHide(false)
51
+ Animated.timing(animationProgress.current, {
52
+ toValue,
53
+ duration: duration || 5000,
54
+ easing: animationType || Easing.linear,
55
+ useNativeDriver: useNativeDriver ?? true
56
+ }).start();
57
+ hideLottie()
58
+ }
57
59
  }
60
+ onClick()
61
+ }
62
+
63
+ const hideLottie = () => {
64
+ setTimeout(() => setIsHide(true), 4500)
65
+ }
58
66
 
59
- return (
60
- <TouchableOpacity
61
- onPress={onPressLottie}
62
- style={style}
63
- >
64
- {!isHide &&
65
- <Lottie
66
- progress={animationProgress.current}
67
- source={animationGif}
68
- />
69
- }
70
- <IconAntDesign
71
- name={isActive ? icon[0] : icon[1]}
72
- color={iconProps?.color || theme.colors.danger5}
73
- size={iconProps?.size || 16}
74
- style={iconProps?.style}
67
+ return (
68
+ <TouchableOpacity
69
+ onPress={onPressLottie}
70
+ style={style}
71
+ >
72
+ {type === 'favorite' ? (
73
+ <Lottie
74
+ ref={favRef}
75
+ progress={initialValue}
76
+ style={{ width: 20, height: 20 }}
77
+ source={animationGif}
78
+ />
79
+ ) : (
80
+ <>
81
+ {!isHide &&
82
+ <Lottie
83
+ progress={animationProgress.current}
84
+ source={animationGif}
75
85
  />
76
- </TouchableOpacity>
77
- )
86
+ }
87
+ <IconAntDesign
88
+ name={isActive ? icon[0] : icon[1]}
89
+ color={iconProps?.color || theme.colors.danger5}
90
+ size={iconProps?.size || 16}
91
+ style={iconProps?.style}
92
+ />
93
+ </>
94
+ )}
95
+ </TouchableOpacity>
96
+ )
78
97
  }
@@ -1,8 +1,9 @@
1
1
  import React from 'react'
2
2
  import { View } from 'react-native'
3
- import { OButton, OIcon, OText } from '../shared'
3
+ import { OButton, OText } from '../shared'
4
4
  import { NotFoundSourceParams } from '../../types'
5
5
  import { useTheme } from 'styled-components/native';
6
+ import Foundation from 'react-native-vector-icons/Foundation'
6
7
  import {
7
8
  NotFound,
8
9
  NotFoundImage
@@ -10,34 +11,37 @@ import {
10
11
 
11
12
  export const NotFoundSource = (props: NotFoundSourceParams) => {
12
13
  const {
13
- image,
14
+ hideImage,
14
15
  content,
15
16
  btnTitle,
17
+ btnStyle,
16
18
  conditioned,
17
19
  onClickButton
18
20
  } = props
19
21
 
20
22
  const theme = useTheme();
21
23
 
22
- const errorImage = image || theme.images.general.notFound
23
- const isUrl = typeof errorImage === 'string' && errorImage.includes('http')
24
-
25
24
  return (
26
25
  <NotFound>
27
- {errorImage && (
26
+ {!hideImage && (
28
27
  <NotFoundImage>
29
- <OIcon url={isUrl && errorImage} src={!isUrl && errorImage} width={260} height={220} />
28
+ <Foundation
29
+ name='page-search'
30
+ color={theme.colors.primary}
31
+ size={60}
32
+ style={{ marginBottom: 10 }}
33
+ />
30
34
  </NotFoundImage>
31
35
  )}
32
- {content && conditioned && !errorImage && <OText color={theme.colors.disabled} size={18} style={{ textAlign: 'center' }}>{content}</OText>}
33
- {content && !conditioned && <OText color={theme.colors.disabled} size={18} style={{ textAlign: 'center' }}>{content}</OText>}
36
+ {content && conditioned && <OText color={theme.colors.disabled} size={16} style={{ textAlign: 'center' }}>{content}</OText>}
37
+ {content && !conditioned && <OText color={theme.colors.disabled} size={16} style={{ textAlign: 'center' }}>{content}</OText>}
34
38
  {!onClickButton && props.children && (
35
39
  props.children
36
40
  )}
37
41
  {onClickButton && (
38
42
  <View style={{ marginTop: 10, width: '100%' }}>
39
43
  <OButton
40
- style={{ width: '100%', height: 50 }}
44
+ style={{ width: '100%', height: 50, ...btnStyle }}
41
45
  bgColor={theme.colors.primary}
42
46
  borderColor={theme.colors.primary}
43
47
  onClick={() => onClickButton()}
@@ -23,21 +23,21 @@ export const PreviousProductsOrdered = (props: PreviousProductsOrderedParams) =>
23
23
  },
24
24
  });
25
25
 
26
- const ProductList = ({ style }: any) => {
26
+ const ProductList = () => {
27
27
  return (
28
28
  <>
29
29
  {products?.filter((product : any) => product?.business?.available)?.map((product: any) => (
30
- <SingleProductCard
31
- key={product?.id}
32
- isProductId
33
- isSoldOut={(product.inventoried && !product.quantity)}
34
- product={product}
35
- businessId={product?.business?.id}
36
- onProductClick={onProductClick}
37
- style={style}
38
- productAddedToCartLength={0}
39
- handleUpdateProducts={handleUpdateProducts}
40
- />
30
+ <SingleProductCard
31
+ key={product?.id}
32
+ isProductId
33
+ isSoldOut={(product.inventoried && !product.quantity)}
34
+ product={product}
35
+ businessId={product?.business?.id}
36
+ onProductClick={onProductClick}
37
+ style={{ width: windowWidth - (products?.length > 1 ? 120 : 80), marginRight: 20 }}
38
+ productAddedToCartLength={0}
39
+ handleUpdateProducts={handleUpdateProducts}
40
+ />
41
41
  ))}
42
42
  </>
43
43
  )
@@ -45,7 +45,7 @@ export const PreviousProductsOrdered = (props: PreviousProductsOrderedParams) =>
45
45
  return (
46
46
  <ScrollView horizontal={isBusinessesSearchList} style={styles.container} showsVerticalScrollIndicator={false}>
47
47
  {isBusinessesSearchList ? (
48
- <ProductList style={{ width: windowWidth - 80, marginRight: 20 }} />
48
+ <ProductList />
49
49
  ) : (
50
50
  <ListWrapper isBusinessesSearchList={isBusinessesSearchList}>
51
51
  <ProductList />
@@ -10,6 +10,7 @@ import { PreviousProductsOrdered } from './PreviousProductsOrdered'
10
10
  import { OptionTitle, NoOrdersWrapper } from './styles'
11
11
  import { OrdersOptionParams } from '../../types'
12
12
  import { _setStoreData } from '../../providers/StoreUtil';
13
+ import { NotFoundSource } from '../NotFoundSource';
13
14
  import {
14
15
  Placeholder,
15
16
  PlaceholderLine,
@@ -180,16 +181,13 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
180
181
  <>
181
182
  {!loading && ordersLength.activeOrdersLength === 0 && ordersLength.previousOrdersLength === 0 && !activeOrders && (
182
183
  <NoOrdersWrapper>
183
- <OText size={14} numberOfLines={1}>
184
- {t('YOU_DONT_HAVE_ORDERS', 'You don\'t have any orders')}
185
- </OText>
186
- <OButton
187
- text={t('ORDER_NOW', 'Order now')}
188
- onClick={() => onNavigationRedirect && onNavigationRedirect('BusinessList')}
189
- textStyle={{ color: 'white', fontSize: 14 }}
190
- style={{ borderRadius: 7.6, marginBottom: 10, marginTop: 10, height: 44, paddingLeft: 10, paddingRight: 10 }}
184
+ <NotFoundSource
185
+ hideImage
186
+ btnStyle={{ borderRadius: 8 }}
187
+ content={t('YOU_DONT_HAVE_ORDERS', 'You don\'t have any orders')}
188
+ btnTitle={t('ORDER_NOW', 'Order now')}
189
+ onClickButton={() => onNavigationRedirect && onNavigationRedirect('BusinessList')}
191
190
  />
192
-
193
191
  </NoOrdersWrapper>
194
192
  )}
195
193
  {((ordersLength?.activeOrdersLength > 0 && activeOrders) || (ordersLength?.previousOrdersLength > 0 && !activeOrders)) && (
@@ -10,5 +10,5 @@ export const OptionTitle = styled.View`
10
10
  export const NoOrdersWrapper = styled.View`
11
11
  flex-direction: column;
12
12
  align-items: center;
13
- margin-top: 50px;
13
+ margin-top: 60px;
14
14
  `
@@ -323,7 +323,7 @@ const SignupFormUI = (props: SignupParams) => {
323
323
  };
324
324
 
325
325
  const handleChangeInputEmail = (value: string, onChange: any) => {
326
- onChange(value.toLowerCase().replace(/[&,()%";:ç?<>{}\\[\]\s]/g, ''));
326
+ onChange(value.toLowerCase().trim().replace(/[&,()%";:ç?<>{}\\[\]\s]/g, ''));
327
327
  };
328
328
 
329
329
  const handleOpenTermsUrl = async (url: any) => {
@@ -352,8 +352,8 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
352
352
  <LottieAnimation
353
353
  type='favorite'
354
354
  onClick={handleChangeFavorite}
355
- initialValue={order?.favorite ? 0.75 : 0}
356
- toValue={order?.favorite ? 0 : 0.75}
355
+ initialValue={order?.favorite ? 0.5 : 0}
356
+ toValue={order?.favorite ? 0 : 0.5}
357
357
  style={{ marginBottom: 5 }}
358
358
  iconProps={{ color: theme.colors.danger5, size: 16, style: { top: 7 } }}
359
359
  isActive={order?.favorite}
@@ -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
- height: 30,
112
+ height: 30,
113
113
  marginRight: 5
114
114
  }
115
115
  });
@@ -201,8 +201,8 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
201
201
  <LottieAnimation
202
202
  type='favorite'
203
203
  onClick={handleChangeFavorite}
204
- initialValue={product?.favorite ? 0.75 : 0}
205
- toValue={product?.favorite ? 0 : 0.75}
204
+ initialValue={product?.favorite ? 0.5 : 0}
205
+ toValue={product?.favorite ? 0 : 0.5}
206
206
  disableAnimation={!auth}
207
207
  iconProps={{ color: theme.colors.danger5, size: 18 }}
208
208
  isActive={product?.favorite}
@@ -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} : any) => businessSingleId ? css`
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
- setAlertState({
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
- <Alert
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
  };
@@ -353,6 +353,8 @@ export interface NotFoundSourceParams {
353
353
  conditioned?: boolean,
354
354
  onClickButton?: any,
355
355
  children?: any
356
+ hideImage?: any
357
+ btnStyle?: any
356
358
  }
357
359
  export interface OrdersOptionParams {
358
360
  orderList?: any,
@@ -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
+ }