aboutsummaryrefslogtreecommitdiff
path: root/FrontEnd/src/views/admin/Admin.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'FrontEnd/src/views/admin/Admin.tsx')
-rw-r--r--FrontEnd/src/views/admin/Admin.tsx47
1 files changed, 13 insertions, 34 deletions
diff --git a/FrontEnd/src/views/admin/Admin.tsx b/FrontEnd/src/views/admin/Admin.tsx
index e750621c..adb1e458 100644
--- a/FrontEnd/src/views/admin/Admin.tsx
+++ b/FrontEnd/src/views/admin/Admin.tsx
@@ -1,48 +1,27 @@
-import React, { Fragment } from "react";
-import { Redirect, Route, Switch, useRouteMatch, match } from "react-router";
+import React from "react";
+import { Route, Routes } from "react-router-dom";
import { useTranslation } from "react-i18next";
-import { AuthUser } from "@/services/user";
-
import AdminNav from "./AdminNav";
import UserAdmin from "./UserAdmin";
import MoreAdmin from "./MoreAdmin";
import "./index.css";
-interface AdminProps {
- user: AuthUser;
-}
-
-const Admin: React.FC<AdminProps> = ({ user }) => {
+const Admin: React.FC = () => {
useTranslation("admin");
- const match = useRouteMatch();
-
return (
- <Fragment>
- <Switch>
- <Redirect from={match.path} to={`${match.path}/users`} exact />
- <Route path={`${match.path}/:name`}>
- {(p) => {
- const match = p.match as match<{ name: string }>;
- const name = match.params["name"];
- return (
- <div className="container">
- <AdminNav className="mt-2" />
- {(() => {
- if (name === "users") {
- return <UserAdmin user={user} />;
- } else if (name === "more") {
- return <MoreAdmin user={user} />;
- }
- })()}
- </div>
- );
- }}
- </Route>
- </Switch>
- </Fragment>
+ <>
+ <div className="container">
+ <AdminNav className="mt-2" />
+ <Routes>
+ <Route index element={<UserAdmin />} />
+ <Route path="/admin/user" element={<UserAdmin />} />
+ <Route path="/admin/more" element={<MoreAdmin />} />
+ </Routes>
+ </div>
+ </>
);
};