Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 1 addition & 3 deletions components/common/comment/CommentUserInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ export default function CommentUserInfo({ className }: { className?: string }) {
</p>
) : (
// TODO: ์ถ”ํ›„ ์„œ๋ฒ„ ์ˆ˜์ •๋˜๋ฉด ์ต๋ช…ํšŒ์› ID๋ฅผ ๋ณด์—ฌ์ฃผ๋Š” ๋ฌธ๊ตฌ ์ถ”๊ฐ€
<p>
<span className='text-secondary500 font-bold'>์ต๋ช…์˜ ๋Œ‘๋Œ‘์ด</span>๋‹˜ ์˜๊ฒฌ์„ ๋‚จ๊ฒจ์ฃผ์„ธ์š”!
</p>
<></>
)}
</section>
);
Expand Down
37 changes: 12 additions & 25 deletions pages/_app.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ import { QueryClient, QueryClientProvider, HydrationBoundary } from '@tanstack/r
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';

import Layout from '@components/common/layout';
import MetaHead from '@components/meta/MetaHead';

import useSetAxiosConfig from '@/api/useSetAxiosConfig';
import { DAY, HALF_DAY } from '@/constants/TimeConstants';
import { META } from '@/constants/metaData';
import { MediaQueryProvider } from '@/contexts/MediaQueryContext';
import '@/styles/globals.css';

Expand Down Expand Up @@ -56,29 +54,18 @@ export default function MyApp({ Component, pageProps }: AppProps) {
};
}, [router.events]);

const meta = pageProps.meta || META.MAIN;

return (
<>
<MetaHead
title={meta.title}
description={meta.description}
keyword={meta.keyword}
url={meta.url}
image={meta.image}
/>
<QueryClientProvider client={queryClient}>
<HydrationBoundary state={pageProps.dehydratedState}>
<ThemeProvider enableSystem={false} attribute='class'>
<MediaQueryProvider>
<Layout>
<Component {...pageProps} />
</Layout>
</MediaQueryProvider>
</ThemeProvider>
</HydrationBoundary>
<ReactQueryDevtools initialIsOpen={false} />
</QueryClientProvider>
</>
<QueryClientProvider client={queryClient}>
<HydrationBoundary state={pageProps.dehydratedState}>
<ThemeProvider enableSystem={false} attribute='class'>
<MediaQueryProvider>
<Layout>
<Component {...pageProps} />
</Layout>
</MediaQueryProvider>
</ThemeProvider>
</HydrationBoundary>
<ReactQueryDevtools initialIsOpen={false} />
</QueryClientProvider>
);
}
107 changes: 51 additions & 56 deletions pages/main/index.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import DevGuriError from '@components/common/error/DevGuriError';
import ArrowWithTitle from '@components/common/title/ArrowWithTitle';
import MainTechBlogSection from '@components/features/main/MainTechBlogSection';
import MainCardComponent from '@components/features/main/mainCard/MainCardComponent';
import MetaHead from '@components/meta/MetaHead';

import DevLogo from '@public/image/devdevdevLogo.svg';

import { META } from '@/constants/metaData';
import { useMediaQueryContext } from '@/contexts/MediaQueryContext';

