-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 팀 탈퇴 api 정의 #380 * feat: 팀 삭제/탈퇴 모달 통합 #380 * feat: TeamControlPanel 리더 및 팀원 여부에 따른 버튼 표시 - 팀원 탈퇴 버튼 추가 #380 * feat: 스터디 탈퇴 모달 구현 #380 * feat: 스터디 탈퇴 구현 #380 * fix: router 경로 변경 - api 불러오는 이름 수정 #380 * refactor: 파일 경로 수정 #380 * refactor: 팀 삭제 모달과 탈퇴 모달 분리 #380 * fix: build error 수정 #380 * fix: 팀원이 탈퇴 버튼이 보이도록 수정 #380 * design: 탈퇴 버튼 색상 수정 #380 * fix: 스터디원이 아닌 팀원에게 탈퇴 버튼이 노출되는 문제 수정 #380
- Loading branch information
Showing
16 changed files
with
269 additions
and
93 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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,43 @@ | ||
import { Text } from '@chakra-ui/react'; | ||
import { useRouter } from 'next/navigation'; | ||
|
||
import { leaveStudy as leaveStudyApi } from '@/app/api/study'; | ||
import ConfirmModal from '@/components/Modal/ConfirmModal'; | ||
import { useMutateWithToken } from '@/hooks/useFetchWithToken'; | ||
import useRefetchSideBar from '@/hooks/useRefetchSideBar'; | ||
|
||
import { LeaveStudyModalProps } from '../types'; | ||
|
||
const LeaveStudyModal = ({ id, name, teamId, isOpen, setIsOpen }: LeaveStudyModalProps) => { | ||
const leaveStudy = useMutateWithToken(leaveStudyApi); | ||
const refetchSidebar = useRefetchSideBar(); | ||
const router = useRouter(); | ||
|
||
const handleClickLeave = () => { | ||
leaveStudy(id).then((res) => { | ||
if (res.ok) { | ||
refetchSidebar(); | ||
setIsOpen(false); | ||
router.replace(`/team/${teamId}`); | ||
} | ||
}); | ||
}; | ||
|
||
return ( | ||
<ConfirmModal | ||
isOpen={isOpen} | ||
onClose={() => setIsOpen(false)} | ||
title="스터디 탈퇴" | ||
confirmButtonText="탈퇴" | ||
onConfirmButtonClick={handleClickLeave} | ||
> | ||
<Text align="center"> | ||
스터디에서 탈퇴하면 다시 되돌릴 수 없습니다. | ||
<br /> | ||
{`"${name}"에서 탈퇴하시겠습니까?`} | ||
</Text> | ||
</ConfirmModal> | ||
); | ||
}; | ||
|
||
export default LeaveStudyModal; |
This file contains 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 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 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 |
---|---|---|
@@ -1,5 +1,8 @@ | ||
export interface StudyControlPanelProps { | ||
isStudyLeader: boolean; | ||
isStudyMember: boolean; | ||
editModalOpen: React.Dispatch<React.SetStateAction<boolean>>; | ||
terminateModalOpen: React.Dispatch<React.SetStateAction<boolean>>; | ||
deleteModalOpen: React.Dispatch<React.SetStateAction<boolean>>; | ||
leaveModalOpen: React.Dispatch<React.SetStateAction<boolean>>; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains 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 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,41 @@ | ||
import { Text } from '@chakra-ui/react'; | ||
import { useRouter } from 'next/navigation'; | ||
|
||
import { leaveTeam as leaveTeamApi } from '@/app/api/team'; | ||
import ConfirmModal from '@/components/Modal/ConfirmModal'; | ||
import { useMutateWithToken } from '@/hooks/useFetchWithToken'; | ||
import useRefetchSideBar from '@/hooks/useRefetchSideBar'; | ||
|
||
import { LeaveTeamModalProps } from '../type'; | ||
|
||
const LeaveTeamModal = ({ id, name, isOpen, onClose }: LeaveTeamModalProps) => { | ||
const leaveTeam = useMutateWithToken(leaveTeamApi); | ||
const refetchSidebar = useRefetchSideBar(); | ||
const router = useRouter(); | ||
|
||
const handleLeaveTeamButtonClick = () => { | ||
leaveTeam(id).then(() => { | ||
refetchSidebar(); | ||
onClose(); | ||
router.replace('/'); | ||
}); | ||
}; | ||
|
||
return ( | ||
<ConfirmModal | ||
isOpen={isOpen} | ||
onClose={onClose} | ||
title="팀 탈퇴" | ||
confirmButtonText="탈퇴" | ||
onConfirmButtonClick={() => handleLeaveTeamButtonClick()} | ||
> | ||
<Text align="center"> | ||
팀에서 탈퇴하면 다시 되돌릴 수 없습니다. | ||
<br /> | ||
{name} 팀에서 탈퇴하시겠습니까? | ||
</Text> | ||
</ConfirmModal> | ||
); | ||
}; | ||
|
||
export default LeaveTeamModal; |
This file contains 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 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,17 @@ | ||
import { Team } from '@/types'; | ||
|
||
export interface TeamModalProps { | ||
teamInfo?: Team; | ||
isOpen: boolean; | ||
onClose: () => void; | ||
} | ||
|
||
export interface DeleteTeamModalProps extends Pick<Team, 'id' | 'name'> { | ||
isOpen: boolean; | ||
onClose: () => void; | ||
} | ||
|
||
export interface LeaveTeamModalProps extends Pick<Team, 'id' | 'name'> { | ||
isOpen: boolean; | ||
onClose: () => void; | ||
} |
Oops, something went wrong.