style: add logout icon, and hide profile menu on admin

This commit is contained in:
caturbgs 2021-12-22 20:18:38 +07:00
parent a115d8488b
commit fa3fff13f6

View File

@ -9,6 +9,7 @@ import {
FileProtectOutlined, FileProtectOutlined,
FileSyncOutlined, FileSyncOutlined,
HomeOutlined, HomeOutlined,
LogoutOutlined,
MenuOutlined, MenuOutlined,
PayCircleOutlined, PayCircleOutlined,
ProfileOutlined, ProfileOutlined,
@ -353,41 +354,45 @@ export const DesktopLayout = observer(() => {
autoAdjustOverflow={true} autoAdjustOverflow={true}
placement="bottomRight" placement="bottomRight"
content={ content={
<Menu <Menu
type={"line"} type={"line"}
inlineIndent={0} inlineIndent={0}
theme="light" theme="light"
style={{ style={{
backgroundColor: "transparent", backgroundColor: "transparent",
borderRightWidth: 0, borderRightWidth: 0,
}} }}
mode="inline" mode="inline"
>
<Menu.Item>
<Link to={LINKS.PROFILE}>
<span>Profile</span>
</Link>
</Menu.Item>
<Menu.Item
onClick={() => {
store.authentication.logout();
history.push("/login");
}}
> >
<span>Sign out</span> {store.authentication.userData.role !== "Admin" && <Menu.Item>
</Menu.Item> <Link to={LINKS.PROFILE}>
</Menu> <UserOutlined/>
<span>Profile</span>
</Link>
</Menu.Item>
}
<Menu.Item
onClick={() => {
store.authentication.logout();
history.push("/login");
}}
>
<LogoutOutlined/>
<span>Sign out</span>
</Menu.Item>
</Menu>
} }
title={ title={
<Text> <Text>
{store.user.data.username} {store.user.data.username}
<Paragraph <Paragraph
style={{ fontWeight: 400 }} style={{fontWeight: 400, marginTop: '0.5rem'}}
type={"secondary-dark"} type={"secondary-dark"}
> strong
{store.authentication.userData.username} >
</Paragraph> {store.authentication.userData.username}
</Text> </Paragraph>
</Text>
} }
trigger="click" trigger="click"
visible={clicked} visible={clicked}
@ -475,6 +480,7 @@ export const DesktopLayout = observer(() => {
history.push("/login"); history.push("/login");
}} }}
> >
<LogoutOutlined/>
<span>Sign out</span> <span>Sign out</span>
</Menu.Item> </Menu.Item>
</Menu> </Menu>