Skip to content

Commit

Permalink
chore(frontend): tidy up
Browse files Browse the repository at this point in the history
  • Loading branch information
ElaBosak233 committed May 30, 2024
1 parent b0478e3 commit 58a78d4
Show file tree
Hide file tree
Showing 32 changed files with 13 additions and 61 deletions.
1 change: 1 addition & 0 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"scripts": {
"dev": "vite",
"build": "vite build",
"tsc": "tsc",
"tsc:build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
Expand Down
3 changes: 0 additions & 3 deletions web/src/components/modals/GameTeamApplyModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ import {
Group,
Modal,
ModalProps,
Pagination,
Stack,
TextInput,
ThemeIcon,
Text,
} from "@mantine/core";
import { useState, useEffect } from "react";
Expand Down
1 change: 0 additions & 1 deletion web/src/components/modals/TeamCreateModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
Flex,
Modal,
ModalProps,
ThemeIcon,
Text,
Divider,
TextInput,
Expand Down
1 change: 0 additions & 1 deletion web/src/components/modals/TeamEditModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
Flex,
Modal,
ModalProps,
ThemeIcon,
Text,
Divider,
Box,
Expand Down
3 changes: 1 addition & 2 deletions web/src/components/modals/TeamJoinModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
Flex,
Modal,
ModalProps,
ThemeIcon,
Text,
TextInput,
Button,
Expand Down Expand Up @@ -52,7 +51,7 @@ export default function TeamJoinModal(props: TeamJoinModalProps) {
message: "加入团队成功",
});
})
.catch((e) => {
.catch((_) => {
showErrNotification({
message: "邀请码无效或团队已被锁定",
});
Expand Down
2 changes: 0 additions & 2 deletions web/src/components/modals/admin/TeamCreateModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
Flex,
Modal,
ModalProps,
ThemeIcon,
Text,
Divider,
TextInput,
Expand All @@ -12,7 +11,6 @@ import {
Button,
Box,
Input,
Avatar,
Group,
} from "@mantine/core";
import MDIcon from "@/components/ui/MDIcon";
Expand Down
1 change: 0 additions & 1 deletion web/src/components/modals/admin/TeamEditModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
Flex,
Modal,
ModalProps,
ThemeIcon,
Text,
Divider,
Box,
Expand Down
1 change: 0 additions & 1 deletion web/src/components/modals/admin/TeamSelectModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
Modal,
ModalProps,
TextInput,
ThemeIcon,
Text,
Stack,
Avatar,
Expand Down
1 change: 0 additions & 1 deletion web/src/components/modals/admin/UserCreateModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
Flex,
Modal,
ModalProps,
ThemeIcon,
Text,
Divider,
TextInput,
Expand Down
1 change: 0 additions & 1 deletion web/src/components/modals/admin/UserEditModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
Flex,
Modal,
ModalProps,
ThemeIcon,
Text,
Divider,
TextInput,
Expand Down
1 change: 0 additions & 1 deletion web/src/components/modals/admin/UserSelectModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
Modal,
ModalProps,
TextInput,
ThemeIcon,
Text,
Stack,
Avatar,
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/widgets/GameNoticeArea.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useGameApi } from "@/api/game";
import { Notice } from "@/types/notice";
import { Box, Flex, ScrollArea, ThemeIcon } from "@mantine/core";
import { Box, Flex, ScrollArea } from "@mantine/core";
import { useEffect, useState } from "react";
import { useParams } from "react-router-dom";
import MDIcon from "@/components/ui/MDIcon";
Expand Down
1 change: 0 additions & 1 deletion web/src/components/widgets/TeamCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
Box,
Card,
Flex,
ThemeIcon,
alpha,
Text,
Stack,
Expand Down
3 changes: 1 addition & 2 deletions web/src/components/widgets/admin/ChallengeFlagAccordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
Switch,
Text,
TextInput,
ThemeIcon,
Tooltip,
} from "@mantine/core";
import { useForm } from "@mantine/form";
Expand All @@ -32,7 +31,7 @@ interface ChallengeFlagAccordionProps {
export default function ChallengeFlagAccordion(
props: ChallengeFlagAccordionProps
) {
const { flag, setRefresh, ...otherProps } = props;
const { flag, setRefresh } = props;
const challengeApi = useChallengeApi();

const form = useForm({
Expand Down
2 changes: 0 additions & 2 deletions web/src/components/widgets/admin/GameChallengeAccordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@ import {
Flex,
Group,
Switch,
ThemeIcon,
Tooltip,
ActionIcon,
Text,
NumberInput,
Button,
Stack,
Badge,
Center,
Divider,
Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/[...all].tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect, useState } from "react";
import { useEffect } from "react";
import { useConfigStore } from "@/stores/config";
import { Box, Text } from "@mantine/core";

Expand Down
2 changes: 0 additions & 2 deletions web/src/pages/admin/challenges/[id]/flags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ import ChallengeFlagAccordion from "@/components/widgets/admin/ChallengeFlagAcco
import { Challenge } from "@/types/challenge";
import {
Accordion,
Button,
Flex,
Group,
Stack,
ThemeIcon,
Text,
Divider,
ActionIcon,
Expand Down
1 change: 0 additions & 1 deletion web/src/pages/admin/challenges/[id]/images.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
Stack,
Text,
TextInput,
ThemeIcon,
Tooltip,
} from "@mantine/core";
import { useForm } from "@mantine/form";
Expand Down
1 change: 0 additions & 1 deletion web/src/pages/admin/challenges/[id]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {
Switch,
TextInput,
Textarea,
ThemeIcon,
Tooltip,
} from "@mantine/core";
import { useForm, zodResolver } from "@mantine/form";
Expand Down
6 changes: 1 addition & 5 deletions web/src/pages/admin/challenges/[id]/submissions.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
import { useChallengeApi } from "@/api/challenge";
import { useGameApi } from "@/api/game";
import { useSubmissionApi } from "@/api/submission";
import withChallengeEdit from "@/components/layouts/admin/withChallengeEdit";
import withGameEdit from "@/components/layouts/admin/withGameEdit";
import MDIcon from "@/components/ui/MDIcon";
import { Challenge } from "@/types/challenge";
import { Game } from "@/types/game";
import { Submission } from "@/types/submission";
import {
Divider,
Group,
Stack,
ThemeIcon,
Text,
Table,
Pagination,
Expand All @@ -35,7 +31,7 @@ function Page() {
const [submissions, setSubmissions] = useState<Array<Submission>>([]);

const [total, setTotal] = useState<number>(0);
const [rowsPerPage, setRowsPerPage] = useState<number>(10);
const [rowsPerPage, _] = useState<number>(10);
const [page, setPage] = useState<number>(1);

const [loading, setLoading] = useState<boolean>(false);
Expand Down
1 change: 0 additions & 1 deletion web/src/pages/admin/games/[id]/challenges.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
LoadingOverlay,
Stack,
Text,
ThemeIcon,
Tooltip,
} from "@mantine/core";
import { useDisclosure } from "@mantine/hooks";
Expand Down
1 change: 0 additions & 1 deletion web/src/pages/admin/games/[id]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
Button,
Group,
Divider,
ThemeIcon,
} from "@mantine/core";
import { DateTimePicker } from "@mantine/dates";
import { Dropzone } from "@mantine/dropzone";
Expand Down
3 changes: 1 addition & 2 deletions web/src/pages/admin/games/[id]/notices.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
Flex,
Group,
Stack,
ThemeIcon,
Tooltip,
Text,
Badge,
Expand All @@ -33,7 +32,7 @@ function Page() {
const [game, setGame] = useState<Game>();
const [refresh, setRefresh] = useState<number>(0);
const [notices, setNotices] = useState<Array<Notice>>();
const [rowsPerPage, setRowsPerPage] = useState<number>(10);
const [rowsPerPage, _] = useState<number>(10);
const [page, setPage] = useState<number>(1);

const [displayedNotices, setDisplayedNotices] = useState<Array<Notice>>([]);
Expand Down
3 changes: 1 addition & 2 deletions web/src/pages/admin/games/[id]/submissions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
Divider,
Group,
Stack,
ThemeIcon,
Text,
Table,
Pagination,
Expand All @@ -34,7 +33,7 @@ function Page() {
const [submissions, setSubmissions] = useState<Array<Submission>>([]);

const [total, setTotal] = useState<number>(0);
const [rowsPerPage, setRowsPerPage] = useState<number>(10);
const [rowsPerPage, _] = useState<number>(10);
const [page, setPage] = useState<number>(1);

const [loading, setLoading] = useState<boolean>(false);
Expand Down
7 changes: 1 addition & 6 deletions web/src/pages/admin/games/[id]/teams.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,16 @@ import GameTeamCreateModal from "@/components/modals/admin/GameTeamCreateModal";
import MDIcon from "@/components/ui/MDIcon";
import { Game } from "@/types/game";
import { GameTeam } from "@/types/game_team";
import { Team } from "@/types/team";
import { showSuccessNotification } from "@/utils/notification";
import {
ActionIcon,
Divider,
Flex,
Group,
Stack,
ThemeIcon,
Tooltip,
Text,
Accordion,
Center,
Avatar,
Box,
Badge,
Switch,
Pagination,
Expand All @@ -39,7 +34,7 @@ function Page() {
const [game, setGame] = useState<Game>();
const [refresh, setRefresh] = useState<number>(0);
const [gameTeams, setGameTeams] = useState<Array<GameTeam>>([]);
const [rowsPerPage, setRowsPerPage] = useState<number>(10);
const [rowsPerPage, _] = useState<number>(10);
const [page, setPage] = useState<number>(1);

const [displayedGameTeams, setDisplayedGameTeams] = useState<
Expand Down
6 changes: 2 additions & 4 deletions web/src/pages/admin/games/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ import {
} from "@/utils/notification";
import {
ActionIcon,
Avatar,
BackgroundImage,
Image,
Divider,
Flex,
Group,
Pagination,
Expand All @@ -25,6 +21,8 @@ import {
Badge,
Switch,
Tooltip,
Image,
Divider,
} from "@mantine/core";
import { useDisclosure } from "@mantine/hooks";
import { modals } from "@mantine/modals";
Expand Down
3 changes: 1 addition & 2 deletions web/src/pages/admin/users/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
Table,
Text,
TextInput,
ThemeIcon,
} from "@mantine/core";
import { useDisclosure } from "@mantine/hooks";
import { modals } from "@mantine/modals";
Expand Down Expand Up @@ -69,7 +68,7 @@ export default function Page() {
.deleteUser({
id: Number(user?.id),
})
.then((res) => {
.then((_) => {
showSuccessNotification({
message: `用户 ${user?.nickname} 已被删除`,
});
Expand Down
1 change: 0 additions & 1 deletion web/src/pages/games/[id]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
Stack,
Group,
Badge,
ThemeIcon,
Progress,
Button,
} from "@mantine/core";
Expand Down
2 changes: 0 additions & 2 deletions web/src/pages/games/[id]/scoreboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ import { useSubmissionApi } from "@/api/submission";
import { Game } from "@/types/game";
import { Submission } from "@/types/submission";
import {
Box,
Flex,
Stack,
useMantineColorScheme,
useMantineTheme,
Text,
Button,
Group,
LoadingOverlay,
Table,
Expand Down
1 change: 0 additions & 1 deletion web/src/pages/games/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import GameCard from "@/components/widgets/GameCard";
import { useConfigStore } from "@/stores/config";
import { Game } from "@/types/game";
import {
Box,
Button,
Flex,
Pagination,
Expand Down
2 changes: 0 additions & 2 deletions web/src/pages/profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ import {
Center,
Divider,
Flex,
Select,
Stack,
Text,
TextInput,
ThemeIcon,
Image,
} from "@mantine/core";
import { Dropzone } from "@mantine/dropzone";
Expand Down
8 changes: 1 addition & 7 deletions web/src/utils/axios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@ import axios from "axios";
import { useAuthStore } from "@/stores/auth";
import { useMemo } from "react";
import { useNavigate } from "react-router";
import { showNotification } from "@mantine/notifications";
import {
showErrNotification,
showInfoNotification,
showSuccessNotification,
showWarnNotification,
} from "./notification";
import { showInfoNotification } from "./notification";

export const useApi = () => {
return useMemo(() => {
Expand Down

0 comments on commit 58a78d4

Please sign in to comment.