ordering-ui-react-native 0.23.27 → 0.23.29

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.23.27",
3
+ "version": "0.23.29",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -1,5 +1,4 @@
1
1
  import React, { useState, useCallback } from 'react'
2
-
3
2
  import { Platform, StyleSheet, View, TouchableOpacity, ScrollView } from 'react-native';
4
3
  import AntDesignIcon from 'react-native-vector-icons/AntDesign'
5
4
 
@@ -25,7 +24,8 @@ import {
25
24
  useLanguage,
26
25
  useUtils,
27
26
  useConfig,
28
- useSession
27
+ useSession,
28
+ useApi
29
29
  } from 'ordering-components/native';
30
30
  import { useTheme } from 'styled-components/native';
31
31
  import { ReviewCustomer } from '../ReviewCustomer'
@@ -46,6 +46,7 @@ interface OrderContent {
46
46
  export const OrderContentComponent = (props: OrderContent) => {
47
47
  const [, t] = useLanguage();
48
48
  const theme = useTheme()
49
+ const [ordering] = useApi()
49
50
  const [{ user }] = useSession()
50
51
  const { order, logisticOrderStatus, isOrderGroup, lastOrder } = props;
51
52
  const [{ parsePrice, parseNumber }] = useUtils();
@@ -439,9 +440,19 @@ export const OrderContentComponent = (props: OrderContent) => {
439
440
  </OText>
440
441
 
441
442
  {!!order?.comment && (
442
- <OText>
443
- {`${t('ORDER_COMMENT', 'Order Comment')}: ${order?.comment}`}
444
- </OText>
443
+ <>
444
+ <OText>
445
+ {`${t('ORDER_COMMENT', 'Order Comment')}: `}
446
+ </OText>
447
+ <OText
448
+ {...(ordering?.project?.includes('delosi') && {
449
+ color: theme.colors.primary,
450
+ weight: 'bold'
451
+ })}
452
+ >
453
+ {order?.comment}
454
+ </OText>
455
+ </>
445
456
  )}
446
457
 
447
458
  {order?.products?.length > 0 &&
@@ -1,87 +1,90 @@
1
1
  import React from 'react'
2
- import { useTheme } from 'styled-components/native'
3
2
  import { StyleSheet } from 'react-native'
4
- import { SubCategoriesContainer, ContainerButton } from './styles'
5
- import { OButton } from '../../shared'
6
3
  import { useLanguage } from 'ordering-components/native'
4
+ import FIcon from 'react-native-vector-icons/Feather'
5
+ import { SubCategoriesContainer, ContainerButton } from './styles'
6
+ import { OButton, OText } from '../../shared'
7
7
 
8
8
  function SubcategoriesComponentPropsAreEqual(prev: any, next: any) {
9
- return prev.subcategoriesSelected === next.subcategoriesSelected &&
10
- prev.category === next.category
9
+ return prev.subcategoriesSelected === next.subcategoriesSelected &&
10
+ prev.category === next.category
11
11
  }
12
12
 
13
13
  interface SubcategoriesComponentParams {
14
- subcategoriesSelected?: any,
15
- category?: any,
16
- onClickSubcategory: any
14
+ subcategoriesSelected?: any,
15
+ category?: any,
16
+ onClickSubcategory: any
17
17
  }
18
18
 
19
19
  const SubcategoriesComponent = (props: SubcategoriesComponentParams) => {
20
- const {
21
- subcategoriesSelected,
22
- category,
23
- onClickSubcategory
24
- } = props
20
+ const {
21
+ subcategoriesSelected,
22
+ category,
23
+ onClickSubcategory
24
+ } = props
25
25
 
26
- const theme = useTheme()
27
- const [, t] = useLanguage()
28
- const allsubcategorySelected = !subcategoriesSelected?.some((subcategory: any) => category?.id === subcategory?.parent_category_id)
26
+ const [, t] = useLanguage()
27
+ const allsubcategorySelected = !subcategoriesSelected?.some((subcategory: any) => category?.id === subcategory?.parent_category_id)
29
28
 
30
- const bpStyles = StyleSheet.create({
31
- catWrap: { flexDirection: 'row', alignItems: 'center', marginBottom: 19 },
32
- catIcon: {
33
- borderRadius: 7.6,
34
- shadowColor: '#000000',
35
- shadowOpacity: 0.1,
36
- shadowOffset: { width: 0, height: 0 },
37
- shadowRadius: 1,
38
- marginEnd: 13,
39
- },
40
- categoryButtonStyle: {
41
- borderWidth: 0,
42
- marginLeft: 5,
43
- marginRight: 5,
44
- marginBottom: 10,
45
- height: 35,
46
- paddingLeft: 3,
47
- paddingRight: 3,
48
- }
49
- });
29
+ const bpStyles = StyleSheet.create({
30
+ categoryButtonStyle: {
31
+ borderWidth: 0,
32
+ marginRight: 5,
33
+ borderRadius: 8,
34
+ marginBottom: 5,
35
+ height: 35,
36
+ padding: 0,
37
+ paddingLeft: 3,
38
+ paddingRight: 3,
39
+ }
40
+ });
50
41
 
51
42
 
52
- return (
53
- <SubCategoriesContainer>
54
- <ContainerButton
55
- isSelected={allsubcategorySelected}
56
- >
57
- <OButton
58
- onClick={() => onClickSubcategory(null, category)}
59
- text={`${t('ALL', 'All')} ${allsubcategorySelected ? 'X' : ''}`}
60
- style={bpStyles.categoryButtonStyle}
61
- textStyle={{ fontSize: 12 }}
62
- isDisabled={!allsubcategorySelected}
63
- />
64
- </ContainerButton>
65
- {category?.subcategories?.map((subcategory: any) => {
66
- const isSubcategorySelected = subcategoriesSelected?.find((_subcategory: any) => _subcategory?.id === subcategory?.id)
67
- return (
68
- <ContainerButton
69
- key={subcategory?.id}
70
- isSelected={isSubcategorySelected}
71
- >
72
- <OButton
73
- onClick={() => onClickSubcategory(subcategory, category)}
74
- text={`${subcategory?.name} ${isSubcategorySelected ? 'X' : ''}`}
75
- style={bpStyles.categoryButtonStyle}
76
- textStyle={{ fontSize: 12 }}
77
- isDisabled={!allsubcategorySelected}
78
- />
79
- </ContainerButton>
80
- )
81
- }
82
- )}
83
- </SubCategoriesContainer>
84
- )
43
+ return (
44
+ <SubCategoriesContainer>
45
+ <ContainerButton
46
+ isSelected={allsubcategorySelected}
47
+ >
48
+ <OButton
49
+ onClick={() => onClickSubcategory(null, category)}
50
+ text={
51
+ allsubcategorySelected
52
+ ? <OText color='#FFF'>
53
+ {t('ALL', 'All')}{' '}
54
+ <FIcon name='x-circle' size={16} />
55
+ </OText>
56
+ : t('ALL', 'All')
57
+ }
58
+ style={bpStyles.categoryButtonStyle}
59
+ textStyle={{ fontSize: 12 }}
60
+ />
61
+ </ContainerButton>
62
+ {category?.subcategories?.map((subcategory: any) => {
63
+ const isSubcategorySelected = subcategoriesSelected?.find((_subcategory: any) => _subcategory?.id === subcategory?.id)
64
+ return (
65
+ <ContainerButton
66
+ key={subcategory?.id}
67
+ isSelected={isSubcategorySelected}
68
+ >
69
+ <OButton
70
+ onClick={() => onClickSubcategory(subcategory, category)}
71
+ text={
72
+ isSubcategorySelected
73
+ ? <OText color='#FFF'>
74
+ {subcategory?.name}{' '}
75
+ <FIcon name='x-circle' size={16} />
76
+ </OText>
77
+ : subcategory?.name
78
+ }
79
+ style={bpStyles.categoryButtonStyle}
80
+ textStyle={{ fontSize: 12 }}
81
+ />
82
+ </ContainerButton>
83
+ )
84
+ }
85
+ )}
86
+ </SubCategoriesContainer>
87
+ )
85
88
  }
86
89
 
87
90
  export const SubcategoriesComponentMemoized = React.memo(SubcategoriesComponent, SubcategoriesComponentPropsAreEqual)
@@ -65,11 +65,10 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
65
65
  return
66
66
  }
67
67
  const categoryFounded = subcategoriesSelected.find((_subcategory: any) => subCategory?.id === _subcategory?.id)
68
- if (categoryFounded) {
69
- setSubcategoriesSelected?.(subcategoriesSelected.filter((_subcategory: any) => subCategory?.id !== _subcategory?.id))
70
- } else {
71
- setSubcategoriesSelected?.([...subcategoriesSelected, subCategory])
72
- }
68
+ setSubcategoriesSelected?.(categoryFounded
69
+ ? subcategoriesSelected.filter((_subcategory: any) => subCategory?.id !== _subcategory?.id)
70
+ : [...subcategoriesSelected, subCategory]
71
+ )
73
72
  }
74
73
 
75
74
  return (