feat: update frontend for four-tier role system

Add Student Admin and Teacher Admin roles to constants, types, store,
permissions, routes, and admin UI. Teacher Admin sees contests and
problemsets in sidebar; Student Admin sees only problems.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-02 18:13:39 -06:00
parent 8444d6e21a
commit 2fbcbd07c5
11 changed files with 112 additions and 52 deletions

View File

@@ -133,15 +133,22 @@ export function debounce<T extends (...args: any[]) => any>(
}
export function getUserRole(role: User["admin_type"]): {
type: "default" | "info" | "error"
label: "普通" | "管理员" | "超管"
type: "default" | "info" | "warning" | "error"
label: "普通" | "学生管理员" | "教师管理员" | "超管"
} {
const roleMap = {
[USER_TYPE.REGULAR_USER]: {
type: "default" as const,
label: "普通" as const,
},
[USER_TYPE.ADMIN]: { type: "info" as const, label: "管理员" as const },
[USER_TYPE.STUDENT_ADMIN]: {
type: "info" as const,
label: "学生管理员" as const,
},
[USER_TYPE.TEACHER_ADMIN]: {
type: "warning" as const,
label: "教师管理员" as const,
},
[USER_TYPE.SUPER_ADMIN]: {
type: "error" as const,
label: "超管" as const,