-
Notifications
You must be signed in to change notification settings - Fork 8
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 #1512 from 42organization/agenda
[test-deploy] 아젠다 기능 구현 테스트(재)
- Loading branch information
Showing
981 changed files
with
15,132 additions
and
1,988 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
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { usePathname } from 'next/navigation'; | ||
import AdminReject from 'components/admin/AdminReject'; | ||
import AdminLayout from 'components/admin/Layout'; | ||
import AgendaModalProvider from 'components/agenda/modal/AgendaModalProvider'; | ||
import ModalProvider from 'components/takgu/modal/ModalProvider'; | ||
import { useUser } from 'hooks/agenda/Layout/useUser'; | ||
|
||
type AdminLayoutProps = { | ||
children: React.ReactNode; | ||
}; | ||
|
||
function AdminAppLayout({ children }: AdminLayoutProps) { | ||
const user = useUser(); | ||
const presentPath = usePathname(); | ||
|
||
// 사용자 정보가 없거나 관리자가 아닐 경우 | ||
if (!user || !user.intraId) return null; | ||
|
||
if (!user.isAdmin) return <AdminReject />; | ||
|
||
// 모달 제공자 결정 | ||
let ModalProviderComponent; | ||
if (presentPath.includes('admin/takgu')) { | ||
ModalProviderComponent = ModalProvider; | ||
} else if (presentPath.includes('admin/agenda')) { | ||
ModalProviderComponent = AgendaModalProvider; | ||
} | ||
|
||
return ( | ||
<AdminLayout> | ||
{children} | ||
{ModalProviderComponent && <ModalProviderComponent />} | ||
</AdminLayout> | ||
); | ||
} | ||
|
||
export default AdminAppLayout; |
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { instanceInAgenda } from 'utils/axios'; | ||
import AgendaHeader from 'components/agenda/Layout/AgendaHeader'; | ||
import AgendaModalProvider from 'components/agenda/modal/AgendaModalProvider'; | ||
import Footer from 'components/takgu/Layout/Footer'; | ||
import { useUser } from 'hooks/agenda/Layout/useUser'; | ||
import useAxiosWithToast from 'hooks/useAxiosWithToast'; | ||
import styles from 'styles/agenda/Layout/Layout.module.scss'; | ||
|
||
type AgendaLayoutProps = { | ||
children: React.ReactNode; | ||
}; | ||
|
||
function AgendaAppLayout({ children }: AgendaLayoutProps) { | ||
useAxiosWithToast(instanceInAgenda); // API의 성공 실패 스낵바로 알리는 기능 | ||
|
||
const user = useUser(); | ||
|
||
if (!user || !user.intraId) return null; | ||
|
||
const scrollToTop = () => { | ||
window.scrollTo({ top: 0, behavior: 'smooth' }); | ||
}; | ||
|
||
return ( | ||
<> | ||
<AgendaHeader /> | ||
<div className={styles.background}></div> | ||
<div className={styles.app}> | ||
{children} | ||
<Footer /> | ||
<AgendaModalProvider /> | ||
</div> | ||
<button onClick={scrollToTop} className={styles.floatingButton}> | ||
↑ | ||
</button> | ||
</> | ||
); | ||
} | ||
|
||
export default AgendaAppLayout; |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import AdminAppLayout from 'Layout/AdminLayout'; | ||
import AgendaAppLayout from 'Layout/AgendaLayout'; | ||
import TakguAppLayout from 'Layout/TakguLayout'; | ||
import { usePathname } from 'hooks/agenda/Layout/usePathname'; | ||
|
||
type LayoutProviderProps = { | ||
children: React.ReactNode; | ||
}; | ||
|
||
// 현재 페이지가 어떤 레이아웃을 사용할지 결정 | ||
// 로그인 스테이트 등은 각 레이아웃에서 확인 | ||
const LayoutProvider = ({ children }: LayoutProviderProps) => { | ||
const app = usePathname(); | ||
switch (app) { | ||
case '': | ||
case 'agenda': | ||
return <AgendaAppLayout>{children}</AgendaAppLayout>; | ||
case 'takgu': | ||
return <TakguAppLayout>{children}</TakguAppLayout>; | ||
case 'admin': | ||
return <AdminAppLayout>{children}</AdminAppLayout>; | ||
default: | ||
return <>{children}</>; | ||
} | ||
}; | ||
|
||
export default LayoutProvider; |
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 |
---|---|---|
@@ -0,0 +1,96 @@ | ||
import { useRecoilValue } from 'recoil'; | ||
import { openCurrentMatchState } from 'utils/recoil/takgu/match'; | ||
import AdminReject from 'components/admin/AdminReject'; | ||
import AdminLayout from 'components/admin/Layout'; | ||
import CurrentMatch from 'components/takgu/Layout/CurrentMatch'; | ||
import Footer from 'components/takgu/Layout/Footer'; | ||
import Header from 'components/takgu/Layout/Header'; | ||
import HeaderStateContext from 'components/takgu/Layout/HeaderContext'; | ||
import MainPageProfile from 'components/takgu/Layout/MainPageProfile'; | ||
import Megaphone from 'components/takgu/Layout/MegaPhone'; | ||
import RecruitLayout from 'components/takgu/recruit/RecruitLayout'; | ||
import Statistics from 'pages/takgu/statistics'; | ||
import { usePathname } from 'hooks/agenda/Layout/usePathname'; | ||
import useAnnouncementCheck from 'hooks/takgu/Layout/useAnnouncementCheck'; | ||
import useGetUserSeason from 'hooks/takgu/Layout/useGetUserSeason'; | ||
import useLiveCheck from 'hooks/takgu/Layout/useLiveCheck'; | ||
import useSetAfterGameModal from 'hooks/takgu/Layout/useSetAfterGameModal'; | ||
import { useUser } from 'hooks/takgu/Layout/useUser'; | ||
import useAxiosResponse from 'hooks/useAxiosResponse'; | ||
import styles from 'styles/takgu/Layout/Layout.module.scss'; | ||
import PlayButton from '../components/takgu/Layout/PlayButton'; | ||
import UserLayout from '../components/takgu/Layout/UserLayout'; | ||
import ModalProvider from '../components/takgu/modal/ModalProvider'; | ||
import CustomizedSnackbars from '../components/toastmsg/toastmsg'; | ||
|
||
type TakguLayoutProps = { | ||
children: React.ReactNode; | ||
}; | ||
|
||
function TakguLayout({ children }: TakguLayoutProps) { | ||
const user = useUser(); | ||
const presentPath = usePathname(); | ||
const openCurrentMatch = useRecoilValue(openCurrentMatchState); | ||
|
||
useAxiosResponse(); | ||
useGetUserSeason(presentPath); | ||
useSetAfterGameModal(); | ||
useLiveCheck(presentPath); | ||
useAnnouncementCheck(presentPath); | ||
|
||
if (!user || !user.intraId) return null; | ||
|
||
switch (true) { | ||
case presentPath.includes('takgu/admin'): | ||
if (!user.isAdmin) return <AdminReject />; | ||
return <AdminLayout>{children}</AdminLayout>; | ||
|
||
case presentPath.includes('takgu/recruit'): | ||
return <RecruitLayout>{children}</RecruitLayout>; | ||
|
||
case presentPath === 'takgu/statistics' && user.isAdmin: | ||
return ( | ||
<UserLayout> | ||
<Statistics /> | ||
</UserLayout> | ||
); | ||
|
||
case presentPath.includes('takgu'): | ||
return ( | ||
<> | ||
<UserLayout> | ||
<HeaderStateContext> | ||
<Header /> | ||
</HeaderStateContext> | ||
<PlayButton /> | ||
<div className={styles.topInfo}> | ||
<Megaphone /> | ||
{openCurrentMatch && <CurrentMatch />} | ||
{presentPath === '/' && <MainPageProfile />} | ||
</div> | ||
{children} | ||
<Footer /> | ||
</UserLayout> | ||
</> | ||
); | ||
default: | ||
return <>{children}</>; | ||
} | ||
} | ||
|
||
{ | ||
/* UserLayout : 배경색 제공 */ | ||
/* LoginChecker : 미로그인시 에러 던짐 */ | ||
/* ErrorChecker : 에러 리코일 체크해서 에러 페이지로 던짐 */ | ||
} | ||
const TakguAppLayout = ({ children }: TakguLayoutProps) => { | ||
return ( | ||
<UserLayout> | ||
<TakguLayout>{children}</TakguLayout> | ||
<ModalProvider /> | ||
<CustomizedSnackbars /> | ||
</UserLayout> | ||
); | ||
}; | ||
|
||
export default TakguAppLayout; |
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 |
---|---|---|
@@ -0,0 +1,95 @@ | ||
import { useRouter } from 'next/router'; | ||
import { useRecoilValue } from 'recoil'; | ||
import { openCurrentMatchState } from 'utils/recoil/takgu/match'; | ||
import AdminReject from 'components/admin/AdminReject'; | ||
import AdminLayout from 'components/admin/Layout'; | ||
import CurrentMatch from 'components/takgu/Layout/CurrentMatch'; | ||
import Footer from 'components/takgu/Layout/Footer'; | ||
import Header from 'components/takgu/Layout/Header'; | ||
import HeaderStateContext from 'components/takgu/Layout/HeaderContext'; | ||
import MainPageProfile from 'components/takgu/Layout/MainPageProfile'; | ||
import Megaphone from 'components/takgu/Layout/MegaPhone'; | ||
import RecruitLayout from 'components/takgu/recruit/RecruitLayout'; | ||
import Statistics from 'pages/takgu/statistics'; | ||
import useAnnouncementCheck from 'hooks/takgu/Layout/useAnnouncementCheck'; | ||
import useGetUserSeason from 'hooks/takgu/Layout/useGetUserSeason'; | ||
import useLiveCheck from 'hooks/takgu/Layout/useLiveCheck'; | ||
import useSetAfterGameModal from 'hooks/takgu/Layout/useSetAfterGameModal'; | ||
import { useUser } from 'hooks/takgu/Layout/useUser'; | ||
import useAxiosResponse from 'hooks/useAxiosResponse'; | ||
import styles from 'styles/takgu/Layout/Layout.module.scss'; | ||
import AgendaFooter from './agenda/Layout/AgendaFooter'; | ||
import AgendaHeader from './agenda/Layout/AgendaHeader'; | ||
import AgendaUserLayout from './agenda/Layout/AgendaUserLayout'; | ||
import PlayButton from './takgu/Layout/PlayButton'; | ||
import UserLayout from './takgu/Layout/UserLayout'; | ||
import ModalProvider from './takgu/modal/ModalProvider'; | ||
|
||
type AppLayoutProps = { | ||
children: React.ReactNode; | ||
}; | ||
|
||
function AppLayout({ children }: AppLayoutProps) { | ||
const user = useUser(); | ||
const presentPath = useRouter().asPath; | ||
const openCurrentMatch = useRecoilValue(openCurrentMatchState); | ||
|
||
useAxiosResponse(); | ||
useGetUserSeason(presentPath); | ||
useSetAfterGameModal(); | ||
useLiveCheck(presentPath); | ||
useAnnouncementCheck(presentPath); | ||
|
||
if (!user || !user.intraId) return null; | ||
|
||
switch (true) { | ||
case presentPath.includes('/admin'): | ||
if (!user.isAdmin) return <AdminReject />; | ||
return <AdminLayout>{children}</AdminLayout>; | ||
|
||
case presentPath.includes('/takgu/recruit'): | ||
return <RecruitLayout>{children}</RecruitLayout>; | ||
|
||
case presentPath === '/takgu/statistics' && user.isAdmin: | ||
return ( | ||
<UserLayout> | ||
<Statistics /> | ||
</UserLayout> | ||
); | ||
|
||
case presentPath.includes('/takgu'): | ||
return ( | ||
<> | ||
<UserLayout> | ||
<HeaderStateContext> | ||
<Header /> | ||
</HeaderStateContext> | ||
<PlayButton /> | ||
<div className={styles.topInfo}> | ||
<Megaphone /> | ||
{openCurrentMatch && <CurrentMatch />} | ||
{presentPath === '/' && <MainPageProfile />} | ||
</div> | ||
{children} | ||
<Footer /> | ||
</UserLayout> | ||
<ModalProvider /> | ||
</> | ||
); | ||
|
||
case presentPath.includes('/agenda'): | ||
return ( | ||
<> | ||
<AgendaUserLayout> | ||
<AgendaHeader /> | ||
{children} | ||
<AgendaFooter /> | ||
</AgendaUserLayout> | ||
</> | ||
); | ||
default: | ||
return <>{children}</>; | ||
} | ||
} | ||
|
||
export default AppLayout; |
Oops, something went wrong.