feat: 수강신청 관리 페이지 내용 없을 때 수정

This commit is contained in:
jhynsoo 2024-08-08 17:56:25 +09:00
parent 0d8b15a915
commit 1cf2d37a6c
2 changed files with 22 additions and 5 deletions

View File

@ -10,7 +10,7 @@ export default function LectureEnrollPage() {
const { data } = useLectureEnroll(lectureId);
const [newStudents, setNewStudents] = useState([]);
const [students, setStudents] = useState([]);
console.log(data);
useEffect(() => {
if (data?.data) {
setNewStudents(data.data[1]);
@ -31,7 +31,7 @@ export default function LectureEnrollPage() {
title="수강신청 관리"
canCreate={false}
>
{newStudents.length &&
{newStudents.length > 0 ? (
newStudents.map?.((student) => (
<LectureEnroll
key={`${student.id}`}
@ -40,10 +40,13 @@ export default function LectureEnrollPage() {
onDelete={handleNewDelete}
enrolled={false}
/>
))}
))
) : (
<div className={styles.emptyMessage}>수강 대기중인 학생이 없어요</div>
)}
<div>
<h3 className={styles.title}>전체 수강생 관리</h3>
{students.length &&
{students.length > 0 ? (
students.map?.((student) => (
<LectureEnroll
key={`${student.id}`}
@ -51,7 +54,10 @@ export default function LectureEnrollPage() {
userName={student.userName}
onDelete={handleDelete}
/>
))}
))
) : (
<div className={styles.emptyMessage}>현재 수강생이 없어요</div>
)}
</div>
</ArticleBoard>
);

View File

@ -4,3 +4,14 @@
font-weight: 700;
padding-left: 20px;
}
.emptyMessage {
display: flex;
justify-content: center;
align-items: center;
font-size: 16px;
line-height: 1.2;
font-weight: 400;
color: var(--text-color-tertiary);
padding: 40px 0;
}