Skip to content

Commit

Permalink
Merge pull request #135 from HabitPay/feat/챌린지-시작-전-참여-및-참여-취소-버튼-로직-수정
Browse files Browse the repository at this point in the history
…#134

[feat] 챌린지 시작 전 참여 및 참여 취소 버튼 로직 수정#134
  • Loading branch information
Han-Joon-Hyeok authored Dec 18, 2024
2 parents d7592d6 + 4d8708a commit eb5c6a3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/app/challenges/[challengeId]/components/enrollment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@ import { toastPopupAtom } from "@/hooks/atoms";
interface IEnrollmentProps {
id: string;
isMemberEnrolledInChallenge: boolean;
isHost: boolean;
}

const Enrollment = ({ id, isMemberEnrolledInChallenge }: IEnrollmentProps) => {
const Enrollment = ({
id,
isMemberEnrolledInChallenge,
isHost,
}: IEnrollmentProps) => {
const [
isMemberEnrolledInChallengeState,
setIsMemberEnrolledInChallengeState,
Expand Down Expand Up @@ -58,10 +63,13 @@ const Enrollment = ({ id, isMemberEnrolledInChallenge }: IEnrollmentProps) => {
}
};

if (isHost) {
return <></>;
}

return (
<>
{isMemberEnrolledInChallengeState ? (
// TODO: 빨간색으로 변경하기
<Button
color="red"
onClick={cancelChallengeEnrollment}
Expand Down
1 change: 1 addition & 0 deletions src/app/challenges/[challengeId]/main/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ const Page = ({
<Enrollment
id={challengeId as string}
isMemberEnrolledInChallenge={isMemberEnrolledInChallenge}
isHost={isHost}
/>
) : (
<>
Expand Down

0 comments on commit eb5c6a3

Please sign in to comment.