Skip to content

Commit

Permalink
Merge pull request #368 from Ludo-SMP/dev
Browse files Browse the repository at this point in the history
코드 스플리팅, Vite 설정 수정 후 배포
  • Loading branch information
SungHyun627 authored Aug 29, 2024
2 parents 41bc644 + b372b41 commit 52491de
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 50 deletions.
4 changes: 3 additions & 1 deletion src/Pages/Applicants/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { P, match } from 'ts-pattern';
import { useStudyDetail } from '@/Hooks/study/useStudyDetail';
import { Applicant } from '@/Types/study';

export const ApplicantsPage = () => {
const ApplicantsPage = () => {
const studyId = Number(useParams().studyId);
const { user } = useUserStore();
const { data: ApplicantsDetail, status } = useApplicantsDetail(studyId);
Expand Down Expand Up @@ -329,3 +329,5 @@ const PlaceHolderTitle = styled.span`
color: ${({ theme }) => theme.color.black4};
${({ theme }) => theme.typo.ListLabel};
`;

export default ApplicantsPage;
4 changes: 3 additions & 1 deletion src/Pages/MyPageReviews/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { StudyReviewsType } from '@/Types/review';
import { Children, PropsWithChildren, ReactNode } from 'react';
import styled from 'styled-components';

export const MyPageReviews = () => {
const MyPageReviews = () => {
const { data: allStudyreviews, isLoading } = useReviews();

return (
Expand Down Expand Up @@ -71,3 +71,5 @@ const PlaceHolderTitle = styled.span`
color: ${({ theme }) => theme.color.black4};
${({ theme }) => theme.typo.ListLabel};
`;

export default MyPageReviews;
4 changes: 3 additions & 1 deletion src/Pages/Notifications/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import ChipMenu from '@/Components/Common/ChipMenu';
import { useState } from 'react';
import { media } from '@/Styles/theme';

export const Notifications = () => {
const Notifications = () => {
const { data: notifications, isLoading } = useNotifications();

const [selectedNotificationType, setSelectedNotificationType] = useState<'REVIEW' | 'RECRUITMENT' | 'STUDY'>('STUDY');
Expand Down Expand Up @@ -109,3 +109,5 @@ const PlaceHolderTitle = styled.span`
color: ${({ theme }) => theme.color.black4};
${({ theme }) => theme.typo.ListLabel};
`;

export default Notifications;
4 changes: 3 additions & 1 deletion src/Pages/NotificationsSettings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Loading } from '@/Assets';
import { KeywordsSettingForm } from './KeywordsSettingForm';
import { NOTIFICATIONS_SETTINGS_CONTENTS } from '@/Constants/messages';

export const NotificationsSettings = () => {
const NotificationsSettings = () => {
const { data: notificationsSetting, isLoading } = useNotificationsSetting();

return (
Expand Down Expand Up @@ -139,3 +139,5 @@ const ToggleSwitches = styled.div`
width: 100%;
flex-direction: column;
`;

export default NotificationsSettings;
4 changes: 3 additions & 1 deletion src/Pages/Review/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const reviewDataList = {

type ReviewResult = Record<keyof typeof reviewDataList, number>;

export const ReviewPage = () => {
const ReviewPage = () => {
const { studyId, userId } = useParams();
const navigate = useNavigate();

Expand Down Expand Up @@ -238,3 +238,5 @@ const FooterInner = styled.div`
flex: 1;
}
`;

export default ReviewPage;
104 changes: 75 additions & 29 deletions src/Router/index.tsx
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
import { lazy, Suspense } from 'react';
import { Outlet, createBrowserRouter } from 'react-router-dom';
import { ROUTES } from '@/Constants/route';
import SignUpPage from '@/Pages/SignUp';
import { ApplicantsPage } from '@/Pages/Applicants';
import MainPage from '@/Pages/Main';
import RecruitmentsPage from '@/Pages/Recruitments';
import StudyDetailPage from '@/Pages/StudyDetail';
import CreateStudyPage from '@/Pages/Studies/CreateStudy';
import ModifyStudyPage from '@/Pages/Studies/EditStudy';
import CreateRecruitmentPage from '@/Pages/CreateRecruitment';
import LoginFailPage from '@/Pages/LoginFail';
import SignUpFailPage from '@/Pages/SignUpFail';
import MyPageHome from '@/Pages/MyPageHome/index';
import { Saved } from '@/Pages/Saved';
import Header from '@/Components/Header';
import Footer from '@/Components/Footer';
import { Loading } from '@/Assets';
import ErrorBoundary from '@/Components/ErrorBoundary';
import { EditRecruitmentPage } from '@/Pages/EditRecruitment';
import { MyPageLayout } from '@/Layout/MyPageLayout';
import { SettingLayout } from '@/Layout/SettingLayout';
import { NotificationsSettings } from '@/Pages/NotificationsSettings';
import { ReviewPage } from '@/Pages/Review';
import { Notifications } from '@/Pages/Notifications';
import { MyPageReviews } from '@/Pages/MyPageReviews';
import { ProfileLayout } from '@/Layout/ProfileLayout';
import { Loading } from '@/Assets';
import { SettingLayout } from '@/Layout/SettingLayout';
import MainPage from '@/Pages/Main';
import RecruitmentsPage from '@/Pages/Recruitments';

const LoginPage = lazy(() => import('@/Pages/Login'));
const SignUpPage = lazy(() => import('@/Pages/SignUp'));
const RecruitmentDetailPage = lazy(() => import('@/Pages/RecruitmentDetail'));
const StudyDetailPage = lazy(() => import('@/Pages/StudyDetail'));
const ApplicantsPage = lazy(() => import('@/Pages/Applicants'));
const CreateStudyPage = lazy(() => import('@/Pages/Studies/CreateStudy'));
const ModifyStudyPage = lazy(() => import('@/Pages/Studies/EditStudy'));
const CreateRecruitmentPage = lazy(() => import('@/Pages/CreateRecruitment'));
const LoginFailPage = lazy(() => import('@/Pages/LoginFail'));
const SignUpFailPage = lazy(() => import('@/Pages/SignUpFail'));
const MyPageHome = lazy(() => import('@/Pages/MyPageHome/index'));
const NotificationsSettings = lazy(() => import('@/Pages/NotificationsSettings'));
const ReviewPage = lazy(() => import('@/Pages/Review'));
const Notifications = lazy(() => import('@/Pages/Notifications'));
const MyPageReviews = lazy(() => import('@/Pages/MyPageReviews'));

const SuspenseWrapper = ({ children }: { children: React.ReactNode }) => (
<Suspense fallback={<Loading />}>{children}</Suspense>
Expand Down Expand Up @@ -59,15 +59,21 @@ export const RouterPath = createBrowserRouter([
},
{
path: ROUTES.AUTH.LOGINFAIL,
element: <LoginFailPage />,
element: (
<SuspenseWrapper>
<LoginFailPage />
</SuspenseWrapper>
),
},
{
// 마이페이지
path: ROUTES.MYPAGE.HOME,
// 마이페이지 공통 사이드바
element: (
<MyPageLayout>
<Outlet />
<SuspenseWrapper>
<Outlet />
</SuspenseWrapper>
</MyPageLayout>
),
children: [
Expand Down Expand Up @@ -115,11 +121,19 @@ export const RouterPath = createBrowserRouter([
},
{
path: ROUTES.STUDY.DETAIL,
element: <StudyDetailPage />,
element: (
<SuspenseWrapper>
<StudyDetailPage />
</SuspenseWrapper>
),
},
{
path: ROUTES.RECRUITMENT.RECRUITMENTS,
element: <RecruitmentsPage />,
element: (
<SuspenseWrapper>
<RecruitmentsPage />
</SuspenseWrapper>
),
},
{
path: ROUTES.RECRUITMENT.DETAIL,
Expand All @@ -131,42 +145,74 @@ export const RouterPath = createBrowserRouter([
},
{
path: ROUTES.AUTH.SIGNUP,
element: <SignUpPage />,
element: (
<SuspenseWrapper>
<SignUpPage />
</SuspenseWrapper>
),
},
{
path: ROUTES.AUTH.SIGNUPFAIL,
element: <SignUpFailPage />,
element: (
<SuspenseWrapper>
<SignUpFailPage />
</SuspenseWrapper>
),
},
],
},
{
// 스터디원 평가 페이지
path: ROUTES.STUDY.REVIEW,
element: <ReviewPage />,
element: (
<SuspenseWrapper>
<ReviewPage />
</SuspenseWrapper>
),
},
{
// 스터디 생성 페이지
path: ROUTES.STUDY.CREATE,
element: <CreateStudyPage />,
element: (
<SuspenseWrapper>
<CreateStudyPage />
</SuspenseWrapper>
),
},
{
// 스터디 수정 페이지
path: ROUTES.STUDY.MODIFY,
element: <ModifyStudyPage />,
element: (
<SuspenseWrapper>
<ModifyStudyPage />
</SuspenseWrapper>
),
},
{
// 스터디 지원자 페이지
path: ROUTES.STUDY.APPLICANTS,
element: <ApplicantsPage />,
element: (
<SuspenseWrapper>
<ApplicantsPage />
</SuspenseWrapper>
),
},
{
// 모집공고 생성 페이지
path: ROUTES.RECRUITMENT.CREATE,
element: <CreateRecruitmentPage />,
element: (
<SuspenseWrapper>
<CreateRecruitmentPage />
</SuspenseWrapper>
),
},
// 모집공고 수정 페이지
{
path: ROUTES.RECRUITMENT.EDIT,
element: <EditRecruitmentPage />,
element: (
<SuspenseWrapper>
<EditRecruitmentPage />
</SuspenseWrapper>
),
},
]);
17 changes: 1 addition & 16 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,9 @@ import svgr from 'vite-plugin-svgr';
import react from '@vitejs/plugin-react';
import * as path from 'path';
import mkcert from 'vite-plugin-mkcert';
import { VitePluginRadar } from 'vite-plugin-radar';

export default defineConfig({
plugins: [
react(),
svgr(),
mkcert(),
VitePluginRadar({
// GA measurement id
analytics: {
id: 'G-VW71YW2W58',
},
// GTM container id
gtm: {
id: 'GTM-WLWBHQRJ',
},
}),
],
plugins: [react(), svgr(), mkcert()],
resolve: {
alias: [{ find: '@', replacement: path.resolve(__dirname, 'src') }],
},
Expand Down

0 comments on commit 52491de

Please sign in to comment.