Skip to content
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

[Refactor]: 학교 이메일 인증 정책을 변경해요 #91

Merged
merged 7 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 26 additions & 21 deletions src/components/myPage/ApproveBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from '@/utils/mypage/recruitmentNameFormat';
import useBottomSheet from '@/hooks/common/useBottomSheet';

type MemberRole = 'GUEST' | 'ASSOCIATE' | 'REGULAR' | 'ADMIN';
type MemberRole = 'GUEST' | 'ASSOCIATE' | 'REGULAR';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p3;
member role 타입을 일괄적으로 관리하기 위해서 types 의 UserRoleType 을 활용하는 건 어떠신가요?

+) JoinStatus 에 있는 member role도,,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

헉 이미 타입에 있었군요! 챙겨주셔서 감사합동

type BoxVariantType = 'arrow' | 'checkbox' | 'text' | 'warn';
type BoxStatusType = 'default' | 'success' | 'error';

Expand Down Expand Up @@ -44,29 +44,34 @@ export const ApproveBox = ({
title: '모든 가입 절차를 완료했어요.',
boxVariant: 'text',
status: 'success'
},
//TODO: 어드민 가입 상태 논의하기
ADMIN: {
title: '모든 가입 절차를 완료했어요.',
boxVariant: 'text',
status: 'success'
}
};
return (
<BoxWrapper
onClick={() => {
if (role === 'ASSOCIATE') handleBottomSheet();
else {
return;
}
}}>
<Box
variant={boxContent[role].boxVariant}
text={boxContent[role].title}
subText={boxContent[role].description}
status={boxContent[role].status}
/>
</BoxWrapper>
<>
{currentRecruitment.period.open ? (
<BoxWrapper
onClick={() => {
if (role === 'ASSOCIATE') handleBottomSheet();
else {
return;
}
}}>
<Box
variant={boxContent[role].boxVariant}
text={boxContent[role].title}
subText={boxContent[role].description}
status={boxContent[role].status}
/>
</BoxWrapper>
) : (
<Box
variant="warn"
text="학회원 모집이 마감되었어요"
subText="2학기 모집 소식을 받고 싶으시다면 @gdsc.hongik 을 팔로우 해주세요."
status="error"
/>
)}
</>
);
};

Expand Down
62 changes: 40 additions & 22 deletions src/components/myPage/AssociateRequirementCheck.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Flex, Text } from '@/components/common/Wrapper';
import Box from 'wowds-ui/Box';
import { UnivEmailStatus } from '@/types/status';
import { Discord } from '@/assets/Discord';
import { AssociateRequirement } from '@/types/user';
import RoutePath from '@/routes/routePath';
Expand All @@ -14,6 +15,42 @@ const AssociateRequirementCheck = ({
associateRequirement;
const navigate = useNavigate();

const univStatusContent = (univStatus: UnivEmailStatus) => {
if (univStatus === 'PENDING')
return (
<Flex
direction="column"
gap="xs"
justify="flex-start"
align="flex-start">
<Text typo="h3" color="textBlack">
재학생 이메일 인증이 필요해요.
</Text>
<Text typo="body1" color="sub">
홍익대학교 재학생인지 알려주세요.
<br />
학교 Gmail을 통해 인증할 수 있어요.
</Text>
</Flex>
);
if (univStatus === 'IN_PROGRESS')
return (
<Flex
direction="column"
gap="xs"
justify="flex-start"
align="flex-start">
<Text typo="h3" color="textBlack">
재학생 이메일 인증이 진행 중이에요.
</Text>
<Text typo="body1" color="sub">
메일함을 확인해주세요.
</Text>
</Flex>
);
return '홍익대학교 재학생 인증을 완료했어요.';
};

return (
<Flex justify="flex-start" direction="column" align="flex-start" gap="sm">
<Text typo="h2" color="black">
Expand Down Expand Up @@ -55,28 +92,9 @@ const AssociateRequirementCheck = ({
onClick={() => {
navigate(RoutePath.AuthenticationProcess2_StudentVerification);
}}
text={
univStatus === 'PENDING' ? (
<Flex
direction="column"
gap="xs"
justify="flex-start"
align="flex-start">
<Text typo="h3" color="textBlack">
재학생 이메일 인증이 필요해요.
</Text>
<Text typo="body1" color="sub">
홍익대학교 재학생인지 알려주세요.
<br />
학교 Gmail을 통해 인증할 수 있어요.
</Text>
</Flex>
) : (
'홍익대학교 재학생 인증을 완료했어요.'
)
}
status={univStatus === 'PENDING' ? 'error' : 'success'}
variant={univStatus === 'PENDING' ? 'arrow' : 'text'}
text={univStatusContent(univStatus)}
status={univStatus === 'SATISFIED' ? 'success' : 'error'}
variant={univStatus === 'SATISFIED' ? 'text' : 'arrow'}
/>
<Box
text={
Expand Down
2 changes: 1 addition & 1 deletion src/components/myPage/JoinStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { CurrentRecruitmentType } from '@/apis/member/memberType';
import MemberStatusStepper from './MemberStatusStepper';
import { User } from '@/types/user';

type MemberRole = 'GUEST' | 'ASSOCIATE' | 'REGULAR' | 'ADMIN';
type MemberRole = 'GUEST' | 'ASSOCIATE' | 'REGULAR';

const JoinStatus = ({
role,
Expand Down
1 change: 1 addition & 0 deletions src/types/status.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export type Status = 'PENDING' | 'SATISFIED';
export type UnivEmailStatus = 'IN_PROGRESS' | 'PENDING' | 'SATISFIED';
8 changes: 4 additions & 4 deletions src/types/user.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import { Status } from '@/types/status';
import { Status, UnivEmailStatus } from '@/types/status';

export type User = {
memberId: string; // C000000 (학번)
role: UserRoleType;
basicInfo: UserBasicInfo;
associateRequirement: {
univStatus: Status;
univStatus: UnivEmailStatus;
discordStatus: Status;
bevyStatus: Status;
infoStatus: Status;
};
};

export type UserRoleType = 'GUEST' | 'ASSOCIATE' | 'REGULAR' | 'ADMIN';
export type UserRoleType = 'GUEST' | 'ASSOCIATE' | 'REGULAR';

export type AssociateRequirement = {
univStatus: Status;
univStatus: UnivEmailStatus;
discordStatus: Status;
bevyStatus: Status;
infoStatus: Status;
Expand Down
Loading