diff --git a/src/app/schedule/_components/current.tsx b/src/app/schedule/_components/current.tsx index 80802ced..4efce5e2 100644 --- a/src/app/schedule/_components/current.tsx +++ b/src/app/schedule/_components/current.tsx @@ -12,7 +12,12 @@ export default function Current() { const { items, error, fetchNextPage, hasNextPage, isFetchingNextPage, completedMessage } = useInfiniteScroll({ queryFn: async ({ cursor, size }) => { - return await API.groupService.getMyGroups({ type: 'current', cursor, size }); + return await API.groupService.getMyGroups({ + type: 'current', + cursor, + size, + myStatuses: ['ATTEND', 'PENDING'], + }); }, queryKey: ['myGroups', 'current'], pageSize: 10, diff --git a/src/app/schedule/_components/meeting-list.tsx b/src/app/schedule/_components/meeting-list.tsx index 413d886e..58b600ed 100644 --- a/src/app/schedule/_components/meeting-list.tsx +++ b/src/app/schedule/_components/meeting-list.tsx @@ -108,6 +108,9 @@ export const MeetingList = ({ dateTime={formatDateTime(meeting.startTime)} images={meeting.images} isFinished={meeting.status === 'FINISHED'} + isHost={meeting.myMembership?.role === 'HOST'} + isPending={meeting.myMembership?.status === 'PENDING'} + joinPolicy={meeting.joinPolicy} leaveAndChatActions={ showActions ? { diff --git a/src/components/shared/card/index.tsx b/src/components/shared/card/index.tsx index b49361bb..52264478 100644 --- a/src/components/shared/card/index.tsx +++ b/src/components/shared/card/index.tsx @@ -27,6 +27,8 @@ type CardProps = { tabType?: 'current' | 'myPost' | 'past'; isPending?: boolean; isFinished?: boolean; + joinPolicy?: 'FREE' | 'APPROVAL_REQUIRED'; + isHost?: boolean; }; const calculateProgress = (count: number, max: number): number => { @@ -39,6 +41,22 @@ const convertToCardTags = (tags: string[]): CardTag[] => { return tags.map((tag, index) => ({ id: index, label: tag })); }; +const getLeaveButtonText = ( + tabType?: 'current' | 'myPost' | 'past', + isHost?: boolean, + isPending?: boolean, +): string => { + if (tabType === 'myPost' || (tabType === 'current' && isHost)) { + return '모임 취소'; + } + + if (tabType === 'current' && isPending) { + return '신청 취소'; + } + + return '모임 탈퇴'; +}; + const Card = ({ title, images, @@ -54,12 +72,13 @@ const Card = ({ tabType, isPending, isFinished, + isHost, }: CardProps) => { const thumbnail = images?.[0]; const cardTags = convertToCardTags(tags); const progress = calculateProgress(participantCount, maxParticipants); const shouldShowButtons = leaveAndChatActions && tabType !== 'past'; - const leaveButtonText = tabType === 'myPost' ? '모임 취소' : '모임 탈퇴'; + const leaveButtonText = getLeaveButtonText(tabType, isHost, isPending); return (