- Welcome to OJ LAB!
+ {t("Welcome to OJ LAB!")}
@@ -32,7 +37,7 @@ const Login: React.FC = () => {
{loginMode === "oauth" ? (
) : (
<>
@@ -40,7 +45,7 @@ const Login: React.FC = () => {
setAccount(e.target.value)}
/>
@@ -48,7 +53,7 @@ const Login: React.FC = () => {
setPassword(e.target.value)}
autoComplete="current-password"
/>
@@ -67,13 +72,38 @@ const Login: React.FC = () => {
className="btn btn-neutral btn-active btn-sm btn-block"
type="submit"
onClick={() => {
- postPasswordLogin(account, password).then((res) => {
- console.log(res);
- window.location.href = import.meta.env.BASE_URL;
- });
+ if (!account) {
+ dispatch({
+ type: AddMessageSagaPattern,
+ payload: {
+ id: "login-error",
+ content: `${t("Please input your account")}`,
+ duration: 3000,
+ level: "warning",
+ },
+ });
+ return;
+ }
+ postPasswordLogin(account, password)
+ .then((res) => {
+ console.log(res);
+ window.location.href = import.meta.env.BASE_URL;
+ })
+ .catch((err) => {
+ dispatch({
+ type: AddMessageSagaPattern,
+ payload: {
+ id: "login-error",
+ content: `${t("Failed login with password")}`,
+ duration: 3000,
+ level: "error",
+ err: err.toString(),
+ },
+ });
+ });
}}
>
- Login
+ {t("Login")}
>
)}
@@ -95,11 +125,10 @@ const Login: React.FC = () => {
- Password Login
-
+ {t("Password Login")}
+ {" "}
- {" "}
- (Internal)
+ {`(${t("Internal")})`}
>
@@ -107,7 +136,7 @@ const Login: React.FC = () => {
<>
- OAuth Login
+ {t("OAuth Login")}
>
)}
diff --git a/src/pages/RankList.tsx b/src/pages/RankList.tsx
index 8bab78303..1337283eb 100644
--- a/src/pages/RankList.tsx
+++ b/src/pages/RankList.tsx
@@ -1,14 +1,23 @@
import RankTable from "@/components/display/RankTable";
import { useRankList } from "@/hooks/rank";
+import { useTranslation } from "react-i18next";
const RankList: React.FC = () => {
+ const { t } = useTranslation();
const { getRankList } = useRankList();
const rankList = getRankList();
return (
-
-
-
+
+
+
+ {t(
+ "Once you passed the problem, the submission after will not be counted.",
+ )}
+
+
+
diff --git a/src/pages/admin/ProblemList.tsx b/src/pages/admin/ProblemList.tsx
index f14e410bd..b1016d2e2 100644
--- a/src/pages/admin/ProblemList.tsx
+++ b/src/pages/admin/ProblemList.tsx
@@ -29,7 +29,7 @@ const ProblemList: React.FC = () => {
return (
-
+
{
setSearchingTitle(t);
diff --git a/src/pages/admin/UserList.tsx b/src/pages/admin/UserList.tsx
index 99cd75bcb..bbf598133 100644
--- a/src/pages/admin/UserList.tsx
+++ b/src/pages/admin/UserList.tsx
@@ -14,8 +14,7 @@ const UserList: React.FC = () => {
useEffect(() => {
setPagenation(countPerPage, page * countPerPage);
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, [countPerPage, page]);
+ }, [countPerPage, page, setPagenation]);
return (
diff --git a/src/pages/judge/JudgeList.tsx b/src/pages/judge/JudgeList.tsx
index 018dc8361..5ff679b15 100644
--- a/src/pages/judge/JudgeList.tsx
+++ b/src/pages/judge/JudgeList.tsx
@@ -7,8 +7,14 @@ import React, { useEffect } from "react";
const countPerPageSelections = [10, 25, 50];
const JudgeList: React.FC = () => {
- const { getJudgeList, refreshJudgeList, getPageCount, setPagenation } =
- useJudgeList();
+ const {
+ getJudgeList,
+ refreshJudgeList,
+ getPageCount,
+ setPagenation,
+ getSelfOnly,
+ setSelfOnly,
+ } = useJudgeList();
const { t } = useTranslation();
// useEvent();
const refreshSeconds = 5;
@@ -33,15 +39,26 @@ const JudgeList: React.FC = () => {
useEffect(() => {
setPagenation(countPerPage, page * countPerPage);
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, [countPerPage, page]);
+ }, [countPerPage, page, setPagenation]);
return (
-
+
+
+
+ {t(
+ "If you finish more than 10 problems, an additional badge will be given.",
+ )}
+
+
+
{
+ runJudge((judgeInfo) => {
+ dispatch({
+ type: AddMessageSagaPattern,
+ payload: {
+ id: `judge-submitted-${judgeInfo.UID}`,
+ content:
+ t("Judge") + " " + judgeInfo.UID + " " + t("submitted"),
+ duration: 3000,
+ level: "success",
+ },
+ });
+ });
+ }}
+ />
);
};
diff --git a/src/pages/problem/ProblemList.tsx b/src/pages/problem/ProblemList.tsx
index a3f79d81e..1cf9bd009 100644
--- a/src/pages/problem/ProblemList.tsx
+++ b/src/pages/problem/ProblemList.tsx
@@ -5,17 +5,14 @@ import Pagination from "@/components/control/Pagination";
import ProblemSearch, {
DifficultySelection,
} from "@/components/control/ProblemSearch";
+import { useTranslation } from "react-i18next";
const countPerPageSelections = [10, 25, 50];
const ProblemList: React.FC = () => {
- const {
- getProblemInfoList,
- getPageCount,
- setPagenation,
- setSearch,
- refreshProblemInfoList,
- } = useProblemInfoList();
+ const { t } = useTranslation();
+ const { getProblemInfoList, getPageCount, setPagenation, setSearch } =
+ useProblemInfoList();
const [countPerPage, setCountPerPage] = React.useState(
countPerPageSelections[0],
);
@@ -29,9 +26,19 @@ const ProblemList: React.FC = () => {
}, [countPerPage, page, setPagenation]);
return (
-
-
-
+
+
+
+ {t("Select a problem to view the details and submit your solution.")}
+
+
+ {t(
+ "We will give you badges for your achievements in later version of OJ LAB.",
+ )}
+
+
+
+
{
setSearchingTitle(t);
@@ -41,7 +48,7 @@ const ProblemList: React.FC = () => {
}}
onSearch={() => {
setSearch(searchingTitle, searchingDifficulty);
- refreshProblemInfoList();
+ setPage(0); // Set page will trigger useEffect to refresh the list
}}
title={searchingTitle}
difficulty={searchingDifficulty}