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

32 lines
1.4 KiB
TypeScript
Raw Normal View History

2019-06-26 04:28:56 +00:00
import * as React from 'react';
import { NavLink, Route, RouteComponentProps, Switch } from 'react-router-dom';
2019-06-26 04:28:56 +00:00
import AccountOverviewContainer from '@/components/dashboard/AccountOverviewContainer';
import NavigationBar from '@/components/NavigationBar';
import DashboardContainer from '@/components/dashboard/DashboardContainer';
import AccountApiContainer from '@/components/dashboard/AccountApiContainer';
import NotFound from '@/components/screens/NotFound';
2020-07-04 16:46:26 +00:00
import TransitionRouter from '@/TransitionRouter';
import SubNavigation from '@/components/elements/SubNavigation';
2019-06-26 04:28:56 +00:00
export default ({ location }: RouteComponentProps) => (
<>
2019-06-26 04:28:56 +00:00
<NavigationBar/>
{location.pathname.startsWith('/account') &&
<SubNavigation>
<div>
<NavLink to={'/account'} exact>Settings</NavLink>
<NavLink to={'/account/api'}>API Credentials</NavLink>
</div>
</SubNavigation>
}
<TransitionRouter>
<Switch location={location}>
<Route path={'/'} component={DashboardContainer} exact/>
<Route path={'/account'} component={AccountOverviewContainer} exact/>
<Route path={'/account/api'} component={AccountApiContainer} exact/>
<Route path={'*'} component={NotFound}/>
</Switch>
</TransitionRouter>
</>
2019-06-26 04:28:56 +00:00
);