diff --git a/src/apis/domains/moim/useFetchGuestApply.ts b/src/apis/domains/moim/useFetchGuestApply.ts index 47f7c709..b77d2fdc 100644 --- a/src/apis/domains/moim/useFetchGuestApply.ts +++ b/src/apis/domains/moim/useFetchGuestApply.ts @@ -6,7 +6,7 @@ import { QUERY_KEY } from '@apis/queryKeys/queryKeys'; import { components } from '@schema'; import { ApiResponseType } from '@types'; -type SubmittedMoimByGuestResponse = components['schemas']['SubmittedMoimByGuestResponse']; +export type SubmittedMoimByGuestResponse = components['schemas']['SubmittedMoimByGuestResponse']; const getGuestApplyMoim = async ( guestId: number, diff --git "a/src/pages/class/components/\bCommentBox/CommentBox.tsx" "b/src/pages/class/components/\bCommentBox/CommentBox.tsx" index 6e9bc027..22bc96b7 100644 --- "a/src/pages/class/components/\bCommentBox/CommentBox.tsx" +++ "b/src/pages/class/components/\bCommentBox/CommentBox.tsx" @@ -74,7 +74,7 @@ const CommentBox = ({ comment, noticeId, host }: CommentBoxProps) => { {canShowIcon && (
- + {isDeleteOpen && ( )} diff --git a/src/pages/class/components/HostProfileCard/HostProfileCard.tsx b/src/pages/class/components/HostProfileCard/HostProfileCard.tsx index 9529ec16..9772063f 100644 --- a/src/pages/class/components/HostProfileCard/HostProfileCard.tsx +++ b/src/pages/class/components/HostProfileCard/HostProfileCard.tsx @@ -80,7 +80,7 @@ const HostProfileCard = ({ data: noticeDetail, noticeId, moimId }: HostProfileCa return ( <> - + {renderDeleteCard()} {renderModal()} diff --git a/src/pages/class/page/ClassNoticeDetail/ClassNoticeDetail.tsx b/src/pages/class/page/ClassNoticeDetail/ClassNoticeDetail.tsx index 4464ffd0..4c568551 100644 --- a/src/pages/class/page/ClassNoticeDetail/ClassNoticeDetail.tsx +++ b/src/pages/class/page/ClassNoticeDetail/ClassNoticeDetail.tsx @@ -40,6 +40,10 @@ const ClassNoticeDetail = () => { } }, [commentList]); + useEffect(() => { + window.scrollTo(0, 0); + }, []); + return ( <>
diff --git a/src/pages/guest/page/GuestMyClass/GuestMyClass.tsx b/src/pages/guest/page/GuestMyClass/GuestMyClass.tsx index c614b345..af15ded6 100644 --- a/src/pages/guest/page/GuestMyClass/GuestMyClass.tsx +++ b/src/pages/guest/page/GuestMyClass/GuestMyClass.tsx @@ -2,6 +2,7 @@ import { useAtom } from 'jotai'; import { useEffect, useState } from 'react'; import { useFetchGuestApply, useFetchGuestParticipate } from '@apis/domains/moim'; +import { SubmittedMoimByGuestResponse } from '@apis/domains/moim/useFetchGuestApply'; import { FilterSelect, Header, Spinner } from '@components'; import { GuestMyClassEmptyView, MoimCard } from '@pages/guest/components'; @@ -51,6 +52,18 @@ const GuestMyClass = () => { setSelectedStatus(status); }; + const currentData = activeTab === '신청한' ? applyData : participateData; + + // 각 상태별로 필터링된 데이터 계산 + const statusFilteredData: { [key: string]: SubmittedMoimByGuestResponse[] | undefined } = { + 전체: currentData ?? [], + '입금 대기': currentData?.filter((data) => data.moimSubmissionState === 'pendingPayment'), + '승인 대기': currentData?.filter((data) => data.moimSubmissionState === 'pendingApproval'), + '승인 완료': currentData?.filter((data) => data.moimSubmissionState === 'approved'), + '승인 거절': currentData?.filter((data) => data.moimSubmissionState === 'rejected'), + '환불 완료': currentData?.filter((data) => data.moimSubmissionState === 'refunded'), + }; + if (isApplyLoading || isParticipateLoading) { return ; } @@ -59,8 +72,6 @@ const GuestMyClass = () => { return
Error: {applyError?.message || participateError?.message}
; } - const currentData = activeTab === '신청한' ? applyData : participateData; - return (
@@ -77,7 +88,8 @@ const GuestMyClass = () => {
- {activeTab === '신청한' && (currentData?.length ?? 0) > 0 && ( + {/* 모든 상태에 데이터가 하나라도 있으면 FilterSelect를 보여줌 */} + {activeTab === '신청한' && (
{
)} + {/* 전체 데이터가 없을 때 GuestMyClassEmptyView를 보여줌 */} {currentData?.length === 0 ? ( ) : (
    - {currentData?.map((data) => ( + {statusFilteredData[selectedStatus]?.map((data) => (