-
Notifications
You must be signed in to change notification settings - Fork 0
[Feat] 스케줄 페이지에 신청 취소 및 탈퇴 및 채팅 버튼 API 연동하기 #353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
42f4414
feat: 스케줄 페이지 신청 취소 탈퇴 채팅 버튼 연결하기
claudia99503 311618b
Merge remote-tracking branch 'origin/main' into minseo-feat/schedule
claudia99503 82cb362
fix: 스케줄 페이지 전체적인 리팩토링
claudia99503 1dabe22
Merge remote-tracking branch 'origin/main' into minseo-feat/schedule
claudia99503 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import { type ReactNode } from 'react'; | ||
|
|
||
| export type TabType = 'current' | 'myPost' | 'past'; | ||
|
|
||
| const DEFAULT_BUTTON_WIDTH = 'w-31'; | ||
|
|
||
| export const EMPTY_STATE_CONFIG: Record< | ||
| TabType, | ||
| { text: ReactNode; buttonText: string; buttonWidth: string } | ||
| > = { | ||
| current: { | ||
| text: ( | ||
| <> | ||
| 현재 참여 중인 모임이 없어요. | ||
| <br /> | ||
| 지금 바로 모임을 참여해보세요! | ||
| </> | ||
| ), | ||
| buttonText: '모임 보러가기', | ||
| buttonWidth: DEFAULT_BUTTON_WIDTH, | ||
| }, | ||
| myPost: { | ||
| text: ( | ||
| <> | ||
| 아직 생성한 모임이 없어요. | ||
| <br /> | ||
| 지금 바로 모임을 만들어보세요! | ||
| </> | ||
| ), | ||
| buttonText: '모임 만들기', | ||
| buttonWidth: DEFAULT_BUTTON_WIDTH, | ||
| }, | ||
| past: { | ||
| text: ( | ||
| <> | ||
| 아직 참여한 모임이 없어요. | ||
| <br /> | ||
| 마음에 드는 모임을 발견해보세요! | ||
| </> | ||
| ), | ||
| buttonText: '모임 보러가기', | ||
| buttonWidth: DEFAULT_BUTTON_WIDTH, | ||
| }, | ||
| } as const; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| 'use client'; | ||
|
|
||
| import { useRouter } from 'next/navigation'; | ||
|
|
||
| import { useQuery } from '@tanstack/react-query'; | ||
|
|
||
| import { API } from '@/api'; | ||
| import { GroupModal } from '@/components/pages/group/group-modal'; | ||
| import Card from '@/components/shared/card'; | ||
| import { useModal } from '@/components/ui'; | ||
| import { formatDateTime } from '@/lib/formatDateTime'; | ||
| import { groupKeys } from '@/lib/query-key/query-key-group'; | ||
| import { GroupListItemResponse } from '@/types/service/group'; | ||
|
|
||
| type TabType = 'current' | 'myPost' | 'past'; | ||
|
|
||
| interface MeetingCardProps { | ||
| getModalType: (meeting: GroupListItemResponse) => 'pending' | 'leave' | 'delete'; | ||
| meeting: GroupListItemResponse; | ||
| showActions: boolean; | ||
| tabType: TabType; | ||
| } | ||
|
|
||
| /** | ||
| * 모임 상세 페이지에서 chatRoomId를 가져와 채팅 입장할거임 | ||
| */ | ||
| export const MeetingCard = ({ getModalType, meeting, showActions, tabType }: MeetingCardProps) => { | ||
| const router = useRouter(); | ||
| const { open } = useModal(); | ||
|
|
||
| const groupId = String(meeting.id); | ||
| const myMembership = meeting.myMembership; | ||
| const isPending = myMembership?.status === 'PENDING'; | ||
| const isFinished = meeting.status === 'FINISHED'; | ||
| const isHost = myMembership?.role === 'HOST'; | ||
| const createdBy = meeting.createdBy; | ||
|
|
||
| const shouldFetchChatRoomId = showActions && !isPending && !isFinished; | ||
|
|
||
| const { data: groupDetails } = useQuery({ | ||
| queryKey: groupKeys.detail(groupId), | ||
| queryFn: () => API.groupService.getGroupDetails({ groupId }), | ||
| enabled: shouldFetchChatRoomId, | ||
| }); | ||
|
|
||
| const handleChatClick = () => { | ||
| if (!groupDetails?.chatRoomId) return; | ||
| router.push(`/message/chat/${groupDetails.chatRoomId}`); | ||
| }; | ||
|
|
||
| const handleLeaveClick = () => { | ||
| const modalType = getModalType(meeting); | ||
| open(<GroupModal groupId={groupId} type={modalType} />); | ||
| }; | ||
|
|
||
| const handleCardClick = () => { | ||
| router.push(`/group/${groupId}`); | ||
| }; | ||
|
|
||
| return ( | ||
| <Card | ||
| dateTime={formatDateTime(meeting.startTime)} | ||
| images={meeting.images} | ||
| isFinished={isFinished} | ||
| isHost={isHost} | ||
| isPending={isPending} | ||
| joinPolicy={meeting.joinPolicy} | ||
| leaveAndChatActions={ | ||
| showActions | ||
| ? { | ||
| onLeave: handleLeaveClick, | ||
| onChat: handleChatClick, | ||
| } | ||
| : undefined | ||
| } | ||
| location={meeting.location} | ||
| maxParticipants={meeting.maxParticipants} | ||
| nickName={createdBy.nickName} | ||
| participantCount={meeting.participantCount} | ||
| profileImage={createdBy.profileImage} | ||
| tabType={tabType} | ||
| tags={meeting.tags} | ||
| title={meeting.title} | ||
| onClick={handleCardClick} | ||
| /> | ||
| ); | ||
| }; | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
카드 상태가 ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