-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1081 from academic-relations/dev
Merge dev into main
- Loading branch information
Showing
13 changed files
with
158 additions
and
130 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1,71 @@ | ||
"use client"; | ||
|
||
// 배포용 not found 페이지 (시작) - 회원 등록 | ||
import NotFound from "@sparcs-clubs/web/app/not-found"; | ||
|
||
const TemporaryNotFound = () => <NotFound />; | ||
|
||
export default TemporaryNotFound; | ||
// 배포용 not found 페이지 (끝) | ||
|
||
// import React, { useEffect, useState } from "react"; | ||
|
||
// import { RegistrationDeadlineEnum } from "@sparcs-clubs/interface/common/enum/registration.enum"; | ||
|
||
// import AsyncBoundary from "@sparcs-clubs/web/common/components/AsyncBoundary"; | ||
// import LoginRequired from "@sparcs-clubs/web/common/frames/LoginRequired"; | ||
// import NoManageClub from "@sparcs-clubs/web/common/frames/NoManageClub"; | ||
// import NotRegistrationPeriod from "@sparcs-clubs/web/common/frames/NotRegistrationPeriod"; | ||
// import { useAuth } from "@sparcs-clubs/web/common/providers/AuthContext"; | ||
// import { useGetRegistrationTerm } from "@sparcs-clubs/web/features/clubs/services/useGetRegistrationTerm"; | ||
// import ManageClubMembers from "@sparcs-clubs/web/features/manage-club/members/frames/ManageClubMembersFrame"; | ||
|
||
// const Members = () => { | ||
// const { isLoggedIn, login, profile } = useAuth(); | ||
// const [loading, setLoading] = useState(true); | ||
|
||
// useEffect(() => { | ||
// if (isLoggedIn !== undefined || profile !== undefined) { | ||
// setLoading(false); | ||
// } | ||
// }, [isLoggedIn, profile]); | ||
|
||
// const { data, isLoading, isError } = useGetRegistrationTerm(); | ||
// const [isRegistrationPeriod, setIsRegistrationPeriod] = | ||
// useState<boolean>(false); | ||
|
||
// useEffect(() => { | ||
// if (data) { | ||
// const now = new Date(); | ||
// const currentEvents = data.events.filter( | ||
// event => now >= event.startTerm && now <= event.endTerm, | ||
// ); | ||
// if (currentEvents.length === 0) { | ||
// setIsRegistrationPeriod(false); | ||
// return; | ||
// } | ||
// const registrationEvent = currentEvents.filter( | ||
// event => | ||
// event.registrationEventEnumId === | ||
// RegistrationDeadlineEnum.StudentRegistrationApplication, | ||
// ); | ||
// if (registrationEvent.length > 0) { | ||
// setIsRegistrationPeriod(true); | ||
// } else { | ||
// setIsRegistrationPeriod(false); | ||
// } | ||
// } | ||
// }, [data]); | ||
|
||
// if (loading || isLoading) { | ||
// return <AsyncBoundary isLoading={loading || isLoading} isError={isError} />; | ||
// } | ||
|
||
// if (!isRegistrationPeriod) { | ||
// return <NotRegistrationPeriod />; | ||
// } | ||
|
||
// if (!isLoggedIn) { | ||
// return <LoginRequired login={login} />; | ||
// } | ||
|
||
// if (profile?.type !== "undergraduate") { | ||
// return <NoManageClub />; | ||
// } | ||
|
||
// return <ManageClubMembers />; | ||
// }; | ||
|
||
// export default Members; | ||
import React, { useEffect, useState } from "react"; | ||
|
||
import { RegistrationDeadlineEnum } from "@sparcs-clubs/interface/common/enum/registration.enum"; | ||
|
||
import AsyncBoundary from "@sparcs-clubs/web/common/components/AsyncBoundary"; | ||
import LoginRequired from "@sparcs-clubs/web/common/frames/LoginRequired"; | ||
import NoManageClub from "@sparcs-clubs/web/common/frames/NoManageClub"; | ||
import NotRegistrationPeriod from "@sparcs-clubs/web/common/frames/NotRegistrationPeriod"; | ||
import { useAuth } from "@sparcs-clubs/web/common/providers/AuthContext"; | ||
import { useGetRegistrationTerm } from "@sparcs-clubs/web/features/clubs/services/useGetRegistrationTerm"; | ||
import ManageClubMembers from "@sparcs-clubs/web/features/manage-club/members/frames/ManageClubMembersFrame"; | ||
|
||
const Members = () => { | ||
const { isLoggedIn, login, profile } = useAuth(); | ||
const [loading, setLoading] = useState(true); | ||
|
||
useEffect(() => { | ||
if (isLoggedIn !== undefined || profile !== undefined) { | ||
setLoading(false); | ||
} | ||
}, [isLoggedIn, profile]); | ||
|
||
const { data, isLoading, isError } = useGetRegistrationTerm(); | ||
const [isRegistrationPeriod, setIsRegistrationPeriod] = | ||
useState<boolean>(false); | ||
|
||
useEffect(() => { | ||
if (data) { | ||
const now = new Date(); | ||
const currentEvents = data.events.filter( | ||
event => now >= event.startTerm && now <= event.endTerm, | ||
); | ||
if (currentEvents.length === 0) { | ||
setIsRegistrationPeriod(false); | ||
return; | ||
} | ||
const registrationEvent = currentEvents.filter( | ||
event => | ||
event.registrationEventEnumId === | ||
RegistrationDeadlineEnum.StudentRegistrationApplication, | ||
); | ||
if (registrationEvent.length > 0) { | ||
setIsRegistrationPeriod(true); | ||
} else { | ||
setIsRegistrationPeriod(false); | ||
} | ||
} | ||
}, [data]); | ||
|
||
if (loading || isLoading) { | ||
return <AsyncBoundary isLoading={loading || isLoading} isError={isError} />; | ||
} | ||
|
||
if (!isRegistrationPeriod) { | ||
return <NotRegistrationPeriod />; | ||
} | ||
|
||
if (!isLoggedIn) { | ||
return <LoginRequired login={login} />; | ||
} | ||
|
||
if (profile?.type !== "undergraduate") { | ||
return <NoManageClub />; | ||
} | ||
|
||
return <ManageClubMembers />; | ||
}; | ||
|
||
export default Members; |
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,8 +1,6 @@ | ||
import { getDate, getHours, getMinutes, getMonth, getYear } from "date-fns"; | ||
import { formatDateTime } from "../utils/Date/formatDate"; | ||
|
||
const newMemberListSectionInfoText = (semester: string, deadline: Date) => | ||
`현재는 ${semester}학기 동아리 신청 기간입니다 | ||
(신청 마감 : ${getYear(deadline)}년 ${getMonth(deadline)}월 ${getDate(deadline)}일 | ||
${getHours(deadline)}:${getMinutes(deadline)})`; | ||
`현재는 ${semester}학기 동아리 신청 기간입니다 (신청 마감 : ${formatDateTime(deadline)})`; | ||
|
||
export { newMemberListSectionInfoText }; |
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
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
Oops, something went wrong.