const DynamicPickComponent = dynamic(
Expand Down Expand Up @@ -39,63 +39,58 @@ export default function Index() {
};

return (
<div
className={`w-full h-full ${isMobile ? 'px-[1.6rem] py-[2.4rem]' : 'px-[20.3rem] py-[6.4rem]'} `}
>
<MainPageLogo />
<>
<MetaHead />
<div
className={`w-full h-full ${isMobile ? 'px-[1.6rem] py-[2.4rem]' : 'px-[20.3rem] py-[6.4rem]'} `}
>
<MainPageLogo />

<div className={`grid ${isMobile ? 'grid-cols-1 gap-[9.6rem]' : 'grid-rows-2'}`}>
<section
className={`${MainSectionStyle.base} ${isMobile ? MainSectionStyle.mobile : MainSectionStyle.desktop}`}
>
<MainCardComponent path={PICK_PATH} />
<div className='relative'>
<ArrowWithTitle
title='๋”ฐ๋ˆ๋”ฐ๋ˆ! ์ตœ์‹  ํ”ฝํ”ฝํ”ฝ'
variant='mainTitle'
iconText='๋ฐ”๋กœ๊ฐ€๊ธฐ'
routeURL={PICK_PATH}
className='pb-[2.45rem]'
/>
<QueryErrorBoundary
fallbackRender={({ handleRetryClick }) => (
<DevGuriError type='network' handleRetryClick={handleRetryClick} />
)}
>
<DynamicPickComponent />
</QueryErrorBoundary>
</div>
</section>
<div className={`grid ${isMobile ? 'grid-cols-1 gap-[9.6rem]' : 'grid-rows-2'}`}>
<section
className={`${MainSectionStyle.base} ${isMobile ? MainSectionStyle.mobile : MainSectionStyle.desktop}`}
>
<MainCardComponent path={PICK_PATH} />
<div className='relative'>
<ArrowWithTitle
title='๋”ฐ๋ˆ๋”ฐ๋ˆ! ์ตœ์‹  ํ”ฝํ”ฝํ”ฝ'
variant='mainTitle'
iconText='๋ฐ”๋กœ๊ฐ€๊ธฐ'
routeURL={PICK_PATH}
className='pb-[2.45rem]'
/>
<QueryErrorBoundary
fallbackRender={({ handleRetryClick }) => (
<DevGuriError type='network' handleRetryClick={handleRetryClick} />
)}
>
<DynamicPickComponent />
</QueryErrorBoundary>
</div>
</section>

<section
className={`${MainSectionStyle.base} ${isMobile ? MainSectionStyle.mobile : MainSectionStyle.desktop}`}
>
<MainCardComponent path={TECH_PATH} />
<div className='relative'>
<ArrowWithTitle
title='๋”ฐ๋ˆ๋”ฐ๋ˆ! ์ตœ์‹  ์•„ํ‹ฐํด'
variant='mainTitle'
iconText='๋ฐ”๋กœ๊ฐ€๊ธฐ'
routeURL={TECH_PATH}
/>
<QueryErrorBoundary
fallbackRender={({ handleRetryClick }) => (
<DevGuriError type='network' handleRetryClick={handleRetryClick} />
)}
>
<MainTechBlogSection />
</QueryErrorBoundary>
</div>
</section>
<section
className={`${MainSectionStyle.base} ${isMobile ? MainSectionStyle.mobile : MainSectionStyle.desktop}`}
>
<MainCardComponent path={TECH_PATH} />
<div className='relative'>
<ArrowWithTitle
title='๋”ฐ๋ˆ๋”ฐ๋ˆ! ์ตœ์‹  ์•„ํ‹ฐํด'
variant='mainTitle'
iconText='๋ฐ”๋กœ๊ฐ€๊ธฐ'
routeURL={TECH_PATH}
/>
<QueryErrorBoundary
fallbackRender={({ handleRetryClick }) => (
<DevGuriError type='network' handleRetryClick={handleRetryClick} />
)}
>
<MainTechBlogSection />
</QueryErrorBoundary>
</div>
</section>
</div>
</div>
</div>
</>
);
}

export function getStaticProps() {
return {
props: {
meta: META.MAIN,
},
};
}
110 changes: 54 additions & 56 deletions pages/pickpickpick/index.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { Dropdown } from '@components/common/dropdowns/dropdown';
import MobileDropdown from '@components/common/dropdowns/mobileDropdown';
import { LoginModal } from '@components/common/modals/modal';
import { MobilePickSkeletonList, PickSkeletonList } from '@components/common/skeleton/pickSkeleton';
import MetaHead from '@components/meta/MetaHead';

import IconPencil from '@public/image/pencil-alt.svg';

