2024-08-21 02:01:20 +02:00
|
|
|
import {ItemType} from "antd/lib/menu/interface";
|
2024-08-03 21:50:07 +02:00
|
|
|
import {t} from "ttag";
|
|
|
|
|
import {
|
2024-08-04 01:47:12 +02:00
|
|
|
AimOutlined,
|
2024-08-03 21:50:07 +02:00
|
|
|
ApiOutlined,
|
|
|
|
|
BankOutlined,
|
|
|
|
|
CloudServerOutlined,
|
|
|
|
|
CompassOutlined,
|
|
|
|
|
FileSearchOutlined,
|
|
|
|
|
HomeOutlined,
|
|
|
|
|
LineChartOutlined,
|
|
|
|
|
LoginOutlined,
|
|
|
|
|
LogoutOutlined,
|
|
|
|
|
SearchOutlined,
|
|
|
|
|
TeamOutlined,
|
2024-08-07 01:29:26 +02:00
|
|
|
UserOutlined
|
2024-08-03 21:50:07 +02:00
|
|
|
} from "@ant-design/icons";
|
|
|
|
|
import {Badge, Menu} from "antd";
|
|
|
|
|
import React from "react";
|
|
|
|
|
import {useNavigate} from "react-router-dom";
|
|
|
|
|
|
|
|
|
|
export function Sider({isAuthenticated}: { isAuthenticated: boolean }) {
|
|
|
|
|
const navigate = useNavigate()
|
|
|
|
|
|
2024-08-21 02:01:20 +02:00
|
|
|
const menuItems: ItemType[] = [
|
2024-08-03 21:50:07 +02:00
|
|
|
{
|
|
|
|
|
key: 'home',
|
|
|
|
|
label: t`Home`,
|
|
|
|
|
icon: <HomeOutlined/>,
|
|
|
|
|
onClick: () => navigate('/home')
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: 'search',
|
|
|
|
|
label: t`Search`,
|
|
|
|
|
icon: <SearchOutlined/>,
|
|
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
|
key: 'domain-finder',
|
|
|
|
|
icon: <CompassOutlined/>,
|
|
|
|
|
label: t`Domain`,
|
|
|
|
|
title: t`Domain Finder`,
|
|
|
|
|
disabled: !isAuthenticated,
|
|
|
|
|
onClick: () => navigate('/search/domain')
|
|
|
|
|
},
|
2024-08-04 01:32:58 +02:00
|
|
|
{
|
|
|
|
|
key: 'tld-list',
|
|
|
|
|
icon: <BankOutlined/>,
|
|
|
|
|
label: t`TLD`,
|
|
|
|
|
title: t`TLD list`,
|
|
|
|
|
disabled: !isAuthenticated,
|
2024-08-22 19:26:34 +02:00
|
|
|
onClick: () => navigate('/search/tld')
|
2024-08-04 01:32:58 +02:00
|
|
|
},
|
2024-08-03 21:50:07 +02:00
|
|
|
{
|
2024-08-07 01:29:26 +02:00
|
|
|
key: 'entity-finder',
|
|
|
|
|
icon: <TeamOutlined/>,
|
|
|
|
|
label: t`Entity`,
|
|
|
|
|
title: t`Entity Finder`,
|
|
|
|
|
disabled: true,
|
|
|
|
|
onClick: () => navigate('/search/entity')
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: 'ns-finder',
|
|
|
|
|
icon: <CloudServerOutlined/>,
|
|
|
|
|
label: t`Nameserver`,
|
|
|
|
|
title: t`Nameserver Finder`,
|
2024-08-21 02:01:20 +02:00
|
|
|
disabled: true,
|
|
|
|
|
onClick: () => navigate('/search/nameserver')
|
2024-08-03 21:50:07 +02:00
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: 'tracking',
|
|
|
|
|
label: t`Tracking`,
|
2024-08-04 01:47:12 +02:00
|
|
|
icon: <AimOutlined/>,
|
2024-08-03 21:50:07 +02:00
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
|
key: 'watchlist',
|
|
|
|
|
icon: <Badge count={0} size="small"><FileSearchOutlined/></Badge>,
|
|
|
|
|
label: t`My Watchlists`,
|
|
|
|
|
disabled: !isAuthenticated,
|
|
|
|
|
onClick: () => navigate('/tracking/watchlist')
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: 'connectors',
|
|
|
|
|
icon: <ApiOutlined/>,
|
|
|
|
|
label: t`My Connectors`,
|
|
|
|
|
disabled: !isAuthenticated,
|
|
|
|
|
onClick: () => navigate('/tracking/connectors')
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
2024-08-04 01:32:58 +02:00
|
|
|
key: 'stats',
|
|
|
|
|
icon: <LineChartOutlined/>,
|
|
|
|
|
label: t`Statistics`,
|
2024-08-22 19:26:34 +02:00
|
|
|
disabled: !isAuthenticated,
|
|
|
|
|
onClick: () => navigate('/stats')
|
2024-08-04 01:32:58 +02:00
|
|
|
}
|
2024-08-03 21:50:07 +02:00
|
|
|
]
|
|
|
|
|
|
2024-08-04 01:32:58 +02:00
|
|
|
if (isAuthenticated) {
|
|
|
|
|
menuItems.push(...[{
|
|
|
|
|
key: 'account',
|
|
|
|
|
icon: <UserOutlined/>,
|
|
|
|
|
label: t`My Account`,
|
|
|
|
|
onClick: () => navigate('/user')
|
|
|
|
|
}, {
|
|
|
|
|
key: 'logout',
|
2024-08-03 21:50:07 +02:00
|
|
|
icon: <LogoutOutlined/>,
|
|
|
|
|
label: t`Log out`,
|
|
|
|
|
danger: true,
|
|
|
|
|
onClick: () => window.location.replace("/logout")
|
2024-08-04 01:32:58 +02:00
|
|
|
}])
|
|
|
|
|
} else {
|
|
|
|
|
menuItems.push({
|
|
|
|
|
key: 'login',
|
2024-08-03 21:50:07 +02:00
|
|
|
icon: <LoginOutlined/>,
|
|
|
|
|
label: t`Log in`,
|
|
|
|
|
onClick: () => navigate('/login')
|
2024-08-04 01:32:58 +02:00
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return <Menu
|
|
|
|
|
defaultOpenKeys={['search', 'info', 'tracking', 'doc']}
|
|
|
|
|
mode="inline"
|
|
|
|
|
theme="dark"
|
|
|
|
|
items={menuItems}
|
2024-08-03 21:50:07 +02:00
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
}
|