Add user management features.

This commit is contained in:
2025-05-14 18:49:49 +08:00
parent 3b7d52a7a8
commit 703812d3df
10 changed files with 447 additions and 40 deletions

View File

@@ -7,6 +7,8 @@ import { MdMoreHoriz, MdSearch } from "react-icons/md";
import Pagination from "../components/pagination";
import showPopup, { PopupMenuItem } from "../components/popup";
import { useTranslation } from "react-i18next";
import { app } from "../app";
import { ErrorAlert } from "../components/alert";
export default function UserView() {
const { t } = useTranslation();
@@ -16,6 +18,14 @@ export default function UserView() {
const [totalPages, setTotalPages] = useState(0);
if (!app.user) {
return <ErrorAlert className={"m-4"} message={t("You are not logged in. Please log in to access this page.")} />
}
if (!app.user?.is_admin) {
return <ErrorAlert className={"m-4"} message={t("You are not authorized to access this page.")} />
}
return <>
<div className={"flex flex-row justify-between items-center mx-4 my-4"}>
<form className={"flex flex-row gap-2 items-center w-64"} onSubmit={(e) => {