diff --git a/web/src/components/layouts/withGame.tsx b/web/src/components/layouts/withGame.tsx index 44525b8e..458f0a8a 100644 --- a/web/src/components/layouts/withGame.tsx +++ b/web/src/components/layouts/withGame.tsx @@ -48,7 +48,17 @@ export default function withGame(WrappedComponent: React.ComponentType) { diff --git a/web/src/components/modals/TeamEditModal.tsx b/web/src/components/modals/TeamEditModal.tsx index 54817f9a..8228c116 100644 --- a/web/src/components/modals/TeamEditModal.tsx +++ b/web/src/components/modals/TeamEditModal.tsx @@ -177,9 +177,7 @@ export default function TeamEditModal(props: TeamEditModalProps) { children: ( <> - - person_remove - + person_remove 踢出成员 @@ -205,9 +203,7 @@ export default function TeamEditModal(props: TeamEditModalProps) { children: ( <> - - star - + star 转让队长 @@ -232,9 +228,7 @@ export default function TeamEditModal(props: TeamEditModalProps) { children: ( <> - - swap_horiz - + swap_horiz 解散团队 @@ -285,9 +279,7 @@ export default function TeamEditModal(props: TeamEditModalProps) { w={"40rem"} > - - group_add - + group_add 团队详情 @@ -442,14 +434,11 @@ export default function TeamEditModal(props: TeamEditModalProps) { label="队长" withArrow > - - - star - - + star + )} {isCaptain && @@ -511,7 +500,11 @@ export default function TeamEditModal(props: TeamEditModalProps) { diff --git a/web/src/components/modals/TeamJoinModal.tsx b/web/src/components/modals/TeamJoinModal.tsx index 05e7a977..6fdf5609 100644 --- a/web/src/components/modals/TeamJoinModal.tsx +++ b/web/src/components/modals/TeamJoinModal.tsx @@ -81,9 +81,7 @@ export default function TeamJoinModal(props: TeamJoinModalProps) { w={"40rem"} > - - waving_hand - + waving_hand 加入团队 @@ -103,7 +101,9 @@ export default function TeamJoinModal(props: TeamJoinModalProps) { diff --git a/web/src/components/modals/admin/ChallengeCreateModal.tsx b/web/src/components/modals/admin/ChallengeCreateModal.tsx index 89c86891..8bffb37d 100644 --- a/web/src/components/modals/admin/ChallengeCreateModal.tsx +++ b/web/src/components/modals/admin/ChallengeCreateModal.tsx @@ -86,9 +86,7 @@ export default function ChallengeCreateModal(props: ChallengeCreateModalProps) { w={"40rem"} > - - collections_bookmark - + collections_bookmark 创建题目 @@ -146,7 +144,9 @@ export default function ChallengeCreateModal(props: ChallengeCreateModalProps) { diff --git a/web/src/components/modals/admin/ChallengeFlagCreateModal.tsx b/web/src/components/modals/admin/ChallengeFlagCreateModal.tsx index ea13101b..b5ddd70c 100644 --- a/web/src/components/modals/admin/ChallengeFlagCreateModal.tsx +++ b/web/src/components/modals/admin/ChallengeFlagCreateModal.tsx @@ -82,9 +82,7 @@ export default function ChallengeFlagCreateModal( w={"40rem"} > - - flag - + flag 创建 Flag @@ -138,7 +136,9 @@ export default function ChallengeFlagCreateModal( diff --git a/web/src/components/modals/admin/ChallengeSelectModal.tsx b/web/src/components/modals/admin/ChallengeSelectModal.tsx index af1637d8..f6229a01 100644 --- a/web/src/components/modals/admin/ChallengeSelectModal.tsx +++ b/web/src/components/modals/admin/ChallengeSelectModal.tsx @@ -68,9 +68,7 @@ export default function ChallengeSelectModal(props: ChallengeSelectModalProps) { w={"40rem"} > - - collections_bookmark - + collections_bookmark 选择题目 @@ -90,16 +88,13 @@ export default function ChallengeSelectModal(props: ChallengeSelectModalProps) { > {challenge?.id} - - - {challenge?.category?.icon} - - + {challenge?.category?.icon} + {challenge?.title} diff --git a/web/src/components/modals/admin/GameChallengeCreateModal.tsx b/web/src/components/modals/admin/GameChallengeCreateModal.tsx index 01f97eed..2fed7b7a 100644 --- a/web/src/components/modals/admin/GameChallengeCreateModal.tsx +++ b/web/src/components/modals/admin/GameChallengeCreateModal.tsx @@ -137,9 +137,7 @@ export default function GameChallengeCreateModal( w={"40rem"} > - - collections_bookmark - + collections_bookmark 添加题目 @@ -161,22 +159,19 @@ export default function GameChallengeCreateModal( {challenge && ( <> - - - { - challenge - ?.category - ?.icon - } - - + { + challenge + ?.category + ?.icon + } + diff --git a/web/src/components/modals/admin/GameCreateModal.tsx b/web/src/components/modals/admin/GameCreateModal.tsx index 4e741979..af9a465a 100644 --- a/web/src/components/modals/admin/GameCreateModal.tsx +++ b/web/src/components/modals/admin/GameCreateModal.tsx @@ -89,9 +89,7 @@ export default function GameCreateModal(props: GameCreateModalProps) { w={"40rem"} > - - flag - + flag 创建比赛 @@ -152,7 +150,9 @@ export default function GameCreateModal(props: GameCreateModalProps) { diff --git a/web/src/components/modals/admin/GameNoticeCreateModal.tsx b/web/src/components/modals/admin/GameNoticeCreateModal.tsx index f256d9d1..21ed7a95 100644 --- a/web/src/components/modals/admin/GameNoticeCreateModal.tsx +++ b/web/src/components/modals/admin/GameNoticeCreateModal.tsx @@ -73,9 +73,7 @@ export default function GameNoticeCreateModal( w={"40rem"} > - - campaign - + campaign 创建公告 @@ -94,7 +92,9 @@ export default function GameNoticeCreateModal( diff --git a/web/src/components/modals/admin/GameTeamCreateModal.tsx b/web/src/components/modals/admin/GameTeamCreateModal.tsx index 5f5d47f7..ff819f98 100644 --- a/web/src/components/modals/admin/GameTeamCreateModal.tsx +++ b/web/src/components/modals/admin/GameTeamCreateModal.tsx @@ -109,9 +109,7 @@ export default function GameTeamCreateModal(props: GameTeamCreateModalProps) { w={"40rem"} > - - people - + people 添加团队 @@ -158,7 +156,9 @@ export default function GameTeamCreateModal(props: GameTeamCreateModalProps) { diff --git a/web/src/components/modals/admin/TeamCreateModal.tsx b/web/src/components/modals/admin/TeamCreateModal.tsx index 40418145..88af1ef7 100644 --- a/web/src/components/modals/admin/TeamCreateModal.tsx +++ b/web/src/components/modals/admin/TeamCreateModal.tsx @@ -126,9 +126,7 @@ export default function TeamCreateModal(props: TeamCreateModalProps) { w={"40rem"} > - - group_add - + group_add 创建团队 @@ -193,7 +191,9 @@ export default function TeamCreateModal(props: TeamCreateModalProps) { diff --git a/web/src/components/modals/admin/TeamEditModal.tsx b/web/src/components/modals/admin/TeamEditModal.tsx index daddd04d..af4b1a44 100644 --- a/web/src/components/modals/admin/TeamEditModal.tsx +++ b/web/src/components/modals/admin/TeamEditModal.tsx @@ -189,9 +189,7 @@ export default function TeamEditModal(props: TeamEditModalProps) { children: ( <> - - person_remove - + person_remove 踢出成员 @@ -217,9 +215,7 @@ export default function TeamEditModal(props: TeamEditModalProps) { children: ( <> - - star - + star 转让队长 @@ -277,9 +273,7 @@ export default function TeamEditModal(props: TeamEditModalProps) { w={"40rem"} > - - group_add - + group_add 团队详情 @@ -418,14 +412,11 @@ export default function TeamEditModal(props: TeamEditModalProps) { label="队长" withArrow > - - - star - - + star + )} {user?.id !== @@ -476,7 +467,9 @@ export default function TeamEditModal(props: TeamEditModalProps) { diff --git a/web/src/components/modals/admin/TeamSelectModal.tsx b/web/src/components/modals/admin/TeamSelectModal.tsx index c842d464..99bc6c20 100644 --- a/web/src/components/modals/admin/TeamSelectModal.tsx +++ b/web/src/components/modals/admin/TeamSelectModal.tsx @@ -68,9 +68,7 @@ export default function TeamSelectModal(props: TeamSelectModalProps) { w={"40rem"} > - - people - + people 选择团队 diff --git a/web/src/components/modals/admin/UserCreateModal.tsx b/web/src/components/modals/admin/UserCreateModal.tsx index 993b8990..6305850f 100644 --- a/web/src/components/modals/admin/UserCreateModal.tsx +++ b/web/src/components/modals/admin/UserCreateModal.tsx @@ -105,9 +105,7 @@ export default function UserCreateModal(props: UserCreateModalProps) { w={"40rem"} > - - person_add - + person_add 创建用户 @@ -158,7 +156,9 @@ export default function UserCreateModal(props: UserCreateModalProps) { diff --git a/web/src/components/modals/admin/UserEditModal.tsx b/web/src/components/modals/admin/UserEditModal.tsx index a90cc371..c158b0e0 100644 --- a/web/src/components/modals/admin/UserEditModal.tsx +++ b/web/src/components/modals/admin/UserEditModal.tsx @@ -163,9 +163,7 @@ export default function UserEditModal(props: UserEditModalProps) { pos={"relative"} > - - person_add - + person_add 更新用户 @@ -286,7 +284,9 @@ export default function UserEditModal(props: UserEditModalProps) { diff --git a/web/src/components/modals/admin/UserSelectModal.tsx b/web/src/components/modals/admin/UserSelectModal.tsx index 20a0a00a..5f3d60ea 100644 --- a/web/src/components/modals/admin/UserSelectModal.tsx +++ b/web/src/components/modals/admin/UserSelectModal.tsx @@ -68,9 +68,7 @@ export default function UserSelectModal(props: UserSelectModalProps) { w={"40rem"} > - - person - + person 选择用户 diff --git a/web/src/components/navigations/Navbar.tsx b/web/src/components/navigations/Navbar.tsx index 2def01f1..181d7c69 100644 --- a/web/src/components/navigations/Navbar.tsx +++ b/web/src/components/navigations/Navbar.tsx @@ -107,7 +107,11 @@ export default function Navbar() { backgroundColor: "transparent", }, }} - leftSection={collections_bookmark} + leftSection={ + + collections_bookmark + + } onClick={() => navigate("/challenges")} > 题库 @@ -119,7 +123,7 @@ export default function Navbar() { backgroundColor: "transparent", }, }} - leftSection={flag} + leftSection={flag} onClick={() => navigate("/games")} > 比赛 @@ -131,7 +135,9 @@ export default function Navbar() { backgroundColor: "transparent", }, }} - leftSection={people} + leftSection={ + people + } onClick={() => navigate("/teams")} > 团队 @@ -144,7 +150,9 @@ export default function Navbar() { backgroundColor: "transparent", }, }} - leftSection={settings} + leftSection={ + settings + } onClick={() => navigate("/admin")} > 管理 @@ -161,7 +169,9 @@ export default function Navbar() { backgroundColor: "transparent", }, }} - leftSection={keyboard_return} + leftSection={ + keyboard_return + } onClick={() => navigate("/")} > 返回 @@ -173,7 +183,9 @@ export default function Navbar() { backgroundColor: "transparent", }, }} - leftSection={settings} + leftSection={ + settings + } onClick={() => navigate("/admin/global")} > 全局 @@ -185,7 +197,11 @@ export default function Navbar() { backgroundColor: "transparent", }, }} - leftSection={collections_bookmark} + leftSection={ + + collections_bookmark + + } onClick={() => navigate("/admin/challenges")} > 题库 @@ -197,7 +213,9 @@ export default function Navbar() { backgroundColor: "transparent", }, }} - leftSection={category} + leftSection={ + category + } onClick={() => navigate("/admin/categories")} > 分类 @@ -209,7 +227,7 @@ export default function Navbar() { backgroundColor: "transparent", }, }} - leftSection={flag} + leftSection={flag} onClick={() => navigate("/admin/games")} > 比赛 @@ -221,7 +239,9 @@ export default function Navbar() { backgroundColor: "transparent", }, }} - leftSection={people} + leftSection={ + people + } onClick={() => navigate("/admin/teams")} > 团队 @@ -233,7 +253,9 @@ export default function Navbar() { backgroundColor: "transparent", }, }} - leftSection={person} + leftSection={ + person + } onClick={() => navigate("/admin/users")} > 用户 @@ -253,7 +275,7 @@ export default function Navbar() { ); }} > - + {colorScheme === "dark" ? "light_mode" : "dark_mode"} @@ -304,7 +326,9 @@ export default function Navbar() { logout} + leftSection={ + logout + } onClick={logout} > 退出 diff --git a/web/src/components/navigations/admin/ChallengeEditSidebar.tsx b/web/src/components/navigations/admin/ChallengeEditSidebar.tsx index 36fea1bd..ae1c06b3 100644 --- a/web/src/components/navigations/admin/ChallengeEditSidebar.tsx +++ b/web/src/components/navigations/admin/ChallengeEditSidebar.tsx @@ -16,7 +16,7 @@ export default function ChallengeEditSidebar(props: ChallengeEditSidebarProps) { @@ -49,7 +61,11 @@ export default function ChallengeEditSidebar(props: ChallengeEditSidebarProps) { onClick={() => navigate(`/admin/challenges/${id}/submissions`) } - leftSection={verified} + leftSection={ + + verified + + } > 提交记录 diff --git a/web/src/components/navigations/admin/GameEditSidebar.tsx b/web/src/components/navigations/admin/GameEditSidebar.tsx index 9a6b719b..3e64dfce 100644 --- a/web/src/components/navigations/admin/GameEditSidebar.tsx +++ b/web/src/components/navigations/admin/GameEditSidebar.tsx @@ -16,7 +16,7 @@ export default function GameEditSidebar(props: GameEditSidebarProps) { diff --git a/web/src/components/ui/MDIcon.tsx b/web/src/components/ui/MDIcon.tsx index 77a2e62c..3517dd6c 100644 --- a/web/src/components/ui/MDIcon.tsx +++ b/web/src/components/ui/MDIcon.tsx @@ -1,18 +1,26 @@ -export default function MDIcon({ - size, - children, -}: { - size?: number; - children: React.ReactNode; -}) { - return ( - - {children} - - ); +import { forwardRef, ReactNode } from "react"; +import { ThemeIcon, ThemeIconProps } from "@mantine/core"; + +interface MDIconProps extends ThemeIconProps { + children: ReactNode; } + +const MDIcon = forwardRef( + ({ children, size, ...themeIconProps }, ref) => { + return ( + + + {children} + + + ); + } +); + +export default MDIcon; diff --git a/web/src/components/widgets/ChallengeCard.tsx b/web/src/components/widgets/ChallengeCard.tsx index 4fedeb44..a5ed24f1 100644 --- a/web/src/components/widgets/ChallengeCard.tsx +++ b/web/src/components/widgets/ChallengeCard.tsx @@ -84,14 +84,16 @@ export default function ChallengeCard({ > - {challenge?.category?.icon} + + {challenge?.category?.icon} + {challenge?.solved && ( - - done - + + done + )} diff --git a/web/src/components/widgets/GameNoticeArea.tsx b/web/src/components/widgets/GameNoticeArea.tsx index 118cd7b1..768d17f2 100644 --- a/web/src/components/widgets/GameNoticeArea.tsx +++ b/web/src/components/widgets/GameNoticeArea.tsx @@ -72,9 +72,7 @@ export default function GameNoticeArea() { }} > {notice?.type === "normal" && ( - - campaign - + campaign )} {notice?.type === "first_blood" && ( @@ -86,9 +84,7 @@ export default function GameNoticeArea() { )} {notice?.type === "new_challenge" && ( - - add - + add )} - - people - + people @@ -73,16 +71,16 @@ export default function TeamCard({ team }: { team?: Team }) { - - people - + people + ); diff --git a/web/src/components/widgets/admin/ChallengeFlagAccordion.tsx b/web/src/components/widgets/admin/ChallengeFlagAccordion.tsx index 2659d8f6..b82718ec 100644 --- a/web/src/components/widgets/admin/ChallengeFlagAccordion.tsx +++ b/web/src/components/widgets/admin/ChallengeFlagAccordion.tsx @@ -83,9 +83,7 @@ export default function ChallengeFlagAccordion( children: ( <> - - flag - + flag 删除 Flag @@ -132,10 +130,9 @@ export default function ChallengeFlagAccordion( openDeleteFlagModal()} > - delete + delete @@ -188,7 +185,7 @@ export default function ChallengeFlagAccordion( diff --git a/web/src/components/widgets/admin/GameChallengeAccordion.tsx b/web/src/components/widgets/admin/GameChallengeAccordion.tsx index bd1ae929..e30ceb5e 100644 --- a/web/src/components/widgets/admin/GameChallengeAccordion.tsx +++ b/web/src/components/widgets/admin/GameChallengeAccordion.tsx @@ -99,9 +99,7 @@ export default function GameChallengeAccordion({ children: ( <> - - bookmark_remove - + bookmark_remove 删除题目 @@ -143,16 +141,13 @@ export default function GameChallengeAccordion({ {gameChallenge?.challenge?.id} - - - {gameChallenge?.challenge?.category?.icon} - - + {gameChallenge?.challenge?.category?.icon} + {gameChallenge?.challenge?.title} @@ -180,12 +175,11 @@ export default function GameChallengeAccordion({ openDeleteGameChallengeModal(gameChallenge) } > - delete + delete @@ -209,7 +203,7 @@ export default function GameChallengeAccordion({ diff --git a/web/src/pages/admin/categories/index.tsx b/web/src/pages/admin/categories/index.tsx new file mode 100644 index 00000000..d2d2d588 --- /dev/null +++ b/web/src/pages/admin/categories/index.tsx @@ -0,0 +1,111 @@ +import MDIcon from "@/components/ui/MDIcon"; +import { + Flex, + Stack, + ActionIcon, + Paper, + Table, + Badge, + Group, + Text, + ColorSwatch, +} from "@mantine/core"; +import { useEffect, useState } from "react"; +import { Category } from "@/types/category"; +import { useCategoryApi } from "@/api/category"; + +export default function Page() { + const categoryApi = useCategoryApi(); + const [categories, setCategories] = useState>([]); + + function getCategories() { + categoryApi.getCategories().then((res) => { + const r = res.data; + setCategories(r?.data); + }); + } + + useEffect(() => { + getCategories(); + }, []); + + return ( + <> + + + + + + # + 分类名 + 颜色(Hex) + 图标 + + + + add + + + + + + + {categories?.map((category) => ( + + + {category?.id} + + + {category?.name?.toUpperCase()} + + + + + + {category?.color?.toUpperCase()} + + + + + + {category?.icon} + {category?.icon} + + + + + + edit + + + + delete + + + + + + ))} + +
+
+
+ + ); +} diff --git a/web/src/pages/admin/challenges/[id]/flags.tsx b/web/src/pages/admin/challenges/[id]/flags.tsx index ed497d37..66d0ab49 100644 --- a/web/src/pages/admin/challenges/[id]/flags.tsx +++ b/web/src/pages/admin/challenges/[id]/flags.tsx @@ -56,9 +56,7 @@ function Page() { - - flag - + flag Flags diff --git a/web/src/pages/admin/challenges/[id]/images.tsx b/web/src/pages/admin/challenges/[id]/images.tsx index f4b060b6..0ace8935 100644 --- a/web/src/pages/admin/challenges/[id]/images.tsx +++ b/web/src/pages/admin/challenges/[id]/images.tsx @@ -95,9 +95,7 @@ function Page() { - - deployed_code_update - + deployed_code_update 镜像参数 @@ -129,9 +127,7 @@ function Page() { - - upgrade - + upgrade 端口映射 @@ -206,11 +202,8 @@ function Page() { setPorts(newPorts); }} > - - delete + + delete @@ -219,9 +212,7 @@ function Page() { - - language - + language 环境变量 @@ -294,11 +285,8 @@ function Page() { setEnvs(newEnvs); }} > - - delete + + delete @@ -307,7 +295,7 @@ function Page() { diff --git a/web/src/pages/admin/challenges/[id]/index.tsx b/web/src/pages/admin/challenges/[id]/index.tsx index 79f70b2e..718bb5b7 100644 --- a/web/src/pages/admin/challenges/[id]/index.tsx +++ b/web/src/pages/admin/challenges/[id]/index.tsx @@ -155,9 +155,7 @@ function Page() { - - info - + info 基本信息 @@ -240,11 +238,10 @@ function Page() { deleteAttachment()} > - delete + delete @@ -281,7 +278,7 @@ function Page() { diff --git a/web/src/pages/admin/challenges/[id]/submissions.tsx b/web/src/pages/admin/challenges/[id]/submissions.tsx index 75517ff2..580c4206 100644 --- a/web/src/pages/admin/challenges/[id]/submissions.tsx +++ b/web/src/pages/admin/challenges/[id]/submissions.tsx @@ -127,9 +127,7 @@ function Page() { - - verified - + verified 提交记录 @@ -226,11 +224,10 @@ function Page() { withArrow label="删除提交记录" > - - delete + + + delete + diff --git a/web/src/pages/admin/challenges/index.tsx b/web/src/pages/admin/challenges/index.tsx index 9dc182da..0d53d600 100644 --- a/web/src/pages/admin/challenges/index.tsx +++ b/web/src/pages/admin/challenges/index.tsx @@ -112,9 +112,7 @@ export default function Page() { children: ( <> - - bookmark_remove - + bookmark_remove 删除题目 @@ -158,7 +156,9 @@ export default function Page() { }} /> setSearch(searchInput)}> - search + + search + openDeleteGameModal( game ) } > - delete + + delete + diff --git a/web/src/pages/admin/teams/index.tsx b/web/src/pages/admin/teams/index.tsx index cbb998dd..7278a563 100644 --- a/web/src/pages/admin/teams/index.tsx +++ b/web/src/pages/admin/teams/index.tsx @@ -91,9 +91,7 @@ export default function Page() { children: ( <> - - person_remove - + person_remove 删除团队 @@ -137,7 +135,9 @@ export default function Page() { }} /> setSearch(searchInput)}> - search + + search + openDeleteUserModal( user ) } > - delete + + delete +
diff --git a/web/src/pages/challenges/index.tsx b/web/src/pages/challenges/index.tsx index c2aeeab9..db4b1607 100644 --- a/web/src/pages/challenges/index.tsx +++ b/web/src/pages/challenges/index.tsx @@ -111,7 +111,9 @@ export default function Page() { setSearch(searchInput)} > - search + + search +