diff --git a/frontend/src/components/QuizForm/QuizDetailCard.jsx b/frontend/src/components/QuizForm/QuizDetailCard.jsx index 7f0abdf..2f369f9 100644 --- a/frontend/src/components/QuizForm/QuizDetailCard.jsx +++ b/frontend/src/components/QuizForm/QuizDetailCard.jsx @@ -2,7 +2,8 @@ import styles from './QuizCard.module.css'; import { STATIC_URL } from '../../constants'; export default function QuizCard({ index, question, answer, image, choices }) { - console.log(question, answer, image, choices); + // TODO: 정답 / 오답 관련 표현 필요 시 추가 + console.log(choices); return (
@@ -20,28 +21,17 @@ export default function QuizCard({ index, question, answer, image, choices }) {
)} - +
{question}
- +
{answer}
+ {choices.length > 0 && } {choices.map?.((choice, idx) => (
- - + +
{choice.content}
))}
diff --git a/frontend/src/components/QuizForm/QuizDetailCard.module.css b/frontend/src/components/QuizForm/QuizDetailCard.module.css index 05cbd09..d7ec5ae 100644 --- a/frontend/src/components/QuizForm/QuizDetailCard.module.css +++ b/frontend/src/components/QuizForm/QuizDetailCard.module.css @@ -36,12 +36,9 @@ height: 220px; margin: 10px auto; border-radius: 8px; + object-fit: contain; background-color: var(--background-secondary); - cursor: pointer; -} - -.hiddenInput { - display: none; + border: 1px solid var(--background-secondary); } .input { @@ -62,6 +59,12 @@ gap: 8px; } +.numLabel { + width: 40px; + text-align: right; + display: block; +} + .choiceInput { flex-grow: 1; padding: 7px; diff --git a/frontend/src/components/QuizsetDetail/QuizsetDetail.jsx b/frontend/src/components/QuizsetDetail/QuizsetDetail.jsx index a244dd5..b1a3c14 100644 --- a/frontend/src/components/QuizsetDetail/QuizsetDetail.jsx +++ b/frontend/src/components/QuizsetDetail/QuizsetDetail.jsx @@ -3,20 +3,39 @@ import { Link } from 'react-router-dom'; import styles from './QuizsetDetail.module.css'; import { QuizDetailCard } from '../QuizForm'; -export default function QuizsetDetail({ topic, title, quizzes = [], onDelete, onEdit }) { +export default function QuizsetDetail({ topic, title, quizzes = [], onDelete, onEdit, tested = false }) { console.log('topic', topic, 'title', title, 'quizzes', quizzes); return (
- - - {topic} - -
-

{title}

+
+ + + {topic} + +
+

{title}

+
+
+
+ {!tested && ( + + )} +
@@ -31,18 +50,7 @@ export default function QuizsetDetail({ topic, title, quizzes = [], onDelete, on /> ))}
- - + {tested &&
이미 진행된 퀴즈는 수정이 불가능합니다.
}
); } diff --git a/frontend/src/components/QuizsetDetail/QuizsetDetail.module.css b/frontend/src/components/QuizsetDetail/QuizsetDetail.module.css index 033c587..cdbcc91 100644 --- a/frontend/src/components/QuizsetDetail/QuizsetDetail.module.css +++ b/frontend/src/components/QuizsetDetail/QuizsetDetail.module.css @@ -11,12 +11,25 @@ } .header { + display: flex; + justify-content: space-between; + align-items: end; +} + +.headerInside { display: flex; flex-direction: column; align-items: start; gap: 8px; } +.actionGroup { + display: flex; + align-items: end; + gap: 20px; + color: var(--text-color); +} + .goBack { display: flex; align-items: center; @@ -52,3 +65,20 @@ justify-content: start; margin-bottom: 40px; } + +.edit, +.delete { + padding: 0; + margin: 0; + border: none; + background-color: var(--background); + color: var(--text-color-tertiary); + font-size: 16px; + line-height: 1.4; + font-weight: 500; + cursor: pointer; +} + +.delete { + color: var(--error-color); +} diff --git a/frontend/src/hooks/api/useStudentReportDetail.js b/frontend/src/hooks/api/useStudentReportDetail.js index 7ef143f..362bd1b 100644 --- a/frontend/src/hooks/api/useStudentReportDetail.js +++ b/frontend/src/hooks/api/useStudentReportDetail.js @@ -5,6 +5,6 @@ import { API_URL } from '../../constants'; export function useStudentReportDetail(reportId) { return useSuspenseQuery({ queryKey: ['studentreportdetail', reportId], - queryFn: () => instance.get(`${API_URL}/report/myreportdetail/${reportId}`), + queryFn: () => instance.get(`${API_URL}/report/reportDetail/${reportId}`), }); } diff --git a/frontend/src/hooks/api/useStudentReports.js b/frontend/src/hooks/api/useStudentReports.js index 5264bcb..2b230e2 100644 --- a/frontend/src/hooks/api/useStudentReports.js +++ b/frontend/src/hooks/api/useStudentReports.js @@ -2,9 +2,9 @@ import { useSuspenseQuery } from '@tanstack/react-query'; import instance from '../../utils/axios/instance'; import { API_URL } from '../../constants'; -export function useStudentReports() { +export function useStudentReports(lectureId) { return useSuspenseQuery({ queryKey: ['studentreports'], - queryFn: () => instance.get(`${API_URL}/report/myreport`), + queryFn: () => instance.get(`${API_URL}/report/student/${lectureId}`), }); } diff --git a/frontend/src/pages/QuizsetDetailPage/QuizsetDetailPage.jsx b/frontend/src/pages/QuizsetDetailPage/QuizsetDetailPage.jsx index 366e623..1a4a72c 100644 --- a/frontend/src/pages/QuizsetDetailPage/QuizsetDetailPage.jsx +++ b/frontend/src/pages/QuizsetDetailPage/QuizsetDetailPage.jsx @@ -9,7 +9,8 @@ export default function QuizsetDetailPage() { const { quizsetDelete } = useQuizsetDelete(); const { data } = useTeacherQuizsetDetail(quizsetId); const quizset = data.data; - console.log(quizset); + const tested = quizset.tested; + console.log(tested); const handleEdit = () => { navigate('edit', { state: { initialValue: quizset } }); }; @@ -25,6 +26,7 @@ export default function QuizsetDetailPage() { quizzes={quizset.quizzes} onDelete={handleDelete} onEdit={handleEdit} + tested={tested} /> ); } diff --git a/frontend/src/pages/StudentReportDetailPage/StudentReportDetailPage.jsx b/frontend/src/pages/StudentReportDetailPage/StudentReportDetailPage.jsx index c4e32dd..676e2c0 100644 --- a/frontend/src/pages/StudentReportDetailPage/StudentReportDetailPage.jsx +++ b/frontend/src/pages/StudentReportDetailPage/StudentReportDetailPage.jsx @@ -1,37 +1,36 @@ import { Link, useParams } from 'react-router-dom'; -import styles from './StudentReportDetailPage'; +import styles from './StudentReportDetailPage.module.css'; import BackIcon from '/src/assets/icons/back.svg?react'; -import { useStudentReportDetail } from '../../hooks/api/useStudentReportDetail'; +// import { useStudentReportDetail } from '../../hooks/api/useStudentReportDetail'; +import { QuizDetailCard } from '../../components/QuizForm'; export default function StudentReportDetailPage() { const { reportId } = useParams(); console.log(reportId); - const { data } = useStudentReportDetail(reportId); - console.log(data); + // const report = useStudentReportDetail(reportId); + // console.log(report); + // TODO: API 연결 후 실제 동작 확인 및 QuizDetailCard에 Map 적용 return (
-
- - - 퀴즈 성적 - -
-

퀴즈명

-
-
+ + + 퀴즈 목록 + +
퀴즈명
-
-

맞은 퀴즈

-
-
-
-

틀린 퀴즈

-
+

점수 : 70점 ( 7 / 10 )

+
+
); diff --git a/frontend/src/pages/StudentReportDetailPage/StudentReportDetailPage.module.css b/frontend/src/pages/StudentReportDetailPage/StudentReportDetailPage.module.css index b9782df..67233dd 100644 --- a/frontend/src/pages/StudentReportDetailPage/StudentReportDetailPage.module.css +++ b/frontend/src/pages/StudentReportDetailPage/StudentReportDetailPage.module.css @@ -11,12 +11,6 @@ } .header { - display: flex; - justify-content: space-between; - align-items: end; -} - -.headerInside { display: flex; flex-direction: column; align-items: start; @@ -38,7 +32,6 @@ font-size: 32px; line-height: 1.2; font-weight: 800; - margin: 0; } .author { @@ -59,3 +52,11 @@ .icon { stroke: var(--text-color); } + +.grid { + display: grid; + grid-template-columns: repeat(auto-fill, 440px); + gap: 20px; + justify-content: start; + margin-bottom: 40px; +} diff --git a/frontend/src/pages/StudentReportPage/StudentReportPage.jsx b/frontend/src/pages/StudentReportPage/StudentReportPage.jsx index 49007dc..602b352 100644 --- a/frontend/src/pages/StudentReportPage/StudentReportPage.jsx +++ b/frontend/src/pages/StudentReportPage/StudentReportPage.jsx @@ -3,10 +3,14 @@ import ArticleBoard from '../../components/ArticleBoard/ArticleBoard'; import { ReportCard } from '../../components/ReportCard'; import styles from './StudentReportPage.module.css'; import { useStudentReports } from '../../hooks/api/useStudentReports'; +import { useParams } from 'react-router-dom'; export default function StudentReportPage() { - const { data } = useStudentReports(); - // const reports = data?.data; + const { lectureId } = useParams(); + const { data } = useStudentReports(lectureId); + console.log(data); + const reportss = data?.data; + console.log(reportss); const reports = [ { reportId: 1,