Skip to content

Commit c51f480

Browse files
committed
2 parents 3009801 + e81472a commit c51f480

File tree

6 files changed

+88
-38
lines changed

6 files changed

+88
-38
lines changed

dist/dev/index.js

+20-20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/prod/index.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/assets/images/arrow-small-up.svg

+21
Loading

src/components/AccountMenu/index.js

+39-16
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,25 @@ import IconSwitchBusiness from '../../assets/images/icon-switch-business.svg'
99
import styles from './styles.module.scss'
1010
import moment from 'moment'
1111

12+
// The roles of managers/copilots/admins.
13+
const MANAGE_ROLES = [
14+
'administrator',
15+
'admin',
16+
'copilot',
17+
'connect copilot',
18+
'manager',
19+
'global manager',
20+
'client manager',
21+
'connect manager'
22+
]
23+
24+
const hasAccess = roles => {
25+
if (!roles) {
26+
return false
27+
}
28+
return roles.some(v => MANAGE_ROLES.indexOf(v.toLowerCase()) !== -1)
29+
}
30+
1231
class AccountMenu extends React.Component {
1332
renderLink (menu, i) {
1433
const { onClose } = this.props
@@ -66,22 +85,26 @@ class AccountMenu extends React.Component {
6685
</span>
6786
</div>
6887

69-
<div
70-
role='button'
71-
className={styles['switch-to-business-container']}
72-
onClick={onSwitch}
73-
>
74-
<IconSwitchBusiness className={styles['switch-icon']} />
75-
{
76-
_.isEmpty(switchText.href) ? (
77-
<Link to={switchText.link} onClick={onClose}>
78-
<span className={styles['switch-to-busniness']}>{switchText.title}</span>
79-
</Link>
80-
) : (
81-
<a href={switchText.href} className={styles['switch-to-busniness']} onClick={onClose}>{switchText.title}</a>
82-
)
83-
}
84-
</div>
88+
{
89+
!_.isEmpty(profile) && hasAccess(profile.roles) && (
90+
<div
91+
role='button'
92+
className={styles['switch-to-business-container']}
93+
onClick={onSwitch}
94+
>
95+
<IconSwitchBusiness className={styles['switch-icon']} />
96+
{
97+
_.isEmpty(switchText.href) ? (
98+
<Link to={switchText.link} onClick={onClose}>
99+
<span className={styles['switch-to-busniness']}>{switchText.title}</span>
100+
</Link>
101+
) : (
102+
<a href={switchText.href} className={styles['switch-to-busniness']} onClick={onClose}>{switchText.title}</a>
103+
)
104+
}
105+
</div>
106+
)
107+
}
85108

86109
<div className={styles.menu}>
87110

src/components/TopNav/MobileSubNav.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react'
22
import PropTypes from 'prop-types'
33
import cn from 'classnames'
44
import IconArrowSmalldown from '../../assets/images/arrow-small-down.svg'
5+
import IconArrowSmallup from '../../assets/images/arrow-small-up.svg'
56
import styles from './MobileSubNav.module.scss'
67

78
const MobileSubNav = ({ open, menu, activeChildId, onClick, createHandleClickItem }) => (
@@ -11,7 +12,8 @@ const MobileSubNav = ({ open, menu, activeChildId, onClick, createHandleClickIte
1112
<div className={styles.mobileSubNavMask} />
1213
<button className={styles.mobileSubNavHeader} onClick={onClick}>
1314
<span>{menu.title}</span>
14-
<IconArrowSmalldown />
15+
{open && <IconArrowSmallup />}
16+
{!open && <IconArrowSmalldown />}
1517
</button>
1618
{open && (
1719
<div className={styles.mobileSubNavContent}>

src/components/TopNav/MobileSubNav.module.scss

+4
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@
4343
line-height: 40px;
4444
}
4545

46+
svg {
47+
margin-left: 5px;
48+
}
49+
4650
img {
4751
margin-left: 8px;
4852
}

0 commit comments

Comments
 (0)