fix: 라우터 오류, 시간 표시 오류 수정, 사이드바 일부 제거

This commit is contained in:
정기영 2024-08-09 16:37:07 +09:00
parent 8b82681089
commit 58f4d16bd4
3 changed files with 8 additions and 30 deletions

View File

@ -1,7 +1,7 @@
import styles from './LectureLayout.module.css'; import styles from './LectureLayout.module.css';
import { Outlet, useParams } from 'react-router-dom'; import { Outlet, useParams } from 'react-router-dom';
import LectureHeader from '../LectureHeader/LectureHeader'; import LectureHeader from '../LectureHeader/LectureHeader';
import { SideBar, SideLink, SideItem } from '../SideBar'; import { SideBar, SideLink } from '../SideBar';
import MaxWidthLayout from './MaxWidthLayout'; import MaxWidthLayout from './MaxWidthLayout';
import { Suspense, useEffect } from 'react'; import { Suspense, useEffect } from 'react';
import useBoundStore from '../../store'; import useBoundStore from '../../store';
@ -61,18 +61,11 @@ export default function LectureLayout() {
<SideLink to={'freeboard'}>자유게시판</SideLink> <SideLink to={'freeboard'}>자유게시판</SideLink>
{userType === 'student' && <SideLink to={'report'}>퀴즈 성적</SideLink>} {userType === 'student' && <SideLink to={'report'}>퀴즈 성적</SideLink>}
{userType === 'teacher' && <SideLink to={'quiz'}>퀴즈 만들기</SideLink>} {userType === 'teacher' && <SideLink to={'quiz'}>퀴즈 만들기</SideLink>}
{userType === 'teacher' && <SideLink to={'enroll'}>수강신청관리</SideLink>} {userType === 'teacher' && <SideLink to={'enroll'}>수강관리</SideLink>}
</SideBar> </SideBar>
{userType === 'teacher' && (
<SideBar title="수업 정보">
<SideItem
name="수강생"
sub="총 12명"
/>
</SideBar>
)}
{userType === 'teacher' && ( {userType === 'teacher' && (
<SideBar title={'강의 정보 관리'}> <SideBar title={'강의 정보 관리'}>
<SideLink to={'teacherReportsets'}>퀴즈 성적 보기</SideLink>
<SideLink <SideLink
to={'edit'} to={'edit'}
state={lectureData} state={lectureData}
@ -87,19 +80,6 @@ export default function LectureLayout() {
강의 삭제 강의 삭제
</span> </span>
</li> </li>
<SideLink to={'teacherReportsets'}>퀴즈 목록</SideLink>
</SideBar>
)}
{userType === 'student' && (
<SideBar title="내 학습">
<SideItem
name="진도율"
sub="2 / 12"
/>
<SideItem
name="퀴즈 정답률"
sub="80%"
/>
</SideBar> </SideBar>
)} )}
</aside> </aside>

View File

@ -5,7 +5,7 @@ import { useStudentReportDetail } from '../../hooks/api/useStudentReportDetail';
import { QuizDetailCard } from '../../components/QuizForm'; import { QuizDetailCard } from '../../components/QuizForm';
export default function StudentReportDetailPage() { export default function StudentReportDetailPage() {
const { reportId } = useParams(); const { lectureId, reportId } = useParams();
const { data } = useStudentReportDetail(reportId); const { data } = useStudentReportDetail(reportId);
const report = data.data; const report = data.data;
console.log(report); console.log(report);
@ -15,7 +15,7 @@ export default function StudentReportDetailPage() {
<div className={styles.wrapper}> <div className={styles.wrapper}>
<header className={styles.header}> <header className={styles.header}>
<Link <Link
to={'..'} to={`/lecture/${lectureId}/class/report`}
className={styles.goBack} className={styles.goBack}
> >
<BackIcon /> <BackIcon />

View File

@ -1,13 +1,11 @@
import { ArticleLink } from '../../components/ArticleLink'; import { ArticleLink } from '../../components/ArticleLink';
import ArticleBoard from '../../components/ArticleBoard/ArticleBoard'; import ArticleBoard from '../../components/ArticleBoard/ArticleBoard';
import { useReportSetDetail } from '../../hooks/api/useReportSetDetail'; import { useReportSetDetail } from '../../hooks/api/useReportSetDetail';
import { useReportSetDelete } from '../../hooks/api/useReportSetDelete'; import { useParams } from 'react-router-dom';
import { useParams, useNavigate } from 'react-router-dom';
export default function TeacherReportsetDetailPage() { export default function TeacherReportsetDetailPage() {
const { reportsetId } = useParams(); const { reportsetId } = useParams();
const navigate = useNavigate();
const { reportsetDelete } = useReportSetDelete();
const { data } = useReportSetDetail(reportsetId); const { data } = useReportSetDetail(reportsetId);
const reports = data?.data; const reports = data?.data;
@ -26,7 +24,7 @@ export default function TeacherReportsetDetailPage() {
? `${report.name} - 미응시` ? `${report.name} - 미응시`
: `${report.name} - ${report.title} 점수: ${report.correctCount}/${report.allCount}` : `${report.name} - ${report.title} 점수: ${report.correctCount}/${report.allCount}`
} }
sub={`${new Date(report.testAt).toLocaleDateString()} ${new Date(report.testAt).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}`} sub={`${new Date(report.date).toLocaleDateString()} ${new Date(report.date).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}`}
to={`../report/${report.reportId}`} to={`../report/${report.reportId}`}
/> />
); );