diff --git a/frontend/src/components/forms/projectFormTabs/DockerFormTab.tsx b/frontend/src/components/forms/projectFormTabs/DockerFormTab.tsx index 77fe216b..f148e778 100644 --- a/frontend/src/components/forms/projectFormTabs/DockerFormTab.tsx +++ b/frontend/src/components/forms/projectFormTabs/DockerFormTab.tsx @@ -109,8 +109,8 @@ const DockerFormTab: FC<{ form: FormInstance }> = ({ form }) => { if (withTemplate) { switchClassName += ' template-switch-active' - scriptPlaceholder = "bash /shared/input/helloworld.sh > \"/shared/output/helloWorldTest\n"+ - "bash /shared/input/helloug.sh > \"/shared/output/helloUGent\n" + scriptPlaceholder = "bash /shared/input/helloworld.sh > \"/shared/output/helloWorldTest\"\n"+ + "bash /shared/input/helloug.sh > \"/shared/output/helloUGent\"\n" } else { switchClassName += ' template-switch-inactive' scriptPlaceholder = "output=$(bash /shared/input/helloworld.sh)\n"+ diff --git a/frontend/src/pages/project/components/SubmissionsTable.tsx b/frontend/src/pages/project/components/SubmissionsTable.tsx index f74a21f8..fc321c74 100644 --- a/frontend/src/pages/project/components/SubmissionsTable.tsx +++ b/frontend/src/pages/project/components/SubmissionsTable.tsx @@ -1,4 +1,4 @@ -import { Button, Input, List, Table, Tooltip, Typography } from "antd"; +import { Button, Input, List, Space, Table, Tooltip, Typography } from "antd"; import { FC, useMemo, useState } from "react"; import { ProjectSubmissionsType } from "./SubmissionsTab"; import { TableProps } from "antd/lib"; @@ -27,7 +27,8 @@ const SubmissionsTable: FC<{ submissions: ProjectSubmissionsType[] | null; onCha const { message } = useAppApi(); const API = useApi(); const [editingFeedback, setEditingFeedback] = useState<{ [key: number]: string }>({}); - const [isEditing, setIsEditing] = useState<{ [key: number]: boolean }>({}); + const [isEditingFeedback, setIsEditingFeedback] = useState<{ [key: number]: boolean }>({}); + const [oldFeedback, setOldFeedback] = useState<{ [key: number]: string }>({}); const updateTable = async (groupId: number, feedback: Omit, usePost: boolean) => { if (!projectId || submissions === null || !groupId) return console.error("No projectId or submissions or groupId found"); @@ -85,8 +86,8 @@ const SubmissionsTable: FC<{ submissions: ProjectSubmissionsType[] | null; onCha delete newState[groupId]; return newState; }); - setIsEditing((prev) => ({ ...prev, [groupId]: false })); } + setIsEditingFeedback((prev) => ({ ...prev, [groupId]: false })); }; const downloadFile = async (route: ApiRoutes.SUBMISSION_FILE | ApiRoutes.SUBMISSION_ARTIFACT, filename: string) => { @@ -120,9 +121,13 @@ const SubmissionsTable: FC<{ submissions: ProjectSubmissionsType[] | null; onCha }; const handleEditFeedback = (groupId: number) => { - setIsEditing((prev) => ({ ...prev, [groupId]: true })); + setIsEditingFeedback((prev) => { + setOldFeedback((prev) => ({ ...prev, [groupId]: editingFeedback[groupId] })); + return { ...prev, [groupId]: true } + }) }; + const columns: TableProps["columns"] = useMemo(() => { const cols: TableProps["columns"] = [ { @@ -173,7 +178,11 @@ const SubmissionsTable: FC<{ submissions: ProjectSubmissionsType[] | null; onCha render: (s: ProjectSubmissionsType) => ( updateScore(s, e), maxLength: 10 }} + editable={{ + onChange: (e) => updateScore(s, e), + maxLength: 10, + text: s.feedback?.score ? s.feedback?.score?.toString() : "", + }} > {s.feedback?.score ?? t("project.noScoreLabel")} @@ -208,7 +217,7 @@ const SubmissionsTable: FC<{ submissions: ProjectSubmissionsType[] | null; onCha {t("project.feedback")}:

- {isEditing[g.group.groupId] ? ( + {isEditingFeedback[g.group.groupId] ? ( <> + + - + + ) : ( <>