Expand All @@ -41,6 +42,8 @@ export default function Index() {

const { isMobile } = useMediaQueryContext();

const { title, description, keyword, url } = META.PICK;

const { pickData, isFetchingNextPage, hasNextPage, status, onIntersect } = useInfinitePickData(
sortOption as PickDropdownProps,
);
Expand Down Expand Up @@ -102,68 +105,63 @@ export default function Index() {
};

return (
<div className={`${isMobile ? 'px-[1.6rem]' : 'pt-24 px-[20.3rem]'} pb-[11.2rem] w-full`}>
<div className='flex justify-between items-baseline'>
<h1
className={`font-bold text-white ${isMobile ? 'st1 px-[2.4rem]' : 'h3 mb-16'}`}
data-testid='pickheart'
>
ํ”ฝํ”ฝํ”ฝ ๐Ÿ’˜
</h1>

{!isMobile && (
<div className='flex items-baseline gap-[2rem]'>
<Dropdown type='pickpickpick' />

{loginStatus === 'login' ? (
<Link href={POSTING}>
<>
<MetaHead title={title} description={description} keyword={keyword} url={url} />
<div className={`${isMobile ? 'px-[1.6rem]' : 'pt-24 px-[20.3rem]'} pb-[11.2rem] w-full`}>
<div className='flex justify-between items-baseline'>
<h1
className={`font-bold text-white ${isMobile ? 'st1 px-[2.4rem]' : 'h3 mb-16'}`}
data-testid='pickheart'
>
ํ”ฝํ”ฝํ”ฝ ๐Ÿ’˜
</h1>

{!isMobile && (
<div className='flex items-baseline gap-[2rem]'>
<Dropdown type='pickpickpick' />

{loginStatus === 'login' ? (
<Link href={POSTING}>
<MainButton
text='์ž‘์„ฑํ•˜๊ธฐ'
variant='primary'
icon={<Image src={IconPencil} alt='์—ฐํ•„ ์•„์ด์ฝ˜' />}
type='button'
/>
</Link>
) : (
<MainButton
text='์ž‘์„ฑํ•˜๊ธฐ'
variant='primary'
icon={<Image src={IconPencil} alt='์—ฐํ•„ ์•„์ด์ฝ˜' />}
onClick={() => {
openLoginModal();
setDescription('๋Œ‘๋Œ‘์ด๊ฐ€ ๋˜๋ฉด ํ”ฝํ”ฝํ”ฝ์„ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ์–ด์š” ๐Ÿฅณ');
}}
type='button'
/>
</Link>
) : (
<MainButton
text='์ž‘์„ฑํ•˜๊ธฐ'
variant='primary'
icon={<Image src={IconPencil} alt='์—ฐํ•„ ์•„์ด์ฝ˜' />}
onClick={() => {
openLoginModal();
setDescription('๋Œ‘๋Œ‘์ด๊ฐ€ ๋˜๋ฉด ํ”ฝํ”ฝํ”ฝ์„ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ์–ด์š” ๐Ÿฅณ');
}}
type='button'
/>
)}
</div>
)}
)}
</div>
)}
</div>
{getStatusComponent()}
<div ref={bottom} />
{isMobile &&
(loginStatus === 'login' ? (
<Link href={POSTING}>
<MobileMainButton text='์ž‘์„ฑํ•˜๊ธฐ' />
</Link>
) : (
<MobileMainButton
text='์ž‘์„ฑํ•˜๊ธฐ'
onClick={() => {
openLoginModal();
setDescription('๋Œ‘๋Œ‘์ด๊ฐ€ ๋˜๋ฉด ํ”ฝํ”ฝํ”ฝ์„ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ์–ด์š” ๐Ÿฅณ');
}}
/>
))}
{isLoginModalOpen && loginStatus !== 'login' && <LoginModal />}
</div>
{getStatusComponent()}
<div ref={bottom} />
{isMobile &&
(loginStatus === 'login' ? (
<Link href={POSTING}>
<MobileMainButton text='์ž‘์„ฑํ•˜๊ธฐ' />
</Link>
) : (
<MobileMainButton
text='์ž‘์„ฑํ•˜๊ธฐ'
onClick={() => {
openLoginModal();
setDescription('๋Œ‘๋Œ‘์ด๊ฐ€ ๋˜๋ฉด ํ”ฝํ”ฝํ”ฝ์„ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ์–ด์š” ๐Ÿฅณ');
}}
/>
))}
{isLoginModalOpen && loginStatus !== 'login' && <LoginModal />}
</div>
</>
);
}

export function getStaticProps() {
return {
props: {
meta: META.PICK,
},
};
}
41 changes: 1 addition & 40 deletions pages/techblog/[id]/index.page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import React from 'react';

import { GetServerSidePropsContext } from 'next';
import { useRouter } from 'next/router';

import { QueryClient, dehydrate } from '@tanstack/react-query';

import DevLoadingComponent from '@pages/loading/index.page';

import { useLoginStatusStore } from '@stores/loginStore';
Expand All @@ -20,49 +17,13 @@ import { LoginModal } from '@components/common/modals/modal';
import { ROUTES } from '@/constants/routes';
import { useMediaQueryContext } from '@/contexts/MediaQueryContext';

import { getDetailTechBlog, useGetDetailTechBlog } from '../api/useGetTechBlogDetail';
import { useGetDetailTechBlog } from '../api/useGetTechBlogDetail';
import { usePostMainComment } from '../api/usePostComment';
import CommentTechSection from '../components/CommentTechSection';
import CompanyInfoCard from '../components/CompanyInfoCard';
import TechDetailCard from '../components/TechDetailCard';
import { TechCardProps } from '../types/techBlogType';

export async function getServerSideProps(context: GetServerSidePropsContext) {
const id = context.params?.id;

if (!id || typeof id !== 'string') {
return {
notFound: true,
};
}

const queryClient = new QueryClient();

try {
const postData = await getDetailTechBlog(id);
const post = postData.data;

await queryClient.setQueryData(['techDetail', id], postData);

const meta = {
title: post.title,
description: post.contents.substring(0, 150) + '...',
};

return {
props: {
dehydratedState: dehydrate(queryClient),
meta: meta,
},
};
} catch (error) {
console.error(`Error fetching post data for id: ${id}`, error);
return {
notFound: true,
};
}
}

export default function Page() {
const router = useRouter();
const techArticleId = router.query.id as string | undefined;
Expand Down
Loading