Skip to content

Commit

Permalink
fix: null처리 잘못된 부분 수정 (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
eugene028 authored Sep 6, 2024
1 parent 26101ee commit ac094d7
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions src/components/myPage/ApproveBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,33 @@ export const ApproveBox = ({
}) => {
const { handleBottomSheet } = useBottomSheet();

if (!currentRecruitment && role !== 'REGULAR') {
if (role === 'REGULAR') {
return (
<Box
variant="arrow"
text="WOW CLASS"
subText="GDSC Hongik의 스터디 서비스인 WOW CLASS를 이용할 수 있어요."
status="success"
onClick={() => {
window.location.href = 'https://study.gdschongik.com/';
}}
/>
);
}

if (!currentRecruitment) {
return (
<Box
variant="warn"
text="지금은 모집 기간이 아니에요."
text="지금은 지원 기간이 아니에요."
subText="모집 기간에 다시 확인해주세요!"
status="error"
/>
);
}

const boxContent: Record<
UserRoleType,
Exclude<UserRoleType, 'REGULAR'>,
{
title: string;
description?: string;
Expand All @@ -55,25 +70,14 @@ export const ApproveBox = ({
description: `${convertRecruitmentPeriod(currentRecruitment.period)}`,
boxVariant: currentMembership ? 'text' : 'arrow',
status: 'error'
},
REGULAR: {
title: 'WOW CLASS',
description:
'GDSC Hongik의 스터디 서비스인 WOW CLASS를 이용할 수 있어요.',
boxVariant: 'arrow',
status: 'success'
}
};

return (
<BoxWrapper
onClick={() => {
if (role === 'ASSOCIATE' && !currentMembership) handleBottomSheet();
else if (role === 'REGULAR') {
window.location.href = 'https://study.gdschongik.com/';
} else {
return;
}
else return;
}}>
<Box
variant={boxContent[role].boxVariant}
Expand Down

0 comments on commit ac094d7

Please sign in to comment.