Skip to content

Commit

Permalink
Test: 참여 정보 - 모임 참여 여부에 따른 버튼 작동
Browse files Browse the repository at this point in the history
  • Loading branch information
goeun208 committed May 23, 2024
1 parent 54e0b00 commit 7e365fd
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/components/home/DeletePopup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ const DeletePopup = ({ onAuthClick }: any) => {
// 투표 종료하기 Mutation
const deleteAuthMutation = useMutation(() => deleteAuth(token), {
onSuccess: () => {
api.logout();
alert('회원 탈퇴가 완료되었습니다.');
location.reload();
location.replace('/');
},
onError: () => {
console.log('회원 탈퇴 error');
Expand Down
2 changes: 1 addition & 1 deletion src/components/main/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const Main = ({ id }: MainProps) => {
<LoadingPage />
</>
) : (
<div className="flex flex-col ">
<div className="flex flex-col bg-white">
<div className="flex flex-col justify-center items-center p-4 mt-10">
<div className="font-Pretendard text-black text-h1 font-bold">{groupNameData?.data.name}</div>
<div className="font-Pretendard text-font_gray text-h3 font-bold">{groupNameData?.data.date}</div>
Expand Down
14 changes: 13 additions & 1 deletion src/components/participate/Participant.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ const Participate = ({ id }: any) => {
const token = api.getToken();
const [partData, setPartData] = useState<ParticipationProps>();
const [clickPlus, setClickPlus] = useState<boolean>(false);
const [isParticipateCurrentUser, setIsParticipateCurrentUser] = useState<any>('');

const setGroupName = useSetRecoilState(groupNameAtom);
const setGroupId = useSetRecoilState(groupIdAtom);

Expand Down Expand Up @@ -72,6 +74,16 @@ const Participate = ({ id }: any) => {
partData && currentUserEmail === partData?.adminEmail ? setRole('leader') : setRole('member');
}, [currentUserEmail, partData]);

useEffect(() => {
const findUser: any = partData?.participantsByRegion?.find((item: any) =>
item.participations.find((i: any) => currentUserEmail === i.userEmail),
);
findUser &&
setIsParticipateCurrentUser(
findUser?.participations?.find((i: any) => i.userEmail === currentUserEmail).userEmail,
);
}, [currentUserEmail, partData?.participantsByRegion]);

const deleteGroupMutation = useMutation((groupId: number) => deleteGroup(token, groupId), {
onSuccess: () => {
alert('모이닷 스페이스를 삭제했습니다.');
Expand Down Expand Up @@ -132,7 +144,7 @@ const Participate = ({ id }: any) => {
{/* 참여자 정보 띄우기 */}
{partData && <ParticipationList data={partData} mode={updateMode} setMode={setUpdateMode} />}
{/* 하단 메뉴 - 정보 수정 & 스페이스 삭제/나가기 */}
{token === undefined ? (
{isParticipateCurrentUser !== currentUserEmail ? (
<div
onClick={() => {
voteId === -1 ? setClickPlus(true) : alert('투표 시작 후에는 참여가 불가능합니다.');
Expand Down
6 changes: 5 additions & 1 deletion src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
margin: 0;
}

:root {
--main-bg-color: white;
}

body {
background-color: white;
background-color: var(--main-bg-color);
height: 100vh;
}
2 changes: 1 addition & 1 deletion src/pages/vote/detail/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const VoteDetailPage = () => {
{/* 지도 자리 */}
{voteData?.voteStatuses && <VoteKakaoMap locationInfo={voteData?.voteStatuses} />}
{/* 투표 탭 */}
<div className="w-[1200px] mx-auto">
<div className="w-[1200px] mx-auto bg-white">
<div className="w-full h-[74px] mt-2 flex justify-between items-center">
<div className="w-[170px] h-[50px] flex justify-between text-b3">
{voteData?.isEnabledMultipleChoice ? (
Expand Down

0 comments on commit 7e365fd

Please sign in to comment.