diff options
author | crupest <crupest@outlook.com> | 2020-07-13 20:59:52 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-07-13 20:59:52 +0800 |
commit | e69190abb09661caa19fa3905a0d8f3b7e72648b (patch) | |
tree | 8030e6a2539347ccb12f0a6bbd31a1f390c6a7b7 /Timeline/ClientApp/src/app/admin/Admin.tsx | |
parent | 0a7c884be668267003d7666b444f1022c99a7148 (diff) | |
download | timeline-e69190abb09661caa19fa3905a0d8f3b7e72648b.tar.gz timeline-e69190abb09661caa19fa3905a0d8f3b7e72648b.tar.bz2 timeline-e69190abb09661caa19fa3905a0d8f3b7e72648b.zip |
Move front end to a submodule.
Diffstat (limited to 'Timeline/ClientApp/src/app/admin/Admin.tsx')
-rw-r--r-- | Timeline/ClientApp/src/app/admin/Admin.tsx | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/Timeline/ClientApp/src/app/admin/Admin.tsx b/Timeline/ClientApp/src/app/admin/Admin.tsx deleted file mode 100644 index 9e7d592f..00000000 --- a/Timeline/ClientApp/src/app/admin/Admin.tsx +++ /dev/null @@ -1,78 +0,0 @@ -import React, { Fragment } from 'react'; -import { Nav, NavItem, NavLink } from 'reactstrap'; -import { - Redirect, - Route, - Switch, - useRouteMatch, - useHistory -} from 'react-router'; -import classnames from 'classnames'; - -import AppBar from '../common/AppBar'; -import UserAdmin from './UserAdmin'; - -import { UserWithToken } from '../data/user'; - -interface AdminProps { - user: UserWithToken; -} - -const Admin: React.FC<AdminProps> = props => { - const match = useRouteMatch(); - const history = useHistory(); - type TabNames = 'users' | 'more'; - - const tabName = history.location.pathname.replace(match.path + '/', ''); - - function toggle(newTab: TabNames): void { - history.push(`${match.url}/${newTab}`); - } - - const createRoute = ( - name: string, - body: React.ReactNode - ): React.ReactNode => { - return ( - <Route path={`${match.path}/${name}`}> - <AppBar /> - <div style={{ height: 56 }} className="flex-fix-length" /> - <Nav tabs> - <NavItem> - <NavLink - className={classnames({ active: tabName === 'users' })} - onClick={() => { - toggle('users'); - }} - > - Users - </NavLink> - </NavItem> - <NavItem> - <NavLink - className={classnames({ active: tabName === 'more' })} - onClick={() => { - toggle('more'); - }} - > - More - </NavLink> - </NavItem> - </Nav> - {body} - </Route> - ); - }; - - return ( - <Fragment> - <Switch> - <Redirect from={match.path} to={`${match.path}/users`} exact /> - {createRoute('users', <UserAdmin user={props.user} />)} - {createRoute('more', <div>More Page Works</div>)} - </Switch> - </Fragment> - ); -}; - -export default Admin; |