mirror of
https://github.com/orangecoding/fredy.git
synced 2026-06-16 12:31:07 +00:00
* feat(ui): simplified titles and adjusted some wording * style(ui): simplified some views for mobile * style(ui): make job table responsive for mobile * style(ui): login button gap * style(ui): dont hide mobile columns * fix: method return type
62 lines
1.3 KiB
JavaScript
62 lines
1.3 KiB
JavaScript
import React from 'react';
|
|
import { useHistory } from 'react-router-dom';
|
|
import { Tabs, TabPane } from '@douyinfe/semi-ui';
|
|
|
|
import { useLocation } from 'react-router';
|
|
import { IconUser, IconTerminal, IconSetting } from '@douyinfe/semi-icons';
|
|
import './Menu.less';
|
|
|
|
function parsePathName(name) {
|
|
const split = name.split('/').filter((s) => s.length !== 0);
|
|
return '/' + split[0];
|
|
}
|
|
|
|
const TopMenu = function TopMenu({ isAdmin }) {
|
|
const history = useHistory();
|
|
const location = useLocation();
|
|
return (
|
|
<Tabs
|
|
className="menu"
|
|
type="line"
|
|
activeKey={parsePathName(location.pathname)}
|
|
onTabClick={(key) => history.push(key)}
|
|
>
|
|
<TabPane
|
|
itemKey="/jobs"
|
|
tab={
|
|
<span>
|
|
<IconTerminal />
|
|
Jobs
|
|
</span>
|
|
}
|
|
/>
|
|
|
|
{isAdmin && (
|
|
<TabPane
|
|
itemKey="/users"
|
|
tab={
|
|
<span>
|
|
<IconUser />
|
|
User
|
|
</span>
|
|
}
|
|
/>
|
|
)}
|
|
|
|
{isAdmin && (
|
|
<TabPane
|
|
itemKey="/generalSettings"
|
|
tab={
|
|
<span>
|
|
<IconSetting />
|
|
General
|
|
</span>
|
|
}
|
|
/>
|
|
)}
|
|
</Tabs>
|
|
);
|
|
};
|
|
|
|
export default TopMenu;
|