Skip to content

Commit

Permalink
fix: 페이지 코드스플리팅
Browse files Browse the repository at this point in the history
  • Loading branch information
ksmfou98 committed Oct 16, 2023
1 parent 145fbf4 commit 7058ed0
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 28 deletions.
11 changes: 6 additions & 5 deletions apps/jurumarble/src/app/drink-info/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
"use client";

import BottomBar from "components/BottomBar";
import dynamic from "next/dynamic";
import React from "react";
import DrinkCommentContainer from "./components/DrinkCommentContainer";
import DrinkInfoContainer from "./components/DrinkInfoContainer";

const DynamicDrinkInfoContainer = dynamic(() => import("./components/DrinkInfoContainer"));
const DynamicDrinkCommentContainer = dynamic(() => import("./components/DrinkCommentContainer"));

function DrinkInfoPage() {
return (
<>
<DrinkInfoContainer />
<DrinkCommentContainer />
<DynamicDrinkInfoContainer />
<DynamicDrinkCommentContainer />
</>
);
}
Expand Down
6 changes: 5 additions & 1 deletion apps/jurumarble/src/app/map/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import BottomBar from "components/BottomBar";
import Header from "components/Header";
import { KAKAO_MAP_API_KEY } from "lib/constants";
import dynamic from "next/dynamic";
import Script from "next/script";
import React from "react";
import MapContainer from "./components/MapContainer";
Expand All @@ -12,6 +13,9 @@ declare global {
kakao: any;
}
}

const DynamicMapContainer = dynamic(() => import("./components/MapContainer"));

const MapPage = () => {
return (
<>
Expand All @@ -21,7 +25,7 @@ const MapPage = () => {
src={`//dapi.kakao.com/v2/maps/sdk.js?appkey=${KAKAO_MAP_API_KEY}&libraries=services&autoload=false`}
></Script>
<Header />
<MapContainer />
<DynamicMapContainer />
<BottomBar />
</>
);
Expand Down
18 changes: 10 additions & 8 deletions apps/jurumarble/src/app/my/page.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import BottomBar from "components/BottomBar";
import Header from "components/Header";
import UserInfoContainer from "./components/UseInfoContainer";
import VoteListContainer from "./components/VoteListContainer";
import dynamic from "next/dynamic";

const DynamicHeader = dynamic(() => import("components/Header"));
const DynamicUserInfoContainer = dynamic(() => import("./components/UseInfoContainer"));
const DynamicVoteListContainer = dynamic(() => import("./components/VoteListContainer"));
const DynamicBottomBar = dynamic(() => import("components/BottomBar"));

function MyPage() {
return (
<>
<Header />
<UserInfoContainer />
<VoteListContainer />
<BottomBar />
<DynamicHeader />
<DynamicUserInfoContainer />
<DynamicVoteListContainer />
<DynamicBottomBar />
</>
);
}
Expand Down
17 changes: 11 additions & 6 deletions apps/jurumarble/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
import BottomBar from "components/BottomBar";
import Header from "components/Header";
import styled, { css } from "styled-components";
import Banner from "./main/components/Banner";
import SearchInputWrapper from "./main/components/SearchInputWrapper";
import TodayDrinkRecommendation from "./main/components/TodayDrinkRecommendation";
import dynamic from "next/dynamic";

const DynamicHotDrinkVoteContainer = dynamic(
Expand All @@ -23,14 +20,22 @@ const DynamicHotDrinkContainer = dynamic(() => import("./main/components/HotDrin
),
});

const DynamicTodayDrinkRecommendation = dynamic(
() => import("./main/components/TodayDrinkRecommendation"),
);

const DynamicSearchInputWrapper = dynamic(() => import("./main/components/SearchInputWrapper"));

const DynamicBanner = dynamic(() => import("./main/components/Banner"));

function MainPage() {
return (
<>
<Header />
<TodayDrinkRecommendation />
<DynamicTodayDrinkRecommendation />
<TopSection>
<Banner />
<SearchInputWrapper />
<DynamicBanner />
<DynamicSearchInputWrapper />
<DynamicHotDrinkContainer />
</TopSection>
<DivideLine />
Expand Down
18 changes: 10 additions & 8 deletions apps/jurumarble/src/app/vote/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@
import styled, { css } from "styled-components";
import VoteWriterBox from "./components/VoteWriterBox";
import { DrinkCapacityHigh, DrinkCapacityLow, DrinkCapacityMedium } from "public/images";
import VoteDescription from "./components/VoteDescription";
import ChipContainer from "./components/ChipContainer";
import CommentContainer from "./components/CommentContainer";
import { useParams } from "next/navigation";
import useVoteLoadService from "./services/useVoteLoadService";
import useExecuteVoteService from "./services/useExecuteVoteService";
import useFilteredStatisticsService from "./services/useFilterStatisticsService";
import VoteAnalyzeBar from "./components/VoteAnalyzeBar";
import { useMemo, useState } from "react";
import useBookmarkService from "services/useBookmarkService";
import Loading from "components/Loading";
Expand All @@ -21,6 +17,12 @@ import {
VOTE_MBTI_LIST,
} from "lib/constants";
import VoteSmallSelectFilter from "./components/VoteSmallSelectFilter";
import dynamic from "next/dynamic";

const DynamicChipContainer = dynamic(() => import("./components/ChipContainer"));
const DynamicVoteDescription = dynamic(() => import("./components/VoteDescription"));
const DynamicCommentContainer = dynamic(() => import("./components/CommentContainer"));
const DynamicVoteAnalyzeBar = dynamic(() => import("./components/VoteAnalyzeBar"));

function Detail() {
const params = useParams();
Expand Down Expand Up @@ -117,7 +119,7 @@ function Detail() {
}}
/>
<PageInner>
<ChipContainer
<DynamicChipContainer
voteId={Number(data.voteId)}
title={title}
date={String(createdAt)}
Expand All @@ -127,7 +129,7 @@ function Detail() {
isBookmark={isBookmark}
postedUserId={data.postedUserId}
/>
<VoteDescription
<DynamicVoteDescription
imageA={imageA}
imageB={imageB}
percentageA={originalPercentageA}
Expand All @@ -144,7 +146,7 @@ function Detail() {
/>
{!!select.choice && (
<>
<VoteAnalyzeBar
<DynamicVoteAnalyzeBar
totalCountA={totalCountA}
totalCountB={totalCountB}
percentageA={percentageA}
Expand Down Expand Up @@ -177,7 +179,7 @@ function Detail() {
</>
)}

<CommentContainer postId={Number(postId)} />
<DynamicCommentContainer postId={Number(postId)} />
</PageInner>
</Container>
);
Expand Down

0 comments on commit 7058ed0

Please sign in to comment.