Merge branch 'fe/articleListEmpty' into 'frontend'

[Front-End] fix: 글 목록 0개일 때 표시 수정

See merge request s11-webmobile1-sub2/S11P12A701!162
This commit is contained in:
정기영 2024-08-12 09:37:20 +09:00
commit 6e36781702
7 changed files with 10 additions and 9 deletions

View File

@ -1,6 +1,7 @@
import EditIcon from '/src/assets/icons/edit.svg?react'; import EditIcon from '/src/assets/icons/edit.svg?react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import styles from './ArticleBoard.module.css'; import styles from './ArticleBoard.module.css';
import { Children } from 'react';
export default function ArticleBoard({ title, canCreate, children }) { export default function ArticleBoard({ title, canCreate, children }) {
return ( return (
@ -19,7 +20,7 @@ export default function ArticleBoard({ title, canCreate, children }) {
)} )}
</div> </div>
<div className={styles.article}> <div className={styles.article}>
{children ? children : <div className={styles.empty}>표시할 내용이 없습니다.</div>} {Children.toArray(children).length ? children : <div className={styles.empty}>표시할 내용이 없습니다.</div>}
</div> </div>
</div> </div>
); );

View File

@ -7,14 +7,14 @@ import IntersectionArea from '../../components/IntersectionArea/IntersectionObse
export default function NoticeListPage() { export default function NoticeListPage() {
const { lectureId } = useParams(); const { lectureId } = useParams();
const { data, fetchNextPage, hasNextPage } = useFreeboards(lectureId); const { data, fetchNextPage, hasNextPage } = useFreeboards(lectureId);
const articles = data?.pages.flatMap((page) => page.data); const articles = data.pages.flatMap((page) => page.data);
return ( return (
<ArticleBoard <ArticleBoard
title="자유게시판" title="자유게시판"
canCreate={true} canCreate={true}
> >
{articles.length && {articles.length > 0 &&
articles.map?.((notice) => ( articles.map?.((notice) => (
<ArticleLink <ArticleLink
key={`${notice.id}`} key={`${notice.id}`}

View File

@ -8,7 +8,7 @@ import IntersectionArea from '../../components/IntersectionArea/IntersectionObse
export default function NoticeListPage() { export default function NoticeListPage() {
const { lectureId } = useParams(); const { lectureId } = useParams();
const { data, fetchNextPage, hasNextPage } = useNotices(lectureId); const { data, fetchNextPage, hasNextPage } = useNotices(lectureId);
const notices = data?.pages.flatMap((page) => page.data); const notices = data.pages.flatMap((page) => page.data);
const userType = useBoundStore((state) => state.userType); const userType = useBoundStore((state) => state.userType);
return ( return (
@ -16,7 +16,7 @@ export default function NoticeListPage() {
title="공지사항" title="공지사항"
canCreate={userType === 'teacher'} canCreate={userType === 'teacher'}
> >
{notices.length && {notices.length > 0 &&
notices.map?.((notice) => ( notices.map?.((notice) => (
<ArticleLink <ArticleLink
key={`${notice.id}`} key={`${notice.id}`}

View File

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

View File

@ -13,7 +13,7 @@ export default function QuizsetListPage() {
title="퀴즈 목록" title="퀴즈 목록"
canCreate={true} canCreate={true}
> >
{quizsets.length && {quizsets.length > 0 &&
quizsets.map?.((quizset) => ( quizsets.map?.((quizset) => (
<ArticleLink <ArticleLink
key={`${quizset.quizSetId}`} key={`${quizset.quizSetId}`}

View File

@ -14,7 +14,7 @@ export default function StudentListPage() {
return ( return (
<ArticleBoard title="수강생 관리"> <ArticleBoard title="수강생 관리">
{students.length && {students.length > 0 &&
students.map?.((student) => { students.map?.((student) => {
return ( return (
<ArticleLink <ArticleLink

View File

@ -14,7 +14,7 @@ export default function TeacherReportsetDetailPage() {
title="퀴즈 조회" title="퀴즈 조회"
canCreate={false} canCreate={false}
> >
{reports.length && {reports.length > 0 &&
reports.map?.((report) => { reports.map?.((report) => {
return ( return (
<ArticleLink <ArticleLink