Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Grader</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Anuphan:wght@100..700&display=swap"
rel="stylesheet"
/>
<title>Grader</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
12 changes: 12 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
"styled-components": "^6.1.1",
"tailwind-merge": "^1.14.0",
"tailwindcss-animate": "^1.0.7",
"use-debounce": "^10.0.4",
"zod": "^3.22.4"
},
"devDependencies": {
Expand Down
73 changes: 28 additions & 45 deletions src/components/Cards/ProblemCards/MyProblemMiniCard2.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { FileSpreadsheet } from "lucide-react";
import { FileSpreadsheet, Pencil, X } from "lucide-react";
import { useState } from "react";
import {
ProblemModel,
ProblemPopulateTestcases
ProblemModel,
ProblemPopulateTestcases,
} from "../../../types/models/Problem.model";
import { onMiddleClickOpenInNewTab } from "../../../utilities/OnMiddleClickOpenInNewTab";
import MyProblemContextMenu from "../../ContextMenus/MyProblemContextMenu";
Expand All @@ -13,11 +13,15 @@ const MyProblemMiniCard2 = ({
disabled = false,
disabledHighlight = false,
onClick = () => {},
onClickPencilIcon,
onClickXIcon,
}: {
problem: ProblemPopulateTestcases | ProblemModel;
disabled?: boolean;
disabledHighlight?: boolean;
onClick?: () => void;
onClickPencilIcon?: () => void;
onClickXIcon?: () => void;
}) => {
const [highlightTitle, setHighlightTitle] = useState(false);

Expand Down Expand Up @@ -58,55 +62,34 @@ const MyProblemMiniCard2 = ({

// className={`pt-6 px-5 ${disabled ? "opacity-50" : }`}`}
>
<div className="flex items-center font-medium text-base ">
<div className="flex items-center font-medium text-base justify-between">
<div className="flex items-center w-4/12">
<FileSpreadsheet
size={20}
className="text-blue-400 mr-2"
/>

<p className="font-mono line-clamp-1 w-5/6">
{problem.title}
</p>
</div>
{/* <div className="font-medium flex items-center w-1/12">
<Tally4 className="text-green-400 mr-2" size={20} />
<div>{problem.testcases.length}</div>

<p className="font-mono line-clamp-1 w-5/6">
{problem.title}
</p>
</div>
<div className="flex items-center w-3/12">
<CheckBadge
noIcon
checked={problem.solution !== ""}
>
SC
</CheckBadge>
<CheckBadge
className="mx-1"
noIcon
checked={problem.testcases.length > 0}
>
TC
</CheckBadge>
<CheckBadge
noIcon
checked={checkRuntimeStatus(problem.testcases)}
>
NRE
</CheckBadge>

<div className="flex gap-3">
{onClickPencilIcon && (
<Pencil
onClick={onClickPencilIcon}
className="text-neutral-600 hover:text-primary"
size={16}
/>
)}
{onClickXIcon && (
<X
onClick={onClickXIcon}
className="text-red-400 hover:text-red-700"
size={16}
/>
)}
</div>
<div className="font-medium">
{problem.allowed_languages
.split(",")
.map((lang, index) => {
if (index < 3) {
return ProgrammingLanguageOptions.find(
(option) => option.value === lang
)?.badge;
} else if (index === 3) {
return <span>...</span>;
}
})}
</div> */}
</div>
</Card>
</MyProblemContextMenu>
Expand Down
2 changes: 1 addition & 1 deletion src/components/ContextMenus/MyProblemContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const MyProblemContextMenu = ({
problem.problem_id
);

let createRequest = transformProblemPopulateAccountAndTestcasesAndProblemGroupPermissionsPopulateGroupModel2CreateProblemRequestForm(
const createRequest = transformProblemPopulateAccountAndTestcasesAndProblemGroupPermissionsPopulateGroupModel2CreateProblemRequestForm(
response.data
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import { Separator } from "../shadcn/Seperator";
const ProblemSubmissionSourceCodeAndRuntimeResultDialog = ({
submission,
children,
problem
problem,
}: {
submission: SubmissionPopulateSubmissionTestcaseAndAccountModel;
children?: React.ReactNode;
problem: ProblemPopulateAccountAndTestcasesAndProblemGroupPermissionsPopulateGroupModel
problem: ProblemPopulateAccountAndTestcasesAndProblemGroupPermissionsPopulateGroupModel;
}) => {
const [sourceCode, setSourceCode] = React.useState<string>(
submission.submission_code
Expand Down Expand Up @@ -44,10 +44,13 @@ const ProblemSubmissionSourceCodeAndRuntimeResultDialog = ({
<div className="w-1/2">
<ScrollArea className=" h-[60vh] pr-5">
<TestcaseValidationAccordian
runtimeResults={submission.runtime_output.map((output,index) => ({
...output,
input: problem.testcases[index]?.input
}))}
problem={problem}
runtimeResults={submission.runtime_output.map(
(output, index) => ({
...output,
input: problem.testcases[index]?.input,
})
)}
/>
</ScrollArea>
</div>
Expand Down
38 changes: 22 additions & 16 deletions src/components/Dropdowns/MyProblemDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ import React, { useState } from "react";
import { useNavigate } from "react-router-dom";
import { ProblemService } from "../../services/Problem.service";
import { transformCreateProblemRequestForm2CreateProblemRequest } from "../../types/adapters/CreateProblemRequestForm.adapter";
import { transformProblemPopulateAccountAndTestcasesAndProblemGroupPermissionsPopulateGroupModel2CreateProblemRequestForm } from "../../types/adapters/Problem.adapter";
import {
ProblemModel,
ProblemPopulateTestcases,
ProblemSecureModel,
ProblemModel,
ProblemPopulateTestcases,
ProblemSecureModel,
} from "../../types/models/Problem.model";
import DeleteProblemConfirmationDialog from "../Dialogs/DeleteProblemConfirmationDialog";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuSeparator,
DropdownMenuTrigger,
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "../shadcn/DropdownMenu";
import { toast } from "../shadcn/UseToast";
import { transformProblemPopulateAccountAndTestcasesAndProblemGroupPermissionsPopulateGroupModel2CreateProblemRequestForm } from "../../types/adapters/Problem.adapter";

const MyProblemDropdown = ({
children,
Expand All @@ -36,11 +36,12 @@ const MyProblemDropdown = ({
problem.problem_id
);

let createRequest = transformProblemPopulateAccountAndTestcasesAndProblemGroupPermissionsPopulateGroupModel2CreateProblemRequestForm(
response.data
)
const createRequest =
transformProblemPopulateAccountAndTestcasesAndProblemGroupPermissionsPopulateGroupModel2CreateProblemRequestForm(
response.data
);

createRequest.title += " (Copy)"
createRequest.title += " (Copy)";

const { request, groups } =
transformCreateProblemRequestForm2CreateProblemRequest(
Expand All @@ -60,7 +61,10 @@ const MyProblemDropdown = ({
toast({
title: `Cloned ${response.data.title}`,
});
window.open(`/my/problems/${response.data.problem_id}`, "_blank");
window.open(
`/my/problems/${response.data.problem_id}`,
"_blank"
);
});
};

Expand Down Expand Up @@ -88,9 +92,11 @@ const MyProblemDropdown = ({
</DropdownMenuItem>
<DropdownMenuItem
onClick={() =>
window.open(`/my/problems/${problem.problem_id}/edit`, "_blank")
window.open(
`/my/problems/${problem.problem_id}/edit`,
"_blank"
)
}

>
<PencilIcon className="mr-2" size={16} />
Edit Problem
Expand Down
Loading