mirror of
https://github.com/datahub-project/datahub.git
synced 2025-12-29 02:48:24 +00:00
feat : custom menu options in the main dropdown menu (#2250)
Co-authored-by: lalrishav <lalrishav@gmail.com>
This commit is contained in:
parent
fec39c682a
commit
2eb8a24147
@ -2,11 +2,12 @@ import React from 'react';
|
||||
import Cookies from 'js-cookie';
|
||||
import { Menu, Avatar, Dropdown } from 'antd';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { useTheme } from 'styled-components';
|
||||
import defaultAvatar from '../../images/default_avatar.png';
|
||||
import { EntityType } from '../../types.generated';
|
||||
import { useEntityRegistry } from '../useEntityRegistry';
|
||||
import { isLoggedInVar } from '../auth/checkAuthStatus';
|
||||
import { GlobalCfg } from '../../conf';
|
||||
import { isLoggedInVar } from '../auth/checkAuthStatus';
|
||||
|
||||
interface Props {
|
||||
urn: string;
|
||||
@ -19,14 +20,24 @@ const defaultProps = {
|
||||
|
||||
export const ManageAccount = ({ urn: _urn, pictureLink: _pictureLink }: Props) => {
|
||||
const entityRegistry = useEntityRegistry();
|
||||
|
||||
const themeConfig = useTheme();
|
||||
const handleLogout = () => {
|
||||
isLoggedInVar(false);
|
||||
Cookies.remove(GlobalCfg.CLIENT_AUTH_COOKIE);
|
||||
};
|
||||
|
||||
const menu = (
|
||||
<Menu>
|
||||
{themeConfig.content.menu.items.map((value) => {
|
||||
return (
|
||||
<Menu.Item key={value.label}>
|
||||
<a href={value.path || ''} target={value.shouldOpenInNewTab ? '_blank' : ''} rel="noreferrer">
|
||||
<div tabIndex={0} role="button">
|
||||
{value.label}
|
||||
</div>
|
||||
</a>
|
||||
</Menu.Item>
|
||||
);
|
||||
})}
|
||||
<Menu.Item danger>
|
||||
<div tabIndex={0} role="button" onClick={handleLogout} onKeyDown={handleLogout}>
|
||||
Log out
|
||||
|
||||
@ -27,6 +27,15 @@
|
||||
},
|
||||
"search": {
|
||||
"searchbarMessage": "Search Datasets, People, & more..."
|
||||
},
|
||||
"menu": {
|
||||
"items": [
|
||||
{
|
||||
"label": "Datahub Wiki",
|
||||
"path": "https://github.com/linkedin/datahub",
|
||||
"shouldOpenInNewTab": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,6 +29,15 @@
|
||||
},
|
||||
"search": {
|
||||
"searchbarMessage": "Search Datasets, People, & more..."
|
||||
},
|
||||
"menu": {
|
||||
"items": [
|
||||
{
|
||||
"label": "Datahub Wiki",
|
||||
"path": "https://github.com/linkedin/datahub",
|
||||
"shouldOpenInNewTab": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,5 +30,12 @@ export type Theme = {
|
||||
search: {
|
||||
searchbarMessage: string;
|
||||
};
|
||||
menu: {
|
||||
items: {
|
||||
label: string;
|
||||
path: string;
|
||||
shouldOpenInNewTab: boolean;
|
||||
}[];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user