ordering-ui-external 14.1.46 → 14.1.47
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/_bundles/{7.ordering-ui.247fbb361bb31d72a262.js → 7.ordering-ui.a574355896c3077ecd50.js} +1 -1
- package/_bundles/ordering-ui.a574355896c3077ecd50.js +2 -0
- package/_modules/components/LogoutButton/index.js +1 -7
- package/_modules/themes/callcenterOriginal/src/components/Header/index.js +5 -7
- package/_modules/themes/callcenterOriginal/src/components/Header/styles.js +8 -12
- package/_modules/themes/callcenterOriginal/src/components/HeaderOption/index.js +6 -26
- package/_modules/themes/callcenterOriginal/src/components/HeaderOption/styles.js +1 -1
- package/_modules/themes/callcenterOriginal/src/components/SidebarMenu/index.js +74 -69
- package/_modules/themes/callcenterOriginal/src/components/UserPopover/index.js +30 -21
- package/package.json +1 -1
- package/src/components/LogoutButton/index.js +3 -5
- package/src/themes/callcenterOriginal/src/components/Header/index.js +14 -12
- package/src/themes/callcenterOriginal/src/components/Header/styles.js +18 -40
- package/src/themes/callcenterOriginal/src/components/HeaderOption/index.js +30 -51
- package/src/themes/callcenterOriginal/src/components/HeaderOption/styles.js +2 -4
- package/src/themes/callcenterOriginal/src/components/SidebarMenu/index.js +75 -101
- package/src/themes/callcenterOriginal/src/components/UserPopover/index.js +36 -17
- package/_bundles/ordering-ui.247fbb361bb31d72a262.js +0 -2
- /package/_bundles/{0.ordering-ui.247fbb361bb31d72a262.js → 0.ordering-ui.a574355896c3077ecd50.js} +0 -0
- /package/_bundles/{1.ordering-ui.247fbb361bb31d72a262.js → 1.ordering-ui.a574355896c3077ecd50.js} +0 -0
- /package/_bundles/{2.ordering-ui.247fbb361bb31d72a262.js → 2.ordering-ui.a574355896c3077ecd50.js} +0 -0
- /package/_bundles/{4.ordering-ui.247fbb361bb31d72a262.js → 4.ordering-ui.a574355896c3077ecd50.js} +0 -0
- /package/_bundles/{5.ordering-ui.247fbb361bb31d72a262.js → 5.ordering-ui.a574355896c3077ecd50.js} +0 -0
- /package/_bundles/{6.ordering-ui.247fbb361bb31d72a262.js → 6.ordering-ui.a574355896c3077ecd50.js} +0 -0
- /package/_bundles/{7.ordering-ui.247fbb361bb31d72a262.js.LICENSE.txt → 7.ordering-ui.a574355896c3077ecd50.js.LICENSE.txt} +0 -0
- /package/_bundles/{8.ordering-ui.247fbb361bb31d72a262.js → 8.ordering-ui.a574355896c3077ecd50.js} +0 -0
- /package/_bundles/{9.ordering-ui.247fbb361bb31d72a262.js → 9.ordering-ui.a574355896c3077ecd50.js} +0 -0
- /package/_bundles/{ordering-ui.247fbb361bb31d72a262.js.LICENSE.txt → ordering-ui.a574355896c3077ecd50.js.LICENSE.txt} +0 -0
|
@@ -168,20 +168,24 @@ export const Header = (props) => {
|
|
|
168
168
|
{isShowOrderOptions && (
|
|
169
169
|
<>
|
|
170
170
|
<Menu className='left-header' id='center-side'>
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
171
|
+
{windowSize.width > 820 && (
|
|
172
|
+
<>
|
|
173
|
+
<AddressMenu
|
|
174
|
+
onClick={(e) => handleClickUserCustomer(e)}
|
|
175
|
+
>
|
|
176
|
+
<GeoAlt /> <span><p>{orderState.options?.address?.address?.split(',')?.[0] || t('WHAT_IS_YOUR_ADDRESS', 'What\'s your address?')}</p></span>
|
|
177
|
+
</AddressMenu>
|
|
178
|
+
<Divider />
|
|
179
|
+
</>
|
|
180
|
+
)}
|
|
181
|
+
{isCustomerMode && (
|
|
178
182
|
<CustomerInfo
|
|
179
183
|
onClick={(e) => handleClickUserCustomer(e)}
|
|
180
184
|
>
|
|
181
185
|
<span>
|
|
182
186
|
<p>
|
|
183
|
-
{windowSize.width >
|
|
184
|
-
{' '}{windowSize.width >
|
|
187
|
+
{windowSize.width > 1200 ? userCustomer?.name : cutCharactersName({ str: userCustomer?.name })}
|
|
188
|
+
{' '}{windowSize.width > 1200 ? userCustomer?.lastname : null}
|
|
185
189
|
</p>
|
|
186
190
|
</span>
|
|
187
191
|
<span
|
|
@@ -218,14 +222,12 @@ export const Header = (props) => {
|
|
|
218
222
|
</>
|
|
219
223
|
)}
|
|
220
224
|
<>
|
|
221
|
-
{user?.level === 0 && (
|
|
225
|
+
{user?.level === 0 && windowSize.width > 1200 && (
|
|
222
226
|
<>
|
|
223
227
|
{!isShowOrderOptions && (
|
|
224
228
|
<Menu className='left-header invisible' id='center-side' />
|
|
225
229
|
)}
|
|
226
230
|
<AdminAreaPopover
|
|
227
|
-
withLogout
|
|
228
|
-
isCustomerMode={isCustomerMode}
|
|
229
231
|
open={openPopover.admin}
|
|
230
232
|
onClick={() => handleTogglePopover('admin')}
|
|
231
233
|
onClose={() => handleClosePopover('admin')}
|
|
@@ -16,25 +16,7 @@ export const InnerHeader = styled.div`
|
|
|
16
16
|
align-items: center;
|
|
17
17
|
|
|
18
18
|
#center-side {
|
|
19
|
-
width:
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
@media (min-width: 1024px) {
|
|
23
|
-
#center-side {
|
|
24
|
-
width: calc(60% - 100px);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
@media (min-width: 1200px) {
|
|
29
|
-
#center-side {
|
|
30
|
-
width: calc(60% - 160px);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
@media (min-width: 1500px) {
|
|
35
|
-
#center-side {
|
|
36
|
-
width: calc(60% - 200px);
|
|
37
|
-
}
|
|
19
|
+
width: calc(60% - 30px);
|
|
38
20
|
}
|
|
39
21
|
`
|
|
40
22
|
|
|
@@ -241,32 +223,28 @@ export const SubMenu = styled(InnerHeader)`
|
|
|
241
223
|
`
|
|
242
224
|
|
|
243
225
|
export const CustomerInfo = styled.div`
|
|
244
|
-
display:
|
|
226
|
+
display: flex;
|
|
227
|
+
justify-content: center;
|
|
228
|
+
align-items: center;
|
|
245
229
|
cursor: pointer;
|
|
246
230
|
flex: 1;
|
|
247
231
|
position: relative;
|
|
248
|
-
@media (min-width: 450px) {
|
|
249
|
-
display: flex;
|
|
250
|
-
justify-content: center;
|
|
251
|
-
align-items: center;
|
|
252
232
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
233
|
+
span {
|
|
234
|
+
align-items: center;
|
|
235
|
+
margin: 0;
|
|
236
|
+
p {
|
|
237
|
+
max-width: 250px;
|
|
238
|
+
overflow: hidden;
|
|
239
|
+
text-overflow: ellipsis;
|
|
240
|
+
white-space: nowrap;
|
|
241
|
+
color: #909BA9;
|
|
256
242
|
margin: 0;
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
color: #909BA9;
|
|
263
|
-
margin: 0;
|
|
264
|
-
}
|
|
265
|
-
svg {
|
|
266
|
-
color: #748194;
|
|
267
|
-
margin: 0;
|
|
268
|
-
font-size: 20px;
|
|
269
|
-
}
|
|
243
|
+
}
|
|
244
|
+
svg {
|
|
245
|
+
color: #748194;
|
|
246
|
+
margin: 0;
|
|
247
|
+
font-size: 20px;
|
|
270
248
|
}
|
|
271
249
|
}
|
|
272
250
|
`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { useUtils, useLanguage, useConfig, useOrder } from 'ordering-components-external'
|
|
3
|
-
import
|
|
3
|
+
import { Cart3 } from 'react-bootstrap-icons'
|
|
4
4
|
import FaMapMarkerAlt from '@meronex/icons/fa/FaMapMarkerAlt'
|
|
5
5
|
|
|
6
6
|
import {
|
|
@@ -23,57 +23,36 @@ export const HeaderOption = (props) => {
|
|
|
23
23
|
const [orderStatus] = useOrder()
|
|
24
24
|
|
|
25
25
|
return (
|
|
26
|
-
|
|
27
|
-
{
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
<Container
|
|
27
|
+
variant={variant}
|
|
28
|
+
onClick={() => props.onClick(variant)}
|
|
29
|
+
>
|
|
30
|
+
{variant === 'cart' && (
|
|
31
|
+
<span>
|
|
32
|
+
<Cart3 />
|
|
33
|
+
{totalCarts > 0 && <span>{totalCarts}</span>}
|
|
34
|
+
</span>
|
|
35
|
+
)}
|
|
36
|
+
{variant === 'address' && (
|
|
37
|
+
<>
|
|
38
|
+
<FaMapMarkerAlt id='icon' />
|
|
39
|
+
{addressState || t('WHAT_IS_YOUR_ADDRESS', 'What\'s your address?')}
|
|
40
|
+
</>
|
|
41
|
+
)}
|
|
42
|
+
{variant === 'moment' && (
|
|
43
|
+
<>
|
|
44
|
+
{momentState
|
|
45
|
+
? parseDate(momentState, { outputFormat: configs?.dates_moment_format?.value })
|
|
46
|
+
: t('ASAP_ABBREVIATION', 'ASAP')}
|
|
47
|
+
</>
|
|
48
|
+
)}
|
|
31
49
|
{
|
|
32
|
-
|
|
33
|
-
|
|
50
|
+
variant === 'delivery' && (
|
|
51
|
+
<DeliveryType>
|
|
52
|
+
{(orderTypeList && orderTypeList[orderStatus?.options.type - 1]) || t('DELIVERY', 'Delivery')}
|
|
53
|
+
</DeliveryType>
|
|
54
|
+
)
|
|
34
55
|
}
|
|
35
|
-
|
|
36
|
-
variant={variant}
|
|
37
|
-
onClick={() => props.onClick(variant)}
|
|
38
|
-
isHome={props.isHome}
|
|
39
|
-
>
|
|
40
|
-
{variant === 'cart' && (
|
|
41
|
-
<span>
|
|
42
|
-
<AiOutlineShoppingCart id='icon' />
|
|
43
|
-
{totalCarts > 0 && <p>{totalCarts}</p>}
|
|
44
|
-
</span>
|
|
45
|
-
)}
|
|
46
|
-
{variant === 'address' && (
|
|
47
|
-
<>
|
|
48
|
-
<FaMapMarkerAlt id='icon' />
|
|
49
|
-
{addressState || t('WHAT_IS_YOUR_ADDRESS', 'What\'s your address?')}
|
|
50
|
-
</>
|
|
51
|
-
)}
|
|
52
|
-
{variant === 'moment' && (
|
|
53
|
-
<>
|
|
54
|
-
{momentState
|
|
55
|
-
? parseDate(momentState, { outputFormat: configs?.dates_moment_format?.value })
|
|
56
|
-
: t('ASAP_ABBREVIATION', 'ASAP')}
|
|
57
|
-
</>
|
|
58
|
-
)}
|
|
59
|
-
{
|
|
60
|
-
variant === 'delivery' && (
|
|
61
|
-
<DeliveryType>
|
|
62
|
-
{(orderTypeList && orderTypeList[orderStatus?.options.type - 1]) || t('DELIVERY', 'Delivery')}
|
|
63
|
-
</DeliveryType>
|
|
64
|
-
)
|
|
65
|
-
}
|
|
66
|
-
</Container>
|
|
67
|
-
{
|
|
68
|
-
props.afterComponents?.map((AfterComponent, i) => (
|
|
69
|
-
<AfterComponent key={i} {...props} />))
|
|
70
|
-
}
|
|
71
|
-
{
|
|
72
|
-
props.afterElements?.map((AfterElement, i) => (
|
|
73
|
-
<React.Fragment key={i}>
|
|
74
|
-
{AfterElement}
|
|
75
|
-
</React.Fragment>))
|
|
76
|
-
}
|
|
77
|
-
</>
|
|
56
|
+
</Container>
|
|
78
57
|
)
|
|
79
58
|
}
|
|
@@ -5,9 +5,7 @@ export const Container = styled.div`
|
|
|
5
5
|
|
|
6
6
|
${({ variant }) => variant === 'cart' && css`
|
|
7
7
|
> span {
|
|
8
|
-
|
|
9
|
-
height: 20px;
|
|
10
|
-
padding: 10px 9px;
|
|
8
|
+
padding: 10px;
|
|
11
9
|
display: flex;
|
|
12
10
|
align-items: center;
|
|
13
11
|
background: ${props => props.theme.colors.primary};
|
|
@@ -21,7 +19,7 @@ export const Container = styled.div`
|
|
|
21
19
|
margin-right: 10px;
|
|
22
20
|
` : css`
|
|
23
21
|
margin-left: 10px;
|
|
24
|
-
`}
|
|
22
|
+
`}
|
|
25
23
|
}
|
|
26
24
|
svg {
|
|
27
25
|
font-size: 17px;
|
|
@@ -9,10 +9,13 @@ import AiOutlineHome from '@meronex/icons/ai/AiOutlineHome'
|
|
|
9
9
|
import BiStore from '@meronex/icons/bi/BiStore'
|
|
10
10
|
import FaUserCircle from '@meronex/icons/fa/FaUserCircle'
|
|
11
11
|
import BiHelpCircle from '@meronex/icons/bi/BiHelpCircle'
|
|
12
|
+
import GiHistogram from '@meronex/icons/gi/GiHistogram'
|
|
13
|
+
import BsGraphUp from '@meronex/icons/bs/BsGraphUp'
|
|
12
14
|
|
|
13
15
|
import { useEvent, useLanguage, useOrder, useSession } from 'ordering-components-external'
|
|
14
16
|
import { useTheme } from 'styled-components'
|
|
15
17
|
|
|
18
|
+
import { capitalize } from '../../../../../utils'
|
|
16
19
|
import { useWindowSize } from '../../../../../hooks/useWindowSize'
|
|
17
20
|
import { LogoutButton } from '../../../../../components/LogoutButton'
|
|
18
21
|
import { Modal } from '../Modal'
|
|
@@ -35,9 +38,20 @@ import {
|
|
|
35
38
|
MobileMessage
|
|
36
39
|
} from './styles'
|
|
37
40
|
|
|
41
|
+
const extraOptions = [
|
|
42
|
+
{ name: 'profile', pathname: '/profile', displayName: 'view account', key: 'view_account' },
|
|
43
|
+
{ name: 'help', pathname: '/help', displayName: 'help', key: 'help' }
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
const adminOptionsDefault = [
|
|
47
|
+
{ name: 'orderlist', pathname: '/orderlist', displayName: 'order list', key: 'ORDER_LIST' },
|
|
48
|
+
{ name: 'deliveries', pathname: '/deliveries', displayName: 'delivery dashboard', key: 'DELIVERY_DASHBOARD' },
|
|
49
|
+
{ name: 'drivers_dashboard', pathname: '/drivers', displayName: 'drivers dashboard', key: 'DRIVERS_DASHBOARD' }
|
|
50
|
+
]
|
|
51
|
+
|
|
38
52
|
export const SidebarMenu = (props) => {
|
|
39
53
|
const { auth, isHideSignup, userCustomer, isCustomerMode } = props
|
|
40
|
-
const [{ login }] = useSession()
|
|
54
|
+
const [sessionState, { login }] = useSession()
|
|
41
55
|
const [events] = useEvent()
|
|
42
56
|
const [, t] = useLanguage()
|
|
43
57
|
const [{ options }] = useOrder()
|
|
@@ -48,8 +62,6 @@ export const SidebarMenu = (props) => {
|
|
|
48
62
|
const [modalPageToShow, setModalPageToShow] = useState(null)
|
|
49
63
|
const [showMessage, setShowMessage] = useState(false)
|
|
50
64
|
|
|
51
|
-
const isHome = window.location.pathname === '/' || window.location.pathname === '/home'
|
|
52
|
-
|
|
53
65
|
const closeModal = () => {
|
|
54
66
|
setModalIsOpen(false)
|
|
55
67
|
setModalPageToShow(null)
|
|
@@ -104,21 +116,26 @@ export const SidebarMenu = (props) => {
|
|
|
104
116
|
}, [width])
|
|
105
117
|
|
|
106
118
|
useEffect(() => {
|
|
107
|
-
if(!isCustomerMode) return
|
|
119
|
+
if (!isCustomerMode) return
|
|
108
120
|
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
|
|
109
121
|
setShowMessage(true)
|
|
110
122
|
}
|
|
111
123
|
}, [])
|
|
112
124
|
|
|
125
|
+
const getMenuIcon = (icon) => {
|
|
126
|
+
const list = {
|
|
127
|
+
profile: <FaRegAddressCard />,
|
|
128
|
+
help: <BiHelpCircle />,
|
|
129
|
+
orderlist: <FaRegListAlt />,
|
|
130
|
+
deliveries: <GiHistogram />,
|
|
131
|
+
drivers_dashboard: <BsGraphUp />
|
|
132
|
+
}
|
|
133
|
+
return list[icon]
|
|
134
|
+
}
|
|
135
|
+
|
|
113
136
|
return (
|
|
114
137
|
<>
|
|
115
|
-
{
|
|
116
|
-
<React.Fragment key={i}>
|
|
117
|
-
{BeforeElement}
|
|
118
|
-
</React.Fragment>))}
|
|
119
|
-
{props.beforeComponents?.map((BeforeComponent, i) => (
|
|
120
|
-
<BeforeComponent key={i} {...props} />))}
|
|
121
|
-
{showMessage && (
|
|
138
|
+
{showMessage && (
|
|
122
139
|
<MobileMessage>
|
|
123
140
|
<div>
|
|
124
141
|
<CloseIcon onClick={() => setShowMessage(false)} />
|
|
@@ -128,18 +145,13 @@ export const SidebarMenu = (props) => {
|
|
|
128
145
|
)}
|
|
129
146
|
<Container auth={auth}>
|
|
130
147
|
<IconContent
|
|
131
|
-
isHome={isHome}
|
|
132
148
|
aria-label='menu'
|
|
133
149
|
onClick={() => actionSidebar(true)}
|
|
134
150
|
>
|
|
135
151
|
<IosMenu />
|
|
136
152
|
</IconContent>
|
|
137
|
-
<SidebarContent
|
|
138
|
-
id='sidebar_menu'
|
|
139
|
-
isHome={isHome}
|
|
140
|
-
>
|
|
153
|
+
<SidebarContent id='sidebar_menu'>
|
|
141
154
|
<MenuClose
|
|
142
|
-
isHome={isHome}
|
|
143
155
|
aria-label='close'
|
|
144
156
|
onClick={() => actionSidebar(false)}
|
|
145
157
|
>
|
|
@@ -147,17 +159,15 @@ export const SidebarMenu = (props) => {
|
|
|
147
159
|
</MenuClose>
|
|
148
160
|
|
|
149
161
|
{userCustomer && (
|
|
150
|
-
<MenuLink
|
|
162
|
+
<MenuLink isCustomer={userCustomer}>
|
|
151
163
|
<WrappContent>
|
|
152
164
|
<MenuLinkIcon
|
|
153
|
-
isHome={isHome}
|
|
154
165
|
active={false}
|
|
155
166
|
>
|
|
156
167
|
<FaUserCircle />
|
|
157
168
|
</MenuLinkIcon>
|
|
158
169
|
<MenuLinkText>
|
|
159
170
|
<TextInfo
|
|
160
|
-
isHome={isHome}
|
|
161
171
|
active={false}
|
|
162
172
|
>
|
|
163
173
|
{`${userCustomer?.name} ${userCustomer?.lastname}`}
|
|
@@ -172,13 +182,9 @@ export const SidebarMenu = (props) => {
|
|
|
172
182
|
</MenuLink>
|
|
173
183
|
)}
|
|
174
184
|
|
|
175
|
-
<MenuLink
|
|
176
|
-
isHome={isHome}
|
|
177
|
-
onClick={() => handleGoToPage({ page: options?.address?.location ? 'search' : 'home' })}
|
|
178
|
-
>
|
|
185
|
+
<MenuLink onClick={() => handleGoToPage({ page: options?.address?.location ? 'search' : 'home' })}>
|
|
179
186
|
<WrappContent>
|
|
180
187
|
<MenuLinkIcon
|
|
181
|
-
isHome={isHome}
|
|
182
188
|
active={
|
|
183
189
|
window.location.pathname === '/' ||
|
|
184
190
|
window.location.pathname === '/home' ||
|
|
@@ -193,7 +199,6 @@ export const SidebarMenu = (props) => {
|
|
|
193
199
|
</MenuLinkIcon>
|
|
194
200
|
<MenuLinkText>
|
|
195
201
|
<TextInfo
|
|
196
|
-
isHome={isHome}
|
|
197
202
|
active={
|
|
198
203
|
window.location.pathname === '/' ||
|
|
199
204
|
window.location.pathname === '/home' ||
|
|
@@ -217,75 +222,57 @@ export const SidebarMenu = (props) => {
|
|
|
217
222
|
|
|
218
223
|
{auth && (
|
|
219
224
|
<>
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
<
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
<
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
<TextInfo
|
|
265
|
-
isHome={isHome}
|
|
266
|
-
active={
|
|
267
|
-
window.location.pathname === '/help'
|
|
268
|
-
}
|
|
269
|
-
>
|
|
270
|
-
{t('HELP', 'help')}
|
|
271
|
-
</TextInfo>
|
|
272
|
-
</MenuLinkText>
|
|
273
|
-
<MenuLinkSeparator>
|
|
274
|
-
<div>
|
|
275
|
-
<hr />
|
|
276
|
-
</div>
|
|
277
|
-
</MenuLinkSeparator>
|
|
278
|
-
</WrappContent>
|
|
279
|
-
</MenuLink>
|
|
225
|
+
{extraOptions.map(option => (
|
|
226
|
+
<MenuLink
|
|
227
|
+
key={option.key}
|
|
228
|
+
onClick={() => handleGoToPage({ page: option.name })}
|
|
229
|
+
>
|
|
230
|
+
<WrappContent>
|
|
231
|
+
<MenuLinkIcon active={window.location.pathname === option.pathname}>
|
|
232
|
+
{getMenuIcon(option.name)}
|
|
233
|
+
</MenuLinkIcon>
|
|
234
|
+
<MenuLinkText>
|
|
235
|
+
<TextInfo active={window.location.pathname === option.pathname}>
|
|
236
|
+
{t((option.key || option.name).toUpperCase(), capitalize(option.displayName || option.name))}
|
|
237
|
+
</TextInfo>
|
|
238
|
+
</MenuLinkText>
|
|
239
|
+
<MenuLinkSeparator>
|
|
240
|
+
<div>
|
|
241
|
+
<hr />
|
|
242
|
+
</div>
|
|
243
|
+
</MenuLinkSeparator>
|
|
244
|
+
</WrappContent>
|
|
245
|
+
</MenuLink>
|
|
246
|
+
))}
|
|
247
|
+
{sessionState?.user?.level === 0 && adminOptionsDefault.map(option => (
|
|
248
|
+
<MenuLink
|
|
249
|
+
key={option.key}
|
|
250
|
+
onClick={() => handleGoToPage({ page: option.name })}
|
|
251
|
+
>
|
|
252
|
+
<WrappContent>
|
|
253
|
+
<MenuLinkIcon active={window.location.pathname === option.pathname}>
|
|
254
|
+
{getMenuIcon(option.name)}
|
|
255
|
+
</MenuLinkIcon>
|
|
256
|
+
<MenuLinkText>
|
|
257
|
+
<TextInfo active={window.location.pathname === option.pathname}>
|
|
258
|
+
{t((option.key || option.name).toUpperCase(), capitalize(option.displayName || option.name))}
|
|
259
|
+
</TextInfo>
|
|
260
|
+
</MenuLinkText>
|
|
261
|
+
<MenuLinkSeparator>
|
|
262
|
+
<div>
|
|
263
|
+
<hr />
|
|
264
|
+
</div>
|
|
265
|
+
</MenuLinkSeparator>
|
|
266
|
+
</WrappContent>
|
|
267
|
+
</MenuLink>
|
|
268
|
+
))}
|
|
280
269
|
{
|
|
281
270
|
!isCustomerMode && (
|
|
282
271
|
<MenuLink
|
|
283
|
-
isHome={isHome}
|
|
284
272
|
onClick={() => handleGoToPage({ page: 'orders' })}
|
|
285
273
|
>
|
|
286
274
|
<WrappContent>
|
|
287
275
|
<MenuLinkIcon
|
|
288
|
-
isHome={isHome}
|
|
289
276
|
active={
|
|
290
277
|
window.location.pathname === '/profile/orders'
|
|
291
278
|
}
|
|
@@ -294,7 +281,6 @@ export const SidebarMenu = (props) => {
|
|
|
294
281
|
</MenuLinkIcon>
|
|
295
282
|
<MenuLinkText>
|
|
296
283
|
<TextInfo
|
|
297
|
-
isHome={isHome}
|
|
298
284
|
active={
|
|
299
285
|
window.location.pathname === '/profile/orders'
|
|
300
286
|
}
|
|
@@ -318,19 +304,16 @@ export const SidebarMenu = (props) => {
|
|
|
318
304
|
{!auth && (
|
|
319
305
|
<>
|
|
320
306
|
<MenuLink
|
|
321
|
-
isHome={isHome}
|
|
322
307
|
onClick={() => handleOpenLoginSignUp('login')}
|
|
323
308
|
>
|
|
324
309
|
<WrappContent>
|
|
325
310
|
<MenuLinkIcon
|
|
326
|
-
isHome={isHome}
|
|
327
311
|
active={modalPageToShow === 'login'}
|
|
328
312
|
>
|
|
329
313
|
<AiOutlineLogin />
|
|
330
314
|
</MenuLinkIcon>
|
|
331
315
|
<MenuLinkText>
|
|
332
316
|
<TextInfo
|
|
333
|
-
isHome={isHome}
|
|
334
317
|
active={modalPageToShow === 'login'}
|
|
335
318
|
>
|
|
336
319
|
{t('SIGN_IN', 'Sign in')}
|
|
@@ -345,19 +328,16 @@ export const SidebarMenu = (props) => {
|
|
|
345
328
|
</MenuLink>
|
|
346
329
|
{!isHideSignup && (
|
|
347
330
|
<MenuLink
|
|
348
|
-
isHome={isHome}
|
|
349
331
|
onClick={() => handleOpenLoginSignUp('signup')}
|
|
350
332
|
>
|
|
351
333
|
<WrappContent>
|
|
352
334
|
<MenuLinkIcon
|
|
353
|
-
isHome={isHome}
|
|
354
335
|
active={modalPageToShow === 'signup'}
|
|
355
336
|
>
|
|
356
337
|
<AiOutlineUserAdd />
|
|
357
338
|
</MenuLinkIcon>
|
|
358
339
|
<MenuLinkText>
|
|
359
340
|
<TextInfo
|
|
360
|
-
isHome={isHome}
|
|
361
341
|
active={modalPageToShow === 'signup'}
|
|
362
342
|
>
|
|
363
343
|
{t('SIGNUP', 'Sign up')}
|
|
@@ -435,12 +415,6 @@ export const SidebarMenu = (props) => {
|
|
|
435
415
|
</Modal>
|
|
436
416
|
)}
|
|
437
417
|
</Container>
|
|
438
|
-
{props.afterComponents?.map((AfterComponent, i) => (
|
|
439
|
-
<AfterComponent key={i} {...props} />))}
|
|
440
|
-
{props.afterElements?.map((AfterElement, i) => (
|
|
441
|
-
<React.Fragment key={i}>
|
|
442
|
-
{AfterElement}
|
|
443
|
-
</React.Fragment>))}
|
|
444
418
|
</>
|
|
445
419
|
)
|
|
446
420
|
}
|
|
@@ -27,6 +27,12 @@ const extraOptions = [
|
|
|
27
27
|
{ name: 'help', pathname: '/help', displayName: 'help', key: 'help' }
|
|
28
28
|
]
|
|
29
29
|
|
|
30
|
+
const adminOptionsDefault = [
|
|
31
|
+
{ name: 'orderlist', pathname: '/orderlist', displayName: 'order list', key: 'ORDER_LIST' },
|
|
32
|
+
{ name: 'deliveries', pathname: '/deliveries', displayName: 'delivery dashboard', key: 'DELIVERY_DASHBOARD' },
|
|
33
|
+
{ name: 'drivers_dashboard', pathname: '/drivers', displayName: 'drivers dashboard', key: 'DRIVERS_DASHBOARD' }
|
|
34
|
+
]
|
|
35
|
+
|
|
30
36
|
export const UserPopover = (props) => {
|
|
31
37
|
const {
|
|
32
38
|
open,
|
|
@@ -58,7 +64,7 @@ export const UserPopover = (props) => {
|
|
|
58
64
|
]
|
|
59
65
|
})
|
|
60
66
|
|
|
61
|
-
const { styles, attributes
|
|
67
|
+
const { styles, attributes } = popper
|
|
62
68
|
|
|
63
69
|
useEffect(() => {
|
|
64
70
|
// forceUpdate && forceUpdate()
|
|
@@ -99,12 +105,6 @@ export const UserPopover = (props) => {
|
|
|
99
105
|
}
|
|
100
106
|
return (
|
|
101
107
|
<div style={{ overflow: 'hidden' }}>
|
|
102
|
-
{props.beforeElements?.map((BeforeElement, i) => (
|
|
103
|
-
<React.Fragment key={i}>
|
|
104
|
-
{BeforeElement}
|
|
105
|
-
</React.Fragment>))}
|
|
106
|
-
{props.beforeComponents?.map((BeforeComponent, i) => (
|
|
107
|
-
<BeforeComponent key={i} {...props} />))}
|
|
108
108
|
<HeaderItem
|
|
109
109
|
isPhoto={sessionState?.user?.photo}
|
|
110
110
|
isHome={isHome}
|
|
@@ -150,20 +150,39 @@ export const UserPopover = (props) => {
|
|
|
150
150
|
))
|
|
151
151
|
)
|
|
152
152
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
153
|
+
{!(sessionState?.user?.level === 0) && (
|
|
154
|
+
<>
|
|
155
|
+
<Divider />
|
|
156
|
+
{withLogout && (
|
|
157
|
+
<PopoverListItemLogout onClose={props.onClose} />
|
|
158
|
+
)}
|
|
159
|
+
</>
|
|
157
160
|
)}
|
|
158
161
|
</ExtraOptions>
|
|
162
|
+
{sessionState?.user?.level === 0 && (
|
|
163
|
+
<>
|
|
164
|
+
<Divider />
|
|
165
|
+
<ExtraOptions>
|
|
166
|
+
{
|
|
167
|
+
adminOptionsDefault && (adminOptionsDefault.map((option, i) => (
|
|
168
|
+
<PopoverListLink
|
|
169
|
+
key={i}
|
|
170
|
+
active={window.location.pathname === option.pathname}
|
|
171
|
+
onClick={() => handleGoToPage(option.name)}
|
|
172
|
+
>
|
|
173
|
+
{t((option.key || option.name).toUpperCase(), capitalize(option.displayName || option.name))}
|
|
174
|
+
</PopoverListLink>
|
|
175
|
+
)))
|
|
176
|
+
}
|
|
177
|
+
<Divider />
|
|
178
|
+
{withLogout && (
|
|
179
|
+
<PopoverListItemLogout onClose={props.onClose} />
|
|
180
|
+
)}
|
|
181
|
+
</ExtraOptions>
|
|
182
|
+
</>
|
|
183
|
+
)}
|
|
159
184
|
</PopoverList>
|
|
160
185
|
</PopoverBody>
|
|
161
|
-
{props.afterComponents?.map((AfterComponent, i) => (
|
|
162
|
-
<AfterComponent key={i} {...props} />))}
|
|
163
|
-
{props.afterElements?.map((AfterElement, i) => (
|
|
164
|
-
<React.Fragment key={i}>
|
|
165
|
-
{AfterElement}
|
|
166
|
-
</React.Fragment>))}
|
|
167
186
|
</div>
|
|
168
187
|
)
|
|
169
188
|
}
|