diff --git a/app/components/CodeBlock/index.tsx b/app/components/CodeBlock/index.tsx index 95b0cfa..cdcd2e8 100644 --- a/app/components/CodeBlock/index.tsx +++ b/app/components/CodeBlock/index.tsx @@ -1,8 +1,8 @@ import Editor, { useMonaco } from "@monaco-editor/react"; -import { lanugage } from "~/types"; +import { language } from "~/types"; interface Props { - language: lanugage; + language: language; value: string; height: number | string; onChange: (arg: string) => void; diff --git a/app/routes/_procted+/lectures+/$lectureId+/$practiceId+/$labId/SubmitModal.tsx b/app/routes/_procted+/lectures+/$lectureId+/$practiceId+/$labId/SubmitModal.tsx index 0de738a..f135a20 100644 --- a/app/routes/_procted+/lectures+/$lectureId+/$practiceId+/$labId/SubmitModal.tsx +++ b/app/routes/_procted+/lectures+/$lectureId+/$practiceId+/$labId/SubmitModal.tsx @@ -6,7 +6,7 @@ import inputStyle from "~/components/Input/input.module.css"; import RadioGroup from "~/components/Radio/RadioGroup"; import CodeBlock from "~/components/CodeBlock"; import MultipleFileInput from "~/components/Input/MultipleFileInput"; -import { lanugage } from "~/types"; +import { language } from "~/types"; import { submit } from "~/API/submission"; import { useAuth } from "~/contexts/AuthContext"; import { useNavigate, useParams } from "@remix-run/react"; @@ -27,7 +27,7 @@ const SubmitModal = ({ isOpen, onClose }: Props) => { const navigate = useNavigate(); const [code, setCode] = useState(""); const [fileList, setFileList] = useState(null); - const [language, setLanguage] = useState("c"); + const [language, setLanguage] = useState("c"); const [entryPoint, setEntryPoint] = useState(""); const [isLoading, setIsLoading] = useState(true); const [problemDetail, setProblemDetail] = useState(); @@ -91,7 +91,7 @@ const SubmitModal = ({ isOpen, onClose }: Props) => { ) : (
{ e.preventDefault(); const formData = new FormData(e.currentTarget); @@ -108,64 +108,77 @@ const SubmitModal = ({ isOpen, onClose }: Props) => { ); }} > - void} - /> +
+ void} + defaultValue={problemDetail?.prepared_main?.language || undefined} + /> -
- {fileList && fileList.length > 1 ? ( - file.name)} - textList={[...fileList].map((file) => file.name)} - onChange={setEntryPoint as (value: string) => void} +
+ {fileList && fileList.length > 1 ? ( + file.name)} + textList={[...fileList].map((file) => file.name)} + onChange={setEntryPoint as (value: string) => void} + /> + ) : null} + { + setFileList(files); + }} /> - ) : null} - { - setFileList(files); - }} + {!fileList || fileList.length === 0 ? ( +
+ 코드로 작성하여 제출 + + {language === "c" ? ( + + void main()은 비표준 입니다.
+ 정상적인 채점 결과를 위해 int main을 사용해 주세요 +
+ ) : null} + {language === "java" ? ( + + Java에서 코드 작성 제출의 경우 엔트리 포인트 클래스 이름이 +
+ Main이어야 합니다 +
+ ) : null} +
+ ) : null} +
+ + +
+
+

주어진 Main 코드 : {problemDetail!.prepared_main.code.name}

+ null} + readOnly /> - {!fileList || fileList.length === 0 ? ( -
- 코드로 작성하여 제출 - - {language === "c" ? ( - - void main()은 비표준 입니다.
- 정상적인 채점 결과를 위해 int main을 사용해 주세요 -
- ) : null} - {language === "java" ? ( - - Java에서 코드 작성 제출의 경우 엔트리 포인트 클래스 이름이 -
- Main이어야 합니다 -
- ) : null} -
- ) : null}
- - )} diff --git a/app/routes/_procted+/lectures+/$lectureId+/$practiceId+/$labId/index.module.css b/app/routes/_procted+/lectures+/$lectureId+/$practiceId+/$labId/index.module.css index 72db3cf..a78e537 100644 --- a/app/routes/_procted+/lectures+/$lectureId+/$practiceId+/$labId/index.module.css +++ b/app/routes/_procted+/lectures+/$lectureId+/$practiceId+/$labId/index.module.css @@ -1,9 +1,16 @@ .wrapper { max-width: 100vw; } + +.modal-section { + display: flex; + gap: 50px; +} + .modal-body { display: flex; flex-direction: column; + align-items: center; gap: 16px; } diff --git a/app/routes/_procted+/lectures+/$lectureId+/_layout/ProblemAddModal.tsx b/app/routes/_procted+/lectures+/$lectureId+/_layout/ProblemAddModal.tsx index 8a956f3..8d29fa4 100644 --- a/app/routes/_procted+/lectures+/$lectureId+/_layout/ProblemAddModal.tsx +++ b/app/routes/_procted+/lectures+/$lectureId+/_layout/ProblemAddModal.tsx @@ -15,7 +15,7 @@ import { } from "~/API/problem"; import { useAuth } from "~/contexts/AuthContext"; import BlankPreviewModal from "./BlankPreviewModal"; -import { lanugage } from "~/types"; +import { language } from "~/types"; import { getCodeFileExtension, problemTitles, @@ -40,7 +40,7 @@ const ProblemAddModal = ({ const [problemType, setProblemType] = useState< "blank" | "solving" | "class_implementation" >("solving"); - const [language, setLanguage] = useState("c"); + const [language, setLanguage] = useState("c"); const [codeString, setCodeString] = useState(""); const [isPreviewModalOpen, setIsPreviewModalOpen] = useState(false); const auth = useAuth(); @@ -197,7 +197,7 @@ const ProblemAddModal = ({ setLanguage(e.target.value as lanugage)} + onChange={(e) => setLanguage(e.target.value as language)} > diff --git a/app/routes/_procted+/lectures+/$lectureId+/_layout/ProblemEditModal.tsx b/app/routes/_procted+/lectures+/$lectureId+/_layout/ProblemEditModal.tsx index 8ad6ca3..cd77c93 100644 --- a/app/routes/_procted+/lectures+/$lectureId+/_layout/ProblemEditModal.tsx +++ b/app/routes/_procted+/lectures+/$lectureId+/_layout/ProblemEditModal.tsx @@ -19,7 +19,7 @@ import CodeBlock from "~/components/CodeBlock"; import BlankPreviewModal from "./BlankPreviewModal"; import SingleFileInput from "~/components/Input/SingleFileInput"; import { uploadFile } from "~/API/media"; -import { lanugage } from "~/types"; +import { language } from "~/types"; import { STATIC_SERVER_URL } from "~/util/constant"; import { getCodeFileExtension, readFileAsServerFormat } from "~/util"; import download from "~/assets/download.svg"; @@ -38,7 +38,7 @@ const ProblemEditModal = ({ isOpen, onClose, editingProblemId }: Props) => { "blank" | "solving" | "class_implementation" >("solving"); const [prevProblemInfo, setPrevProblemInfo] = useState(); - const [language, setLanguage] = useState("c"); + const [language, setLanguage] = useState("c"); const [codeString, setCodeString] = useState(""); const [isPreviewModalOpen, setIsPreviewModalOpen] = useState(false); const [dragFile, setDragFile] = useState(null); @@ -247,7 +247,7 @@ const ProblemEditModal = ({ isOpen, onClose, editingProblemId }: Props) => { setLanguage(e.target.value as lanugage)} + onChange={(e) => setLanguage(e.target.value as language)} > diff --git a/app/types/APIResponse.ts b/app/types/APIResponse.ts index 6896e64..46a1339 100644 --- a/app/types/APIResponse.ts +++ b/app/types/APIResponse.ts @@ -1,5 +1,5 @@ import { codeHoles } from "~/util/codeHole"; -import { Lecture, ServerSideFile, judgeStatus, lanugage } from "."; +import { Lecture, ServerSideFile, judgeStatus, language } from "."; export interface UserEntity { id: string; @@ -103,7 +103,7 @@ export interface SimpleProblemDetail { parsed_code_elements: codeHoles; prepared_main: { code: ServerSideFile; - language: lanugage; + language: language; }; testcases: { id: number; @@ -164,7 +164,7 @@ export interface Submission { created_at: string; entrypoint: string; id: number; - language: lanugage; + language: language; message: string; progress: number; status: judgeStatus; diff --git a/app/types/index.d.ts b/app/types/index.d.ts index eaee44f..ae954e4 100644 --- a/app/types/index.d.ts +++ b/app/types/index.d.ts @@ -22,7 +22,7 @@ export interface studentRow { userName: string; } -export type lanugage = +export type language = | "plaintext" | "python" | "java" diff --git a/app/util/codeHole.ts b/app/util/codeHole.ts index de7d2d4..c295ae9 100644 --- a/app/util/codeHole.ts +++ b/app/util/codeHole.ts @@ -1,7 +1,7 @@ -import { lanugage } from "~/types"; +import { language } from "~/types"; export interface codeHoles { - language: lanugage; + language: language; data: parsedCodeElement[][]; } diff --git a/app/util/index.ts b/app/util/index.ts index ce69309..553b8da 100644 --- a/app/util/index.ts +++ b/app/util/index.ts @@ -1,5 +1,5 @@ import toast from "react-hot-toast"; -import { lanugage } from "~/types"; +import { language } from "~/types"; export function semesterToString(semester: number) { switch (semester) { @@ -141,7 +141,7 @@ export function readFileAsServerFormat( }); } -export function getCodeFileExtension(language: lanugage) { +export function getCodeFileExtension(language: language) { switch (language) { case "c": return "c";