From 7a4d6f936e4730e23531736553a6bdc8bfb8baa4 Mon Sep 17 00:00:00 2001 From: jhynsoo Date: Tue, 13 Aug 2024 13:58:29 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=ED=80=B4=EC=A6=88=20=EC=88=98=EC=A0=95?= =?UTF-8?q?=20=ED=8F=BC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/LectureForm/LectureForm.jsx | 2 +- .../LectureForm/LectureForm.module.css | 7 ++++++ .../LectureHeader/LectureHeader.jsx | 11 --------- .../LectureHeader/LectureHeader.module.css | 12 ---------- frontend/src/components/QuizForm/QuizCard.jsx | 24 ++++++++++++------- frontend/src/pages/LivePage/LivePage.jsx | 7 +++++- .../StudentReportDetailPage.jsx | 1 - 7 files changed, 30 insertions(+), 34 deletions(-) diff --git a/frontend/src/components/LectureForm/LectureForm.jsx b/frontend/src/components/LectureForm/LectureForm.jsx index 09ef32c..aa88d59 100644 --- a/frontend/src/components/LectureForm/LectureForm.jsx +++ b/frontend/src/components/LectureForm/LectureForm.jsx @@ -58,7 +58,6 @@ export default function LectureForm({ title, topic, to = '..', initialValues = { endDate: new Date(endDate).toISOString(), time: time, }; - console.log(lectureObject); const formData = new FormData(); formData.append('lectureCreateRequest', new Blob([JSON.stringify(lectureObject)], { type: 'application/json' })); @@ -161,6 +160,7 @@ export default function LectureForm({ title, topic, to = '..', initialValues = { {onCreate && (
+ {title}
- {tutorImg ? ( - 강사 사진 - ) : ( -
- -
- )}
{tutor}
diff --git a/frontend/src/components/LectureHeader/LectureHeader.module.css b/frontend/src/components/LectureHeader/LectureHeader.module.css index e98c683..b43fbb2 100644 --- a/frontend/src/components/LectureHeader/LectureHeader.module.css +++ b/frontend/src/components/LectureHeader/LectureHeader.module.css @@ -58,18 +58,6 @@ align-items: center; } -.tutorImg { - display: flex; - justify-content: center; - align-items: center; - width: 48px; - height: 48px; - border-radius: 50%; - object-fit: cover; - stroke: var(--text-color-secondary); - border: 1px solid var(--border-color); -} - @keyframes glow { 0% { box-shadow: 0 0 0 0 var(--error-color); diff --git a/frontend/src/components/QuizForm/QuizCard.jsx b/frontend/src/components/QuizForm/QuizCard.jsx index b734fc2..ab409f5 100644 --- a/frontend/src/components/QuizForm/QuizCard.jsx +++ b/frontend/src/components/QuizForm/QuizCard.jsx @@ -1,4 +1,4 @@ -import { useEffect, useState } from 'react'; +import { useState } from 'react'; import styles from './QuizCard.module.css'; import CloseIcon from '/src/assets/icons/close.svg?react'; import PlusIcon from '/src/assets/icons/plus.svg?react'; @@ -6,12 +6,24 @@ import { Toggle } from '../Toggle'; import { STATIC_URL } from '../../constants'; export default function QuizCard({ quiz, updateQuiz, deleteQuiz }) { + const isChoice = quiz.choices.length > 0; const [question, setQuestion] = useState(quiz.question || ''); - const [answer, setAnswer] = useState(Number(quiz.answer) || ''); + const [answer, setAnswer] = useState(isChoice ? Number(quiz.answer) || 1 : quiz.answer || ''); const [choices, setChoices] = useState(quiz.choices || [{ num: 1, content: '' }]); const [image, setImage] = useState(quiz.image || null); const [imagePreview, setImagePreview] = useState(quiz.image ? `${STATIC_URL}${quiz.image}` : null); - const [quizType, setQuizType] = useState('단답식'); + const [quizType, setQuizType] = useState(isChoice ? '객관식' : '단답식'); + + const handleToggle = (type) => { + setQuizType(type); + if (type === '단답식') { + setAnswer(''); + setChoices([]); + return; + } + setAnswer(1); + setChoices([{ num: 1, content: '' }]); + }; const clearImage = () => { setImage(null); @@ -75,10 +87,6 @@ export default function QuizCard({ quiz, updateQuiz, deleteQuiz }) { updateQuiz(quiz.id, { ...quiz, question, answer: choiceContent, choices, image }); }; - useEffect(() => { - quizType === '단답식' ? setAnswer('') : setAnswer(1); - }, [quizType]); - return (
@@ -131,7 +139,7 @@ export default function QuizCard({ quiz, updateQuiz, deleteQuiz }) {
{ alert('방에 입장할 수 없습니다.'); window.close(); + setTimeout(() => { + window.location.href = '/'; + }, 100); }); return data.token; @@ -37,7 +40,9 @@ export default function LivePage() { .post(`${API_URL}/video/deleteroom/${roomId}`) .catch(() => {}) .finally(() => { - window.close(); + setTimeout(() => { + window.close(); + }, 200); }); }} > diff --git a/frontend/src/pages/StudentReportDetailPage/StudentReportDetailPage.jsx b/frontend/src/pages/StudentReportDetailPage/StudentReportDetailPage.jsx index 3425bd3..97e825a 100644 --- a/frontend/src/pages/StudentReportDetailPage/StudentReportDetailPage.jsx +++ b/frontend/src/pages/StudentReportDetailPage/StudentReportDetailPage.jsx @@ -12,7 +12,6 @@ export default function StudentReportDetailPage() { const { allCount, correctCount, quizzes, title } = report; const score = Math.round((100 * correctCount) / allCount); const userType = useBoundStore((state) => state.userType); - console.log(userType); return (