From 8505dccd970b78d57b043f7bb766307b6a7fe5f9 Mon Sep 17 00:00:00 2001 From: slhmy <1484836413@qq.com> Date: Tue, 30 Jan 2024 14:24:41 +0000 Subject: [PATCH] Migration to daisyUI --- src/components/Copyright.tsx | 24 --------- src/components/Footer.tsx | 13 ----- src/components/JudgeVerdictTable.tsx | 59 ++++++++++----------- src/components/ProblemTable.tsx | 3 +- src/pages/admin-dashboard/CreateProblem.tsx | 59 +++++++++++++-------- 5 files changed, 67 insertions(+), 91 deletions(-) delete mode 100644 src/components/Copyright.tsx delete mode 100644 src/components/Footer.tsx diff --git a/src/components/Copyright.tsx b/src/components/Copyright.tsx deleted file mode 100644 index 2c302cf65..000000000 --- a/src/components/Copyright.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import React from "react"; -import Link from "@mui/material/Link"; -import Typography from "@mui/material/Typography"; - -interface Props { - sx?: any; -} - -const Copyright: React.FC = (props) => { - return ( - - {"Copyright © "} - Online Judge Lab {new Date().getFullYear()} - {"."} - - ); -}; - -export default Copyright; diff --git a/src/components/Footer.tsx b/src/components/Footer.tsx deleted file mode 100644 index 64c07df16..000000000 --- a/src/components/Footer.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import React from "react"; -import Container from "@mui/material/Container"; -import Copyright from "./Copyright"; - -const Footer: React.FC = () => { - return ( - - - - ); -}; - -export default Footer; diff --git a/src/components/JudgeVerdictTable.tsx b/src/components/JudgeVerdictTable.tsx index 92f2cc8f7..ed94b4cb9 100644 --- a/src/components/JudgeVerdictTable.tsx +++ b/src/components/JudgeVerdictTable.tsx @@ -1,12 +1,3 @@ -import { - Table, - TableBody, - TableColumn, - TableHeader, - TableRow, - TableCell, - Chip, -} from "@nextui-org/react"; import { JudgeModel } from "../typings/judge"; const columns = [ @@ -17,31 +8,39 @@ const columns = [ export interface JudgeVerdictTableProps { data: JudgeModel.JudgeVerdict[]; + className?: string; } const JudgeVerdictTable: React.FC = (props) => { return ( - - - {(column) => {column.name}} - - - {(item) => ( - - - - {item.verdict} - - - {item.time_usage} - {item.memory_usage} - - )} - -
+
+ + + + {columns.map((column) => ( + + ))} + + + + {props.data.map((judgeVerdict) => ( + + + + + + ))} + +
{column.name}
+
+ {judgeVerdict.verdict} +
+
{judgeVerdict.time_usage}{judgeVerdict.memory_usage}
+
); }; diff --git a/src/components/ProblemTable.tsx b/src/components/ProblemTable.tsx index c48e4eccb..99e2637aa 100644 --- a/src/components/ProblemTable.tsx +++ b/src/components/ProblemTable.tsx @@ -2,7 +2,6 @@ import { TrashIcon, PencilSquareIcon } from "@heroicons/react/24/outline"; import { ProblemServiceModel } from "../typings/problem"; import React from "react"; import { useNavigate } from "react-router-dom"; -import { joinClasses } from "../utils/common"; const columns = [ { name: "SLUG", uid: "slug" }, @@ -23,7 +22,7 @@ const ProblemTable: React.FC = (props) => { return (
- +
{columns.map((column) => { diff --git a/src/pages/admin-dashboard/CreateProblem.tsx b/src/pages/admin-dashboard/CreateProblem.tsx index 2debd0772..8f26de690 100644 --- a/src/pages/admin-dashboard/CreateProblem.tsx +++ b/src/pages/admin-dashboard/CreateProblem.tsx @@ -61,15 +61,16 @@ const CreateProblem: React.FC = () => {

{t("Create Problem")}

- - + +
@@ -93,7 +94,7 @@ const CreateProblem: React.FC = () => { /> {slug && slug !== "slug" && (
- +

{t("Checking slug is valid...")}

)} @@ -107,8 +108,8 @@ const CreateProblem: React.FC = () => {
)} - - + +
{ setTitle(e.target.value); }} /> - - +
+ +