diff options
author | crupest <crupest@outlook.com> | 2020-11-22 09:53:31 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-22 09:53:31 +0800 |
commit | ef9489a8c1084d33796da366c685bc24550eafbd (patch) | |
tree | 59227246f0964dcdc9b735d64a0397a9dd3a58bf /FrontEnd/src/app/views/admin/AdminNav.tsx | |
parent | ffa5d76316ccec4edc307d0432ef10fb18436c63 (diff) | |
parent | f451000f281a4c9c44caf4dc835d3b2fdb55fa81 (diff) | |
download | timeline-ef9489a8c1084d33796da366c685bc24550eafbd.tar.gz timeline-ef9489a8c1084d33796da366c685bc24550eafbd.tar.bz2 timeline-ef9489a8c1084d33796da366c685bc24550eafbd.zip |
Merge pull request #189 from crupest/admin
Refactor front end to use the new permission system. Enhance admin page.
Diffstat (limited to 'FrontEnd/src/app/views/admin/AdminNav.tsx')
-rw-r--r-- | FrontEnd/src/app/views/admin/AdminNav.tsx | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/FrontEnd/src/app/views/admin/AdminNav.tsx b/FrontEnd/src/app/views/admin/AdminNav.tsx new file mode 100644 index 00000000..f376beda --- /dev/null +++ b/FrontEnd/src/app/views/admin/AdminNav.tsx @@ -0,0 +1,44 @@ +import React from "react"; +import { Nav } from "react-bootstrap"; +import { useTranslation } from "react-i18next"; +import { useHistory, useRouteMatch } from "react-router"; + +const AdminNav: React.FC = () => { + const match = useRouteMatch<{ name: string }>(); + const history = useHistory(); + + const { t } = useTranslation(); + + const name = match.params.name; + + function toggle(newTab: string): void { + history.push(`/admin/${newTab}`); + } + + return ( + <Nav variant="tabs" className="my-2"> + <Nav.Item> + <Nav.Link + active={name === "users"} + onClick={() => { + toggle("users"); + }} + > + {t("admin:nav.users")} + </Nav.Link> + </Nav.Item> + <Nav.Item> + <Nav.Link + active={name === "highlighttimelines"} + onClick={() => { + toggle("highlighttimelines"); + }} + > + {t("admin:nav.highlightTimelines")} + </Nav.Link> + </Nav.Item> + </Nav> + ); +}; + +export default AdminNav; |