Merge pull request #129 from TeamBNBN/fe/fixNoContents

[Front-End] fix: 컨텐츠 없을 때 에러 발생하는 문제 해결
This commit is contained in:
FlashingFuture 2024-07-29 11:00:20 +09:00 committed by GitHub
commit 6f2da2a7b6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 10 additions and 12 deletions

View File

@ -13,7 +13,7 @@ export default function ArticlePreview({ to, title, contents = [] }) {
<RightIcon /> <RightIcon />
</Link> </Link>
<div className={styles.main}> <div className={styles.main}>
{contents.map((content) => { {contents.map?.((content) => {
return ( return (
<Link <Link
to={`${to}/${content.id}`} to={`${to}/${content.id}`}

View File

@ -14,7 +14,7 @@ export default function ChatRoom() {
className={styles.messageList} className={styles.messageList}
ref={chatListRef} ref={chatListRef}
> >
{messages.map((message) => ( {messages.map?.((message) => (
<li <li
key={message.id} key={message.id}
className={message.isMine ? styles.my : styles.your} className={message.isMine ? styles.my : styles.your}

View File

@ -11,7 +11,6 @@
.title { .title {
margin: 0; margin: 0;
padding: 16px; padding: 16px;
z-index: 9;
} }
.messageList { .messageList {
@ -97,7 +96,6 @@
border-radius: 12px; border-radius: 12px;
box-shadow: var(--shadow); box-shadow: var(--shadow);
overflow: hidden; overflow: hidden;
z-index: 9;
& > input[type='text'] { & > input[type='text'] {
flex: 1; flex: 1;

View File

@ -14,7 +14,7 @@ export default function LearningLecturesPage() {
<section> <section>
<h2 className={styles.title}>수강중인 강의</h2> <h2 className={styles.title}>수강중인 강의</h2>
<div className={styles.grid}> <div className={styles.grid}>
{onGoingClasses.map((lecture) => ( {onGoingClasses.map?.((lecture) => (
<Link <Link
key={lecture.lecture_id} key={lecture.lecture_id}
to={`/lecture/${lecture.lecture_id}`} to={`/lecture/${lecture.lecture_id}`}

View File

@ -13,7 +13,7 @@ export default function NoticeListPage() {
title="공지사항" title="공지사항"
canCreate={false} canCreate={false}
> >
{notices?.map((notice) => ( {notices?.map?.((notice) => (
<ArticleLink <ArticleLink
key={`${notice.id}`} key={`${notice.id}`}
title={notice.title} title={notice.title}

View File

@ -13,7 +13,7 @@ export default function QuestionListPage() {
title="Q&A" title="Q&A"
canCreate={true} canCreate={true}
> >
{questions.map((question) => ( {questions.map?.((question) => (
<ArticleLink <ArticleLink
key={`${question.title}${question.createtAt}`} key={`${question.title}${question.createtAt}`}
title={question.title} title={question.title}

View File

@ -13,12 +13,12 @@ export default function StudentHomePage() {
}; };
const { data } = useLectures(); const { data } = useLectures();
const allClasses = data?.data; const allClasses = data?.data ?? [];
return ( return (
<MaxWidthLayout> <MaxWidthLayout>
<ClassGrid title="수강중인 강의"> <ClassGrid title="수강중인 강의">
{onGoingClasses.map((lecture) => ( {onGoingClasses.map?.((lecture) => (
<ClassCard <ClassCard
key={lecture.lecture_id} key={lecture.lecture_id}
path={`/lecture/${lecture.lecture_id}`} path={`/lecture/${lecture.lecture_id}`}
@ -28,7 +28,7 @@ export default function StudentHomePage() {
))} ))}
</ClassGrid> </ClassGrid>
<ClassGrid title="전체 강의"> <ClassGrid title="전체 강의">
{allClasses?.map((lecture) => ( {allClasses.map?.((lecture) => (
<ClassCard <ClassCard
key={lecture.id} key={lecture.id}
path={`/lecture/${lecture.id}/info`} path={`/lecture/${lecture.id}/info`}

View File

@ -14,7 +14,7 @@ export default function StudentListPage() {
return ( return (
<ArticleBoard title="수강생 관리"> <ArticleBoard title="수강생 관리">
{students.map((student) => { {students.map?.((student) => {
return ( return (
<ArticleLink <ArticleLink
key={`${student.name}${student.sub}`} key={`${student.name}${student.sub}`}

View File

@ -16,7 +16,7 @@ export default function TeacherNoticeListPage() {
title="공지사항" title="공지사항"
canCreate={true} canCreate={true}
> >
{notices.map((notice) => { {notices.map?.((notice) => {
if (notice.sub && notice.title) { if (notice.sub && notice.title) {
return ( return (
<ArticleLink <ArticleLink