From 536fce72a66884d0797afcc0e74ffa889928aa14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=87=E1=85=A9=E1=84=80?= =?UTF-8?q?=E1=85=A7=E1=86=BC?= Date: Thu, 12 Dec 2024 23:02:32 +0900 Subject: [PATCH 1/2] =?UTF-8?q?Feat:=20=EC=95=85=EC=84=B1=EB=B4=87=20redir?= =?UTF-8?q?ects=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- next.config.mjs | 243 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 232 insertions(+), 11 deletions(-) diff --git a/next.config.mjs b/next.config.mjs index cd1aa1a7..f9c48da9 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -20,17 +20,13 @@ const nextConfig = { }, webpack(config) { - // Grab the existing rule that handles SVG imports const fileLoaderRule = config.module.rules.find((rule) => rule.test?.test?.('.svg')); - config.module.rules.push( - // Reapply the existing rule, but only for svg imports ending in ?url { ...fileLoaderRule, test: /\.svg$/i, - resourceQuery: /url/, // *.svg?url + resourceQuery: /url/, }, - // Convert all other *.svg imports to React components { test: /\.svg$/i, issuer: fileLoaderRule.issuer, @@ -56,10 +52,7 @@ const nextConfig = { ], }, ); - - // Modify the file loader rule to ignore *.svg, since we have it handled now. fileLoaderRule.exclude = /\.svg$/i; - config.module.rules.push({ test: /\.(woff|woff2|eot|ttf|otf)$/i, type: 'asset/resource', @@ -67,16 +60,244 @@ const nextConfig = { filename: 'static/fonts/[name][ext]', }, }); - return config; }, - sassOptions: { includePaths: ['styles'], additionalData: `@import "src/styles/_globals.scss";`, }, - transpilePackages: ['three'], + + async redirects() { + return [ + { + source: '/(.*)', + has: [ + { + type: 'header', + key: 'User-Agent', + value: '(.*MJ12bot.*)', + }, + ], + destination: '/401', + permanent: false, + }, + { + source: '/(.*)', + has: [ + { + type: 'header', + key: 'User-Agent', + value: '(.*Amazonbot.*)', + }, + ], + destination: '/401', + permanent: false, + }, + { + source: '/(.*)', + has: [ + { + type: 'header', + key: 'User-Agent', + value: '(.*ClaudeBot.*)', + }, + ], + destination: '/401', + permanent: false, + }, + { + source: '/(.*)', + has: [ + { + type: 'header', + key: 'User-Agent', + value: '(.*DotBot.*)', + }, + ], + destination: '/401', + permanent: false, + }, + { + source: '/(.*)', + has: [ + { + type: 'header', + key: 'User-Agent', + value: '(.*Linkbot.*)', + }, + ], + destination: '/401', + permanent: false, + }, + { + source: '/(.*)', + has: [ + { + type: 'header', + key: 'User-Agent', + value: '(.*Iframely.*)', + }, + ], + destination: '/401', + permanent: false, + }, + { + source: '/(.*)', + has: [ + { + type: 'header', + key: 'User-Agent', + value: '(.*AhrefsBot.*)', + }, + ], + destination: '/401', + permanent: false, + }, + { + source: '/(.*)', + has: [ + { + type: 'header', + key: 'User-Agent', + value: '(.*PetalBot.*)', + }, + ], + destination: '/401', + permanent: false, + }, + { + source: '/(.*)', + has: [ + { + type: 'header', + key: 'User-Agent', + value: '(.*BLEXBot.*)', + }, + ], + destination: '/401', + permanent: false, + }, + { + source: '/(.*)', + has: [ + { + type: 'header', + key: 'User-Agent', + value: '(.*woorankreview.*)', + }, + ], + destination: '/401', + permanent: false, + }, + { + source: '/(.*)', + has: [ + { + type: 'header', + key: 'User-Agent', + value: '(.*Barkrowler.*)', + }, + ], + destination: '/401', + permanent: false, + }, + { + source: '/(.*)', + has: [ + { + type: 'header', + key: 'User-Agent', + value: '(.*Neevabot.*)', + }, + ], + destination: '/401', + permanent: false, + }, + { + source: '/(.*)', + has: [ + { + type: 'header', + key: 'User-Agent', + value: '(.*SeoSiteCheckup.*)', + }, + ], + destination: '/401', + permanent: false, + }, + { + source: '/(.*)', + has: [ + { + type: 'header', + key: 'User-Agent', + value: '(.*SemrushBot.*)', + }, + ], + destination: '/401', + permanent: false, + }, + { + source: '/(.*)', + has: [ + { + type: 'header', + key: 'User-Agent', + value: '(.*RSiteAuditor.*)', + }, + ], + destination: '/401', + permanent: false, + }, + { + source: '/(.*)', + has: [ + { + type: 'header', + key: 'User-Agent', + value: '(.*YandexBot.*)', + }, + ], + destination: '/401', + permanent: false, + }, + { + source: '/(.*)', + has: [ + { + type: 'header', + key: 'User-Agent', + value: '(.*GrapeshotCrawler.*)', + }, + ], + destination: '/401', + permanent: false, + }, + { + source: '/(.*)', + has: [ + { + type: 'header', + key: 'User-Agent', + value: '(.*proximic.*)', + }, + ], + destination: '/401', + permanent: false, + }, + { + source: '/wordpress', + destination: '/401', + permanent: true, + }, + { + source: '/wp-login.php', + destination: '/401', + permanent: true, + }, + ]; + }, }; export default nextConfig; From 7024480609fe1e0c255691b556b71cd825d45d5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=87=E1=85=A9=E1=84=80?= =?UTF-8?q?=E1=85=A7=E1=86=BC?= Date: Thu, 12 Dec 2024 23:09:28 +0900 Subject: [PATCH 2/2] =?UTF-8?q?Fix:=20shop=20=ED=8E=98=EC=9D=B4=EC=A7=80?= =?UTF-8?q?=20=EC=A0=95=EC=83=81=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/shop/layout.tsx | 32 ++++++-------- src/app/shop/page.tsx | 76 +++++++++++++++----------------- src/components/Header/Header.tsx | 4 +- 3 files changed, 52 insertions(+), 60 deletions(-) diff --git a/src/app/shop/layout.tsx b/src/app/shop/layout.tsx index 1e5525e9..91bb07d3 100644 --- a/src/app/shop/layout.tsx +++ b/src/app/shop/layout.tsx @@ -1,22 +1,18 @@ -// import { ReactNode } from 'react'; +import { ReactNode } from 'react'; -// import Breadcrumb from '@/components/Breadcrumb/Breadcrumb'; +import Breadcrumb from '@/components/Breadcrumb/Breadcrumb'; -// interface ShopLayoutProps { -// children: ReactNode; -// } - -// export default function ShopLayout({ children }: ShopLayoutProps) { -// return ( -//
-//
-// -// {children} -//
-//
-// ); -// } +interface ShopLayoutProps { + children: ReactNode; +} -export default function ShopLayout() { - return null; +export default function ShopLayout({ children }: ShopLayoutProps) { + return ( +
+
+ + {children} +
+
+ ); } diff --git a/src/app/shop/page.tsx b/src/app/shop/page.tsx index 43eec198..0c31071f 100644 --- a/src/app/shop/page.tsx +++ b/src/app/shop/page.tsx @@ -1,46 +1,42 @@ -// import { getAllProductList } from '@/api/productAPI'; -// import Pagination from '@/components/Pagination/Pagination'; -// import type { ProductParams } from '@/types/productItemType'; -// import classNames from 'classnames/bind'; -// import CategoryMenu from './_components/Category/CategoryMenu'; -// import CategoryTitle from './_components/Category/CategoryTitle'; -// import ProductList from './_components/Product/ProductList'; -// import Sort from './_components/Sort/Sort'; -// import styles from './page.module.scss'; +import { getAllProductList } from '@/api/productAPI'; +import Pagination from '@/components/Pagination/Pagination'; +import type { ProductParams } from '@/types/productItemType'; +import classNames from 'classnames/bind'; +import CategoryMenu from './_components/Category/CategoryMenu'; +import CategoryTitle from './_components/Category/CategoryTitle'; +import ProductList from './_components/Product/ProductList'; +import Sort from './_components/Sort/Sort'; +import styles from './page.module.scss'; -// const cn = classNames.bind(styles); +const cn = classNames.bind(styles); -// interface ShopAllPageProps { -// searchParams: { [key: string]: string | string[] | undefined }; -// } - -// export default async function ShopAllPage({ searchParams }: ShopAllPageProps) { -// const sortParam = Array.isArray(searchParams.sort) ? searchParams.sort[0] : searchParams.sort || 'createdAt_desc'; -// const pageParam = Array.isArray(searchParams.page) ? searchParams.page[0] : searchParams.page || '0'; +interface ShopAllPageProps { + searchParams: { [key: string]: string | string[] | undefined }; +} -// const getAllProductParams: ProductParams = { -// sort: sortParam as string, -// page: pageParam as string, -// size: '16', -// }; +export default async function ShopAllPage({ searchParams }: ShopAllPageProps) { + const sortParam = Array.isArray(searchParams.sort) ? searchParams.sort[0] : searchParams.sort || 'createdAt_desc'; + const pageParam = Array.isArray(searchParams.page) ? searchParams.page[0] : searchParams.page || '0'; -// const { data } = await getAllProductList(getAllProductParams); -// const { content, ...rest } = data; -// return ( -// <> -//
-// 전체상품 -// -//
-// -//
-// -// -//
-// -// ); -// } + const getAllProductParams: ProductParams = { + sort: sortParam as string, + page: pageParam as string, + size: '16', + }; -export default async function ShopAllPage() { - return null; + const { data } = await getAllProductList(getAllProductParams); + const { content, ...rest } = data; + return ( + <> +
+ 전체상품 + +
+ +
+ + +
+ + ); } diff --git a/src/components/Header/Header.tsx b/src/components/Header/Header.tsx index a1f685f8..f4423c26 100644 --- a/src/components/Header/Header.tsx +++ b/src/components/Header/Header.tsx @@ -15,7 +15,7 @@ import { deleteCookie } from '@/utils/manageCookie'; import { useUser } from '@/hooks/useUser'; import { LogoIcon, UserIcon } from '@/public/index'; import type { CartAPIDataType } from '@/types/cartType'; -import { CartButton, LoginButton, LogoutButton, NotificationButton, SearchButton } from './HeaderParts'; +import { CartButton, LoginButton, LogoutButton, NotificationButton, SearchButton, ShopButton } from './HeaderParts'; import styles from './Header.module.scss'; @@ -103,7 +103,7 @@ export default function Header() { > 커스텀 키보드 만들기 - {/* */} + 커뮤니티