diff --git a/app/css/judge.module.css b/app/css/judge.module.css index 5284ba7..abfbdb3 100644 --- a/app/css/judge.module.css +++ b/app/css/judge.module.css @@ -17,3 +17,39 @@ .error { color: #834ba9; } + +.file-rows { + display: flex; + flex-direction: column; + width: 100%; + gap: 2px; +} + +.file-row { + display: flex; + height: 20px; + width: 100%; + justify-content: space-between; + align-items: center; +} + +.file-name { + font-size: 20px; +} + +.icon-area { + display: flex; + gap: 4px; + align-items: center; +} + +.icon { + width: 30px; + height: 30px; + cursor: pointer; +} + +.icon img { + width: 100%; + height: 100%; +} diff --git a/app/routes/_procted+/students+/$lectureId+/$labId+/history+/SubmissionDetailModal.tsx b/app/routes/_procted+/students+/$lectureId+/$labId+/history+/SubmissionDetailModal.tsx index 14c899c..80deb27 100644 --- a/app/routes/_procted+/students+/$lectureId+/$labId+/history+/SubmissionDetailModal.tsx +++ b/app/routes/_procted+/students+/$lectureId+/$labId+/history+/SubmissionDetailModal.tsx @@ -2,12 +2,16 @@ import { useEffect, useState } from "react"; import { getSubmissionWithSubmissionId } from "~/API/submission"; import Modal from "~/components/Modal"; import styles from "./index.module.css"; +import judgeStyles from "~/css/judge.module.css"; import { useAuth } from "~/contexts/AuthContext"; import CodeBlock from "~/components/CodeBlock"; import TextInput from "~/components/Input/TextInput"; import TextArea from "~/components/Input/TextArea"; import { bytesToSize } from "~/util"; import toast from "react-hot-toast"; +import download from "~/assets/download.svg"; +import pkg from "file-saver"; +const { saveAs } = pkg; interface Props { isOpen: boolean; @@ -172,6 +176,93 @@ const SubmissionDetailModal = ({ isOpen, onClose, submissionId }: Props) => { name="" defaultValue={result.exit_code} /> + {result.file_inputs && ( +
+

파일 입력

+
+ {result.file_inputs!.map( + (file: { name: string; content: string }) => ( +
{ + saveAs( + new File([file.content], file.name), + file.name + ); + }} + > + + {file.name} + +
+
+ download icon +
+
+
+ ) + )} +
+
+ )} + {result.file_outputs && ( +
+

내 파일 출력

+
+ {result.file_outputs!.map( + (file: { name: string; content: string }) => ( +
{ + saveAs( + new File([file.content], file.name), + file.name + ); + }} + > + + {file.name} + +
+
+ download icon +
+
+
+ ) + )} +
+
+ )} + {result.judge_file_outputs && ( +
+

저지 파일 출력

+
+ {result.judge_file_outputs!.map( + (file: { name: string; content: string }) => ( +
{ + saveAs( + new File([file.content], file.name), + file.name + ); + }} + > + + {file.name} + +
+
+ download icon +
+
+
+ ) + )} +
+
+ )} {result.message && (