misc_pterodactyl-panel/resources/scripts/routers/DashboardRouter.tsx

50 lines
2 KiB
TypeScript
Raw Normal View History

import React from 'react';
import { NavLink, Route, RouteComponentProps, Switch } from 'react-router-dom';
import TransitionRouter from '@/TransitionRouter';
2019-06-26 04:28:56 +00:00
import NavigationBar from '@/components/NavigationBar';
import DashboardContainer from '@/components/dashboard/DashboardContainer';
import AccountOverviewContainer from '@/components/dashboard/AccountOverviewContainer';
import AccountApiContainer from '@/components/dashboard/AccountApiContainer';
2022-02-13 21:54:12 +00:00
import SecurityKeyContainer from '@/components/dashboard/security/SecurityKeyContainer';
import SSHKeyContainer from '@/components/dashboard/SSHKeyContainer';
2021-01-31 02:01:32 +00:00
import { NotFound } from '@/components/elements/ScreenBlock';
import SubNavigation from '@/components/elements/SubNavigation';
2019-06-26 04:28:56 +00:00
export default ({ location }: RouteComponentProps) => (
<>
<NavigationBar/>
{location.pathname.startsWith('/account') &&
<SubNavigation>
<div>
<NavLink to={'/account'} exact>Settings</NavLink>
<NavLink to={'/account/api'}>API Credentials</NavLink>
<NavLink to={'/account/keys/security'}>Security Keys</NavLink>
<NavLink to={'/account/keys/ssh'}>SSH Keys</NavLink>
</div>
</SubNavigation>
}
<TransitionRouter>
<Switch location={location}>
<Route path={'/'} exact>
<DashboardContainer/>
</Route>
<Route path={'/account'} exact>
<AccountOverviewContainer/>
</Route>
<Route path={'/account/api'} exact>
<AccountApiContainer/>
</Route>
<Route path={'/account/keys/security'} exact>
<SecurityKeyContainer/>
</Route>
<Route path={'/account/keys/ssh'} exact>
<SSHKeyContainer/>
</Route>
<Route path={'*'}>
<NotFound/>
</Route>
</Switch>
</TransitionRouter>
</>
);