From 2975c89f5964a3fac62fd9d42b6336eb7c48585d Mon Sep 17 00:00:00 2001 From: KanonKC Date: Tue, 5 Nov 2024 17:07:15 +0700 Subject: [PATCH 1/3] Hide difficulty, improve allow languages display --- .../Tables/ProblemTables/MyProblemsTable.tsx | 67 ++++++------------- src/components/shadcn/Badge.tsx | 6 +- 2 files changed, 24 insertions(+), 49 deletions(-) diff --git a/src/components/Tables/ProblemTables/MyProblemsTable.tsx b/src/components/Tables/ProblemTables/MyProblemsTable.tsx index 8e2db36..862ecf9 100644 --- a/src/components/Tables/ProblemTables/MyProblemsTable.tsx +++ b/src/components/Tables/ProblemTables/MyProblemsTable.tsx @@ -1,12 +1,12 @@ import { ColumnDef } from "@tanstack/react-table"; import { - Check, - FileSpreadsheet, - MoreHorizontal, - Tally4, - Tally5, - Timer, - X + Check, + FileSpreadsheet, + MoreHorizontal, + Tally4, + Tally5, + Timer, + X } from "lucide-react"; import { Link } from "react-router-dom"; import { ProgrammingLanguageOptions } from "../../../constants/ProgrammingLanguage"; @@ -16,7 +16,6 @@ import { readableDateFormat } from "../../../utilities/ReadableDateFormat"; import MyProblemDropdown from "../../Dropdowns/MyProblemDropdown"; import { DataTable } from "../Prototype/DataTable"; import DataTableSortableLayout from "../Prototype/DataTableSortableLayout"; -import DifficultyBadge from "../../DifficultyBadge"; const columns: ColumnDef[] = [ { @@ -74,30 +73,6 @@ const columns: ColumnDef[] = [ ), }, - - // { - // accessorKey: "status", - // header: "Status", - // cell: ({ row }) => { - // return ( - //
- // - // Source Code - // - // - // 0}> - // Testcases - // - // - // - // No Runtime Error - // - //
- // ); - // }, - // }, { accessorKey: "source_code", header: () =>
@@ -145,9 +120,9 @@ const columns: ColumnDef[] = [ { accessorKey: "allowed_languages", - header: "Allowed Languages", + header: () =>
Allowed Languages
, cell: ({ row }) => ( -
+
{row.original.allowed_languages.split(",").map((lang) => ( { @@ -160,19 +135,19 @@ const columns: ColumnDef[] = [
), }, + // Temporary hide this column + // { + // accessorKey: "difficulty", + // header: ({ column }) => ( + // column.toggleSorting(column.getIsSorted() === "asc")}> + // Difficulty + // - { - accessorKey: "difficulty", - header: ({ column }) => ( - column.toggleSorting(column.getIsSorted() === "asc")}> - Difficulty - - - ), - cell: ({ row }) => ( - - ), - }, + // ), + // cell: ({ row }) => ( + // + // ), + // }, { accessorKey: "updated_date", diff --git a/src/components/shadcn/Badge.tsx b/src/components/shadcn/Badge.tsx index a448338..953d124 100644 --- a/src/components/shadcn/Badge.tsx +++ b/src/components/shadcn/Badge.tsx @@ -9,11 +9,11 @@ const badgeVariants = cva( variants: { variant: { default: - "border-transparent bg-primary text-primary-foreground hover:bg-primary/80", + "border-transparent bg-primary text-primary-foreground cursor-default", // hover:bg-primary/80", secondary: - "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80", + "border-transparent bg-secondary text-secondary-foreground", // hover:bg-secondary/80", destructive: - "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80", + "border-transparent bg-destructive text-destructive-foreground", // hover:bg-destructive/80", outline: "text-foreground", }, }, From 9217b47dc720a7a3b08923df7ddc73cb63d2f048 Mon Sep 17 00:00:00 2001 From: KanonKC Date: Tue, 5 Nov 2024 17:27:28 +0700 Subject: [PATCH 2/3] Remove realtime submission load --- src/views/My/Problems/ProblemStatistic.tsx | 43 +--------------------- 1 file changed, 1 insertion(+), 42 deletions(-) diff --git a/src/views/My/Problems/ProblemStatistic.tsx b/src/views/My/Problems/ProblemStatistic.tsx index a95e29c..31aff69 100644 --- a/src/views/My/Problems/ProblemStatistic.tsx +++ b/src/views/My/Problems/ProblemStatistic.tsx @@ -1,3 +1,4 @@ +import { Pencil } from "lucide-react"; import { useEffect, useState } from "react"; import { Link, useParams } from "react-router-dom"; import MyProblemSubmissionsTable from "../../../components/Tables/MyProblemSubmissionsTable"; @@ -7,16 +8,10 @@ import { SubmissionService } from "../../../services/Submission.service"; import { ProblemPopulateAccountAndTestcasesAndProblemGroupPermissionsPopulateGroupModel } from "../../../types/models/Problem.model"; import { SubmissionPopulateSubmissionTestcaseAndAccountModel } from "../../../types/models/Submission.model"; import { ProblemService } from "./../../../services/Problem.service"; -import { Pencil, RotateCw } from "lucide-react"; -import { Switch } from "../../../components/shadcn/Switch"; -import { Label } from "../../../components/shadcn/Label"; -import { cn } from "../../../lib/utils"; const ProblemStatistic = () => { const { problemId } = useParams(); const accountId = String(localStorage.getItem("account_id")); - const [loading, setLoading] = useState(false); - const [realtimeSubmission, setRealtimeSubmission] = useState(false); const [problem, setProblem] = useState(); @@ -25,7 +20,6 @@ const ProblemStatistic = () => { const loadSubmissions = () => { if (!problemId) return; - setLoading(true); ProblemService.get(accountId, problemId) .then((response) => { setProblem(response.data); @@ -36,16 +30,10 @@ const ProblemStatistic = () => { }) .then((response) => { setSubmissions(response.data.submissions); - setLoading(false); }); }; useEffect(loadSubmissions, [accountId, problemId]); - useEffect(() => { - if (realtimeSubmission) { - loadSubmissions(); - } - }) return ( @@ -53,35 +41,6 @@ const ProblemStatistic = () => {
{problem?.title}
-
- - {!realtimeSubmission ? ( - - ) : ( - - )} - - - setRealtimeSubmission(!realtimeSubmission) - } - /> -