ordering-ui-admin-external 1.16.3 → 1.18.0

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 (99) hide show
  1. package/_bundles/{ordering-ui-admin.55509d77028dd5804399.js → ordering-ui-admin.d6ceaa81e226693746d5.js} +2 -2
  2. package/_modules/components/Delivery/DeliveryUsersListing/index.js +4 -2
  3. package/_modules/components/Delivery/DriversGroupLogistics/index.js +1 -1
  4. package/_modules/components/Delivery/DriversGroupLogs/index.js +1 -0
  5. package/_modules/components/Delivery/DriversGroupsList/index.js +15 -7
  6. package/_modules/components/Delivery/DriversGroupsList/styles.js +26 -27
  7. package/_modules/components/Delivery/UsersList/index.js +47 -51
  8. package/_modules/components/Delivery/UsersList/styles.js +6 -4
  9. package/_modules/components/Home/HomePage/index.js +1 -7
  10. package/_modules/components/MyProducts/AdvancedSettings/ButtonShadow.js +98 -0
  11. package/_modules/components/MyProducts/AdvancedSettings/FontStyleGroup.js +28 -7
  12. package/_modules/components/MyProducts/AdvancedSettings/HideCheckBox.js +47 -0
  13. package/_modules/components/MyProducts/AdvancedSettings/ImageBox.js +12 -3
  14. package/_modules/components/MyProducts/AdvancedSettings/SettingComponent.js +15 -15
  15. package/_modules/components/MyProducts/AdvancedSettings/index.js +102 -117
  16. package/_modules/components/MyProducts/AppResources/index.js +132 -0
  17. package/_modules/components/Orders/Messages/index.js +9 -5
  18. package/_modules/components/Orders/OrderBill/index.js +1 -1
  19. package/_modules/components/Orders/OrderNotification/index.js +4 -2
  20. package/_modules/components/Orders/OrdersManager/index.js +3 -1
  21. package/_modules/components/Settings/CardFieldsSetting/index.js +98 -0
  22. package/_modules/components/Settings/CardFieldsSetting/styles.js +21 -0
  23. package/_modules/components/Settings/Settings/index.js +12 -1
  24. package/_modules/components/Settings/index.js +8 -1
  25. package/_modules/components/SidebarMenu/index.js +36 -34
  26. package/_modules/components/Stores/BusinessAdd/DeliveryZone/index.js +1 -1
  27. package/_modules/components/Stores/BusinessCateringDelivery/index.js +2 -2
  28. package/_modules/components/Stores/BusinessDeliveryZoneInformation/index.js +1 -1
  29. package/_modules/components/Stores/BusinessDeliveryZoneList/index.js +1 -1
  30. package/_modules/components/Stores/BusinessDetails/index.js +34 -8
  31. package/_modules/components/Stores/BusinessPlace/index.js +127 -0
  32. package/_modules/components/Stores/BusinessPlace/styles.js +55 -0
  33. package/_modules/components/Stores/BusinessPlaceGroup/index.js +258 -0
  34. package/_modules/components/Stores/BusinessPlaceGroup/styles.js +102 -0
  35. package/_modules/components/Stores/BusinessPreorderDetails/index.js +13 -1
  36. package/_modules/components/Stores/BusinessProductList/index.js +3 -3
  37. package/_modules/components/Stores/BusinessProductsListing/index.js +2 -1
  38. package/_modules/components/Stores/BusinessSummary/index.js +12 -3
  39. package/_modules/components/Stores/BusinessTypes/index.js +1 -1
  40. package/_modules/components/Stores/ProductIngredient/index.js +1 -1
  41. package/_modules/components/Stores/ProductStep/index.js +15 -3
  42. package/_modules/components/Stores/ProductTagsList/index.js +1 -1
  43. package/_modules/components/Stores/SpoonityApiKey/index.js +97 -0
  44. package/_modules/components/Stores/SpoonityApiKey/styles.js +47 -0
  45. package/_modules/components/Stores/UploadMenuGuide/index.js +8 -0
  46. package/_modules/components/Users/CustomerPointsWallet/index.js +126 -9
  47. package/_modules/components/Users/CustomerPointsWallet/styles.js +8 -4
  48. package/_modules/components/Users/ProfessionalListing/index.js +33 -1
  49. package/_modules/index.js +6 -0
  50. package/package.json +2 -2
  51. package/src/components/Delivery/DeliveryUsersListing/index.js +3 -1
  52. package/src/components/Delivery/DriversGroupLogistics/index.js +1 -1
  53. package/src/components/Delivery/DriversGroupLogs/index.js +2 -0
  54. package/src/components/Delivery/DriversGroupsList/index.js +20 -3
  55. package/src/components/Delivery/DriversGroupsList/styles.js +9 -14
  56. package/src/components/Delivery/UsersList/index.js +79 -61
  57. package/src/components/Delivery/UsersList/styles.js +4 -12
  58. package/src/components/Home/HomePage/index.js +2 -2
  59. package/src/components/MyProducts/AdvancedSettings/ButtonShadow.js +102 -0
  60. package/src/components/MyProducts/AdvancedSettings/FontStyleGroup.js +23 -5
  61. package/src/components/MyProducts/AdvancedSettings/HideCheckBox.js +33 -0
  62. package/src/components/MyProducts/AdvancedSettings/ImageBox.js +10 -3
  63. package/src/components/MyProducts/AdvancedSettings/SettingComponent.js +10 -15
  64. package/src/components/MyProducts/AdvancedSettings/index.js +119 -149
  65. package/src/components/MyProducts/AppResources/index.js +167 -0
  66. package/src/components/Orders/Messages/index.js +38 -0
  67. package/src/components/Orders/OrderBill/index.js +1 -1
  68. package/src/components/Orders/OrderNotification/index.js +6 -2
  69. package/src/components/Orders/OrdersManager/index.js +1 -1
  70. package/src/components/Settings/CardFieldsSetting/index.js +72 -0
  71. package/src/components/Settings/CardFieldsSetting/styles.js +47 -0
  72. package/src/components/Settings/Settings/index.js +16 -1
  73. package/src/components/Settings/index.js +3 -2
  74. package/src/components/SidebarMenu/index.js +15 -10
  75. package/src/components/Stores/BusinessAdd/DeliveryZone/index.js +1 -1
  76. package/src/components/Stores/BusinessCateringDelivery/index.js +1 -1
  77. package/src/components/Stores/BusinessDeliveryZoneInformation/index.js +1 -1
  78. package/src/components/Stores/BusinessDeliveryZoneList/index.js +1 -1
  79. package/src/components/Stores/BusinessDetails/index.js +33 -2
  80. package/src/components/Stores/BusinessPlace/index.js +137 -0
  81. package/src/components/Stores/BusinessPlace/styles.js +132 -0
  82. package/src/components/Stores/BusinessPlaceGroup/index.js +272 -0
  83. package/src/components/Stores/BusinessPlaceGroup/styles.js +248 -0
  84. package/src/components/Stores/BusinessPreorderDetails/index.js +2 -2
  85. package/src/components/Stores/BusinessProductList/index.js +9 -1
  86. package/src/components/Stores/BusinessProductsListing/index.js +1 -0
  87. package/src/components/Stores/BusinessSummary/index.js +16 -5
  88. package/src/components/Stores/BusinessTypes/index.js +1 -1
  89. package/src/components/Stores/ProductIngredient/index.js +1 -1
  90. package/src/components/Stores/ProductStep/index.js +19 -2
  91. package/src/components/Stores/ProductTagsList/index.js +1 -1
  92. package/src/components/Stores/SpoonityApiKey/index.js +87 -0
  93. package/src/components/Stores/SpoonityApiKey/styles.js +68 -0
  94. package/src/components/Stores/UploadMenuGuide/index.js +10 -1
  95. package/src/components/Users/CustomerPointsWallet/index.js +130 -2
  96. package/src/components/Users/CustomerPointsWallet/styles.js +40 -1
  97. package/src/components/Users/ProfessionalListing/index.js +21 -1
  98. package/src/index.js +3 -2
  99. /package/_bundles/{ordering-ui-admin.55509d77028dd5804399.js.LICENSE.txt → ordering-ui-admin.d6ceaa81e226693746d5.js.LICENSE.txt} +0 -0
@@ -7,7 +7,6 @@ import FaUserAlt from '@meronex/icons/fa/FaUserAlt'
7
7
  import { Envelope, Phone } from 'react-bootstrap-icons'
8
8
 
9
9
  import { Switch } from '../../../styles'
10
- import { UserTypeSelector } from '../../Users'
11
10
  import { Pagination, ConfirmAdmin } from '../../Shared'
12
11
 
13
12
  import {
@@ -19,13 +18,13 @@ import {
19
18
  UserMainInfo,
20
19
  CheckBoxWrapper,
21
20
  InfoBlock,
22
- UserTypeWrapper,
23
21
  UserEnableWrapper,
24
22
  WrapperPagination,
25
23
  AddNewUserButton,
26
24
  UsersBottomContainer,
27
25
  VerifiedItemsContainer,
28
- VerifiedItem
26
+ VerifiedItem,
27
+ UserIdWrapper
29
28
  } from './styles'
30
29
 
31
30
  export const UsersList = (props) => {
@@ -34,7 +33,6 @@ export const UsersList = (props) => {
34
33
  usersList,
35
34
  paginationProps,
36
35
  getUsers,
37
- handleChangeUserType,
38
36
  handleChangeActiveUser,
39
37
  selectedUsers,
40
38
  handleSelectedUsers,
@@ -42,25 +40,15 @@ export const UsersList = (props) => {
42
40
  handleOpenUserAddForm,
43
41
  isDriversPage,
44
42
  isDriversManagersPage,
45
- actionDisabled
43
+ actionDisabled,
44
+ setSelectedUsers
46
45
  } = props
47
46
 
48
47
  const [, t] = useLanguage()
49
48
  const [{ optimizeImage }] = useUtils()
50
49
 
51
50
  const [confirmAdmin, setConfirmAdmin] = useState({ open: false, handleOnConfirm: null })
52
-
53
- const getUserType = (type) => {
54
- const userTypes = [
55
- { key: 0, value: t('ADMINISTRATOR', 'Administrator') },
56
- { key: 1, value: t('CITY_MANAGER', 'City manager') },
57
- { key: 2, value: t('BUSINESS_OWNER', 'Business owner') },
58
- { key: 3, value: t('USER', 'User') }
59
- ]
60
-
61
- const objectStatus = userTypes.find(o => o.key === type)
62
- return objectStatus && objectStatus
63
- }
51
+ const [isAllChecked, setIsAllChecked] = useState(false)
64
52
 
65
53
  const onChangeUserDetails = (e, user) => {
66
54
  const isInvalid = e.target.closest('.user_checkbox') || e.target.closest('.user_type_selector') || e.target.closest('.user_enable_control') || e.target.closest('.user_action')
@@ -91,20 +79,26 @@ export const UsersList = (props) => {
91
79
  }
92
80
  }
93
81
 
94
- const onChangeUserType = (user, type) => {
95
- if (user.level !== 0) {
96
- handleChangeUserType(type)
82
+ const handleSelecteAllUser = () => {
83
+ const userIds = usersList.users?.reduce((ids, user) => [...ids, user.id], [])
84
+ if (!isAllChecked) {
85
+ setSelectedUsers([...selectedUsers, ...userIds])
97
86
  } else {
98
- setConfirmAdmin({
99
- open: true,
100
- handleOnConfirm: () => {
101
- setConfirmAdmin({ ...confirmAdmin, open: false })
102
- handleChangeUserType(type)
103
- }
87
+ const userIdsToDeleteSet = new Set(userIds)
88
+ const updatedSelectedOrderIds = selectedUsers.filter((name) => {
89
+ return !userIdsToDeleteSet.has(name)
104
90
  })
91
+ setSelectedUsers(updatedSelectedOrderIds)
105
92
  }
106
93
  }
107
94
 
95
+ useEffect(() => {
96
+ if (usersList.loading) return
97
+ const userIds = usersList.users?.reduce((ids, user) => [...ids, user.id], [])
98
+ const _isAllChecked = userIds.every(elem => selectedUsers.includes(elem))
99
+ setIsAllChecked(_isAllChecked)
100
+ }, [usersList.users, selectedUsers])
101
+
108
102
  useEffect(() => {
109
103
  if (usersList.loading || usersList.users.length > 0 || paginationProps.totalPages <= 1) return
110
104
  if (paginationProps.currentPage !== paginationProps.totalPages) {
@@ -121,9 +115,26 @@ export const UsersList = (props) => {
121
115
  <UsersTable>
122
116
  <thead>
123
117
  <tr>
118
+ {isDriversPage && (
119
+ <th>
120
+ <UserIdWrapper>
121
+ <CheckBoxWrapper
122
+ className='all-checkbox'
123
+ isChecked={!usersList?.loading && isAllChecked}
124
+ onClick={() => handleSelecteAllUser()}
125
+ >
126
+ {(!usersList?.loading && isAllChecked) ? (
127
+ <MdCheckBox />
128
+ ) : (
129
+ <MdCheckBoxOutlineBlank />
130
+ )}
131
+ </CheckBoxWrapper>
132
+ {t('ID', 'ID')}
133
+ </UserIdWrapper>
134
+ </th>
135
+ )}
124
136
  <th>{t('USER', 'User')}</th>
125
137
  <th>{t('DETAILS', 'Details')}</th>
126
- <th />
127
138
  <th colSpan={2}>{t('ACTION', 'Action')}</th>
128
139
  </tr>
129
140
  </thead>
@@ -131,11 +142,18 @@ export const UsersList = (props) => {
131
142
  [...Array(10).keys()].map(i => (
132
143
  <tbody key={i}>
133
144
  <tr>
145
+ {isDriversPage && (
146
+ <td>
147
+ <UserIdWrapper>
148
+ <CheckBoxWrapper>
149
+ <Skeleton width={20} height={20} />
150
+ </CheckBoxWrapper>
151
+ <Skeleton width={40} />
152
+ </UserIdWrapper>
153
+ </td>
154
+ )}
134
155
  <td>
135
156
  <UserMainInfo>
136
- <CheckBoxWrapper>
137
- <Skeleton width={20} height={20} />
138
- </CheckBoxWrapper>
139
157
  <WrapperImage isSkeleton>
140
158
  <Skeleton width={45} height={45} />
141
159
  </WrapperImage>
@@ -151,14 +169,6 @@ export const UsersList = (props) => {
151
169
  <p><Skeleton width={100} /></p>
152
170
  </InfoBlock>
153
171
  </td>
154
- <td>
155
- {!(isDriversPage || isDriversManagersPage) && (
156
- <UserTypeWrapper>
157
- <Skeleton width={100} />
158
- <p><Skeleton width={100} /></p>
159
- </UserTypeWrapper>
160
- )}
161
- </td>
162
172
  <td>
163
173
  <UserEnableWrapper>
164
174
  <span><Skeleton width={100} /></span>
@@ -174,19 +184,39 @@ export const UsersList = (props) => {
174
184
  <tr
175
185
  onClick={(e) => onChangeUserDetails(e, user)}
176
186
  >
187
+ {isDriversPage && (
188
+ <td>
189
+ <UserIdWrapper>
190
+ <CheckBoxWrapper
191
+ className='user_checkbox'
192
+ isChecked={selectedUsers.includes(user.id)}
193
+ onClick={() => handleSelectedUsers(user.id)}
194
+ >
195
+ {selectedUsers.includes(user.id) ? (
196
+ <MdCheckBox />
197
+ ) : (
198
+ <MdCheckBoxOutlineBlank />
199
+ )}
200
+ </CheckBoxWrapper>
201
+ {user?.id}
202
+ </UserIdWrapper>
203
+ </td>
204
+ )}
177
205
  <td>
178
206
  <UserMainInfo>
179
- <CheckBoxWrapper
180
- className='user_checkbox'
181
- isChecked={selectedUsers.includes(user.id)}
182
- onClick={() => handleSelectedUsers(user.id)}
183
- >
184
- {selectedUsers.includes(user.id) ? (
185
- <MdCheckBox />
186
- ) : (
187
- <MdCheckBoxOutlineBlank />
188
- )}
189
- </CheckBoxWrapper>
207
+ {isDriversManagersPage && (
208
+ <CheckBoxWrapper
209
+ className='user_checkbox'
210
+ isChecked={selectedUsers.includes(user.id)}
211
+ onClick={() => handleSelectedUsers(user.id)}
212
+ >
213
+ {selectedUsers.includes(user.id) ? (
214
+ <MdCheckBox />
215
+ ) : (
216
+ <MdCheckBoxOutlineBlank />
217
+ )}
218
+ </CheckBoxWrapper>
219
+ )}
190
220
  <WrapperImage>
191
221
  {user?.photo ? (
192
222
  <Image bgimage={optimizeImage(user?.photo, 'h_50,c_limit')} />
@@ -223,18 +253,6 @@ export const UsersList = (props) => {
223
253
  <p>{user?.cellphone}</p>
224
254
  </InfoBlock>
225
255
  </td>
226
- <td>
227
- {!(isDriversPage || isDriversManagersPage) && (
228
- <UserTypeWrapper className='user_type_selector'>
229
- <UserTypeSelector
230
- userId={user.id}
231
- defaultUserType={user?.level}
232
- handleChangeUserType={(type) => onChangeUserType(user, type)}
233
- />
234
- <p>{getUserType(user?.level)?.value}</p>
235
- </UserTypeWrapper>
236
- )}
237
- </td>
238
256
  <td>
239
257
  <UserEnableWrapper className='user_enable_control'>
240
258
  <span>{t('ENABLE', 'Enable')}</span>
@@ -17,18 +17,6 @@ export const UsersTable = styled.table`
17
17
  td, th {
18
18
  padding: 10px 0;
19
19
  font-size: 14px;
20
- &:first-child {
21
- width: 40%;
22
- }
23
- &:nth-child(2) {
24
- width: 20%;
25
- }
26
-
27
- &:nth-child(4),
28
-
29
- &:nth-child(5) {
30
- width: 10%;
31
- }
32
20
  }
33
21
 
34
22
  thead {
@@ -266,3 +254,7 @@ export const VerifiedItemsContainer = styled.div`
266
254
  }
267
255
  }
268
256
  `
257
+ export const UserIdWrapper = styled.div`
258
+ display: flex;
259
+ align-items: center;
260
+ `
@@ -249,13 +249,13 @@ const HomeUI = (props) => {
249
249
  >
250
250
  {project[projectStatus.project?.current_status]?.status}
251
251
  </ProjectCurrentStatus>
252
- <Button
252
+ {/* <Button
253
253
  color='primary'
254
254
  borderRadius='8px'
255
255
  onClick={() => window.open(`https://${ordering?.project}.tryordering.com`, '_blank')}
256
256
  >
257
257
  {t('VISIT_MY_WEBSITE', 'Visit my Website')}
258
- </Button>
258
+ </Button> */}
259
259
  </ProjectStatusWrapper>
260
260
  </ProjectInfoWrapper>
261
261
  <img src={project[projectStatus.project?.current_status]?.image} alt='' />
@@ -0,0 +1,102 @@
1
+ import React, { useMemo, useState, useEffect } from 'react'
2
+ import { useLanguage } from 'ordering-components-admin-external'
3
+
4
+ import {
5
+ DropShadowWrapper,
6
+ ShadowInfoWrapper,
7
+ DropShadow,
8
+ ShadowInputGroup,
9
+ ShadowInputControl
10
+ } from './styles'
11
+
12
+ export const ButtonShadow = (props) => {
13
+ const { initialValues, handleUpdateThemeValue, path } = props
14
+
15
+ const [, t] = useLanguage()
16
+ const [shadow, setShadow] = useState({})
17
+
18
+ const shadowValues = useMemo(() => {
19
+ if (!shadow?.x || !shadow?.y || !shadow?.blur || !shadow?.spread) return ''
20
+ return `${shadow?.x}px ${shadow?.y}px ${shadow?.blur}px ${shadow?.spread}px ${shadow?.color}`
21
+ }, [shadow])
22
+
23
+ const handleChangeInput = (value, name) => {
24
+ handleUpdateThemeValue(value, [path, name].join('.'))
25
+ setShadow({ ...shadow, [name]: value })
26
+ }
27
+
28
+ useEffect(() => {
29
+ if (!initialValues) return
30
+ setShadow(JSON.parse(JSON.stringify(initialValues)))
31
+ }, [initialValues])
32
+
33
+ return (
34
+ <DropShadowWrapper>
35
+ <ShadowInfoWrapper>
36
+ <DropShadow
37
+ style={{
38
+ boxShadow: shadowValues
39
+ }}
40
+ />
41
+ <span>{t('DROP_SHADOW', 'Drop shadow')}</span>
42
+ </ShadowInfoWrapper>
43
+ <ShadowInputGroup>
44
+ <ShadowInputControl>
45
+ <span>X</span>
46
+ <input
47
+ value={shadow?.x || ''}
48
+ onKeyPress={(e) => {
49
+ if (!/^[0-9]$/.test(e.key)) {
50
+ e.preventDefault()
51
+ }
52
+ }}
53
+ onChange={(e) => handleChangeInput(e.target.value, 'x')}
54
+ />
55
+ </ShadowInputControl>
56
+ <ShadowInputControl>
57
+ <span>Y</span>
58
+ <input
59
+ value={shadow?.y || ''}
60
+ onChange={(e) => handleChangeInput(e.target.value, 'y')}
61
+ onKeyPress={(e) => {
62
+ if (!/^[0-9]$/.test(e.key)) {
63
+ e.preventDefault()
64
+ }
65
+ }}
66
+ />
67
+ </ShadowInputControl>
68
+ <ShadowInputControl>
69
+ <span>B</span>
70
+ <input
71
+ value={shadow?.blur || ''}
72
+ onChange={(e) => handleChangeInput(e.target.value, 'blur')}
73
+ onKeyPress={(e) => {
74
+ if (!/^[0-9]$/.test(e.key)) {
75
+ e.preventDefault()
76
+ }
77
+ }}
78
+ />
79
+ </ShadowInputControl>
80
+ <ShadowInputControl>
81
+ <span>S</span>
82
+ <input
83
+ value={shadow?.spread || ''}
84
+ onChange={(e) => handleChangeInput(e.target.value, 'spread')}
85
+ onKeyPress={(e) => {
86
+ if (!/^[0-9]$/.test(e.key)) {
87
+ e.preventDefault()
88
+ }
89
+ }}
90
+ />
91
+ </ShadowInputControl>
92
+ <ShadowInputControl>
93
+ <span>C</span>
94
+ <input
95
+ value={shadow?.color || ''}
96
+ onChange={(e) => handleChangeInput(e.target.value, 'color')}
97
+ />
98
+ </ShadowInputControl>
99
+ </ShadowInputGroup>
100
+ </DropShadowWrapper>
101
+ )
102
+ }
@@ -1,4 +1,4 @@
1
- import React from 'react'
1
+ import React, { useEffect, useState } from 'react'
2
2
  import { useLanguage } from 'ordering-components-admin-external'
3
3
  import { RecordCircleFill, Circle } from 'react-bootstrap-icons'
4
4
  import { Select } from '../../../styles/Select/FirstSelect'
@@ -14,6 +14,9 @@ export const FontStyleGroup = (props) => {
14
14
  const { isBody, fonts, path, handleUpdateThemeValue } = props
15
15
  const [, t] = useLanguage()
16
16
 
17
+ const [weights, setWeights] = useState([])
18
+ const [font, setFont] = useState('Poppins')
19
+
17
20
  const fontFamilyList = [
18
21
  { value: 'Poppins', content: <Option>{t('POPPINS', 'Poppins')}</Option> },
19
22
  { value: 'Lobster', content: <Option>{t('LOBSTER', 'Lobster')}</Option> },
@@ -32,6 +35,21 @@ export const FontStyleGroup = (props) => {
32
35
  { value: 900, name: '900 - Black (Heavy)' }
33
36
  ]
34
37
 
38
+ const handleChangeWeights = (value) => {
39
+ handleUpdateThemeValue([value], [path, 'weights'].join('.'))
40
+ setWeights([value])
41
+ }
42
+
43
+ const handleUpdateFont = (value) => {
44
+ handleUpdateThemeValue(value, [path, 'name'].join('.'))
45
+ setFont(value)
46
+ }
47
+
48
+ useEffect(() => {
49
+ setWeights(fonts?.weights)
50
+ setFont(fonts?.name)
51
+ }, [JSON.stringify(fonts)])
52
+
35
53
  return (
36
54
  <>
37
55
  <FormControl>
@@ -40,9 +58,9 @@ export const FontStyleGroup = (props) => {
40
58
  <Select
41
59
  options={fontFamilyList}
42
60
  className='select'
43
- defaultValue={fonts?.name}
61
+ defaultValue={font}
44
62
  placeholder={t('SELECT_OPTION', 'Select an option')}
45
- onChange={(value) => handleUpdateThemeValue(value, [path, 'name'].join('.'))}
63
+ onChange={(value) => handleUpdateFont(value)}
46
64
  />
47
65
  </SelectWrapper>
48
66
  </FormControl>
@@ -52,8 +70,8 @@ export const FontStyleGroup = (props) => {
52
70
  </label>
53
71
  <FontWeightListWrapper>
54
72
  {fontWeightList.map(weight => (
55
- <FontWeightItem key={weight.value} onClick={() => handleUpdateThemeValue([weight?.value], [path, 'weights'].join('.'))}>
56
- {fonts?.weights?.includes(weight.value) ? <RecordCircleFill className='active' /> : <Circle />}
73
+ <FontWeightItem key={weight.value} onClick={() => handleChangeWeights(weight?.value)}>
74
+ {weights?.includes(weight.value) ? <RecordCircleFill className='active' /> : <Circle />}
57
75
  <span>{weight.name}</span>
58
76
  </FontWeightItem>
59
77
  ))}
@@ -0,0 +1,33 @@
1
+ import React, { useState, useEffect } from 'react'
2
+ import { useLanguage } from 'ordering-components-admin-external'
3
+ import {
4
+ CheckSquareFill as CheckedIcon,
5
+ Square as UnCheckedIcon
6
+ } from 'react-bootstrap-icons'
7
+ import { FormControl, HideCheckWrapper } from './styles'
8
+
9
+ export const HideCheckBox = (props) => {
10
+ const { handleUpdateThemeValue, setting, initialCheck, noLabel } = props
11
+ const [isCheck, setIsCheck] = useState(false)
12
+
13
+ const [, t] = useLanguage()
14
+
15
+ const handleClick = () => {
16
+ handleUpdateThemeValue(!isCheck, setting?.path)
17
+ setIsCheck(!isCheck)
18
+ }
19
+
20
+ useEffect(() => {
21
+ setIsCheck(initialCheck)
22
+ }, [initialCheck])
23
+
24
+ return (
25
+ <FormControl>
26
+ {!noLabel && (<label>{setting.name}</label>)}
27
+ <HideCheckWrapper onClick={() => handleClick()}>
28
+ {isCheck ? <CheckedIcon className='active' /> : <UnCheckedIcon />}
29
+ <span>{noLabel ? setting.name : t('HIDDEN', 'Hidden')} </span>
30
+ </HideCheckWrapper>
31
+ </FormControl>
32
+ )
33
+ }
@@ -1,4 +1,4 @@
1
- import React, { useRef, useState } from 'react'
1
+ import React, { useEffect, useRef, useState } from 'react'
2
2
  import { useLanguage, ExamineClick, DragAndDrop } from 'ordering-components-admin-external'
3
3
  import { bytesConverter } from '../../../utils'
4
4
  import { Image as DumyPhoto } from 'react-bootstrap-icons'
@@ -18,9 +18,11 @@ export const ImageBox = (props) => {
18
18
  const imageRef = useRef()
19
19
  const [alertState, setAlertState] = useState({ open: false, content: [] })
20
20
  const [cropState, setCropState] = useState({ name: null, data: null, open: false })
21
+ const [picture, setPicture] = useState('')
21
22
 
22
23
  const handleChangeImage = (croppedImg) => {
23
24
  handleChangePhoto(croppedImg, path)
25
+ setPicture(croppedImg)
24
26
  setCropState({ name: null, data: null, open: false })
25
27
  }
26
28
 
@@ -58,6 +60,11 @@ export const ImageBox = (props) => {
58
60
  })
59
61
  }
60
62
 
63
+ useEffect(() => {
64
+ if (!photo) return
65
+ setPicture(photo)
66
+ }, [photo])
67
+
61
68
  return (
62
69
  <div>
63
70
  <ImageBoxContainer isBig={isBig} onClick={() => imageRef.current.click()}>
@@ -70,8 +77,8 @@ export const ImageBox = (props) => {
70
77
  onDrop={dataTransfer => handleFiles(dataTransfer.files, 'logo')}
71
78
  accept='image/png, image/jpeg, image/jpg'
72
79
  >
73
- {photo && <img src={photo} alt='logo image' loading='lazy' />}
74
- <UploadImageIconContainer bgimage={photo}>
80
+ {picture && <img src={picture} alt='logo image' loading='lazy' />}
81
+ <UploadImageIconContainer bgimage={picture}>
75
82
  <UploadImageIcon>
76
83
  <DumyPhoto />
77
84
  <span>{t('DRAG_AND_DROP', 'Drag and drop')}</span>
@@ -1,22 +1,18 @@
1
1
  import React from 'react'
2
2
  import { useLanguage } from 'ordering-components-admin-external'
3
3
  import { Select } from '../../../styles/Select/FirstSelect'
4
+ import { ColorPicker } from '../../Shared'
5
+ import { Input } from '../../../styles'
6
+ import { HideCheckBox } from './HideCheckBox'
4
7
  import { ImageBox } from './ImageBox'
5
- import {
6
- CheckSquareFill as CheckedIcon,
7
- Square as UnCheckedIcon
8
- } from 'react-bootstrap-icons'
9
8
  import {
10
9
  FormControl,
11
- HideCheckWrapper,
12
10
  SelectWrapper,
13
11
  Option
14
12
  } from './styles'
15
- import { ColorPicker } from '../../Shared'
16
- import { Input } from '../../../styles'
17
13
 
18
14
  export const SettingComponent = (props) => {
19
- const { settingList, handleUpdateThemeValue, advancedValues, themeStructure } = props
15
+ const { settingList, handleUpdateThemeValue, advancedValues, themeStructure, noLabel } = props
20
16
 
21
17
  const [, t] = useLanguage()
22
18
 
@@ -47,13 +43,12 @@ export const SettingComponent = (props) => {
47
43
  {settingList.map((setting, i) => (
48
44
  <React.Fragment key={i}>
49
45
  {setting.type === 'hidden' && (
50
- <FormControl>
51
- <label>{setting.name}</label>
52
- <HideCheckWrapper onClick={() => handleUpdateThemeValue(!deepFind(advancedValues, setting?.path), setting?.path)}>
53
- {deepFind(advancedValues, setting?.path) ? <CheckedIcon className='active' /> : <UnCheckedIcon />}
54
- <span>{t('HIDDEN', 'Hidden')}</span>
55
- </HideCheckWrapper>
56
- </FormControl>
46
+ <HideCheckBox
47
+ handleUpdateThemeValue={handleUpdateThemeValue}
48
+ setting={setting}
49
+ initialCheck={deepFind(advancedValues, setting?.path)}
50
+ noLabel={noLabel}
51
+ />
57
52
  )}
58
53
  {setting.type === 'position' && (
59
54
  <FormControl>