From 55a4f46db9e2a35d5062b752d6cd7b35b91ad65d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=95=88=ED=9D=AC=EC=9B=90?= Date: Tue, 19 Mar 2024 16:03:09 +0900 Subject: [PATCH 1/5] =?UTF-8?q?=F0=9F=90=9B=20bug:=20=EB=8F=99=EC=A0=81=20?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20=EB=A9=94=ED=83=80=ED=83=9C?= =?UTF-8?q?=EA=B7=B8=20=EC=A0=81=EC=9A=A9=20=EC=95=88=EB=90=98=EB=8A=94=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/(route)/artist/[artistId]/page.tsx | 9 +++++++-- app/_components/MetaTag.tsx | 9 +++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/(route)/artist/[artistId]/page.tsx b/app/(route)/artist/[artistId]/page.tsx index 22fed3f5..1ce4462a 100644 --- a/app/(route)/artist/[artistId]/page.tsx +++ b/app/(route)/artist/[artistId]/page.tsx @@ -27,8 +27,13 @@ const ArtistIdPage = () => { const group = getGroup(instance, artistId); const artist = getArtist(instance, artistId); - const name = group.groupName || artist.artistName; - const image = group.groupImage || artist.artistImage; + const [name, setName] = useState(""); + const [image, setImage] = useState(""); + + useEffect(() => { + setName(group.groupName || artist.artistName); + setImage(group.groupImage || artist.artistImage); + }, [group, artist]); const [sort, setSort] = useState(SORT[0]); const [status, setStatus] = useState(3); diff --git a/app/_components/MetaTag.tsx b/app/_components/MetaTag.tsx index 1d8613d7..8cbc0039 100644 --- a/app/_components/MetaTag.tsx +++ b/app/_components/MetaTag.tsx @@ -29,6 +29,15 @@ const MetaTag = ({ title, description, imgUrl }: Props) => { + + + ); }; From 846cce1a47a2fd578cecfbcd102ca9264e46b855 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=95=88=ED=9D=AC=EC=9B=90?= Date: Tue, 19 Mar 2024 22:27:03 +0900 Subject: [PATCH 2/5] =?UTF-8?q?=E2=9C=A8=20feat:=20robots=20=ED=83=9C?= =?UTF-8?q?=EA=B7=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/_components/MetaTag.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/_components/MetaTag.tsx b/app/_components/MetaTag.tsx index 8cbc0039..fdb7c631 100644 --- a/app/_components/MetaTag.tsx +++ b/app/_components/MetaTag.tsx @@ -2,9 +2,10 @@ interface Props { title?: string; description?: string; imgUrl?: string; + noFollow?: boolean; } -const MetaTag = ({ title, description, imgUrl }: Props) => { +const MetaTag = ({ title, description, imgUrl, noFollow = false }: Props) => { return ( <> {title ? `${title} | Opener` : "Opener"} @@ -29,6 +30,7 @@ const MetaTag = ({ title, description, imgUrl }: Props) => { + Date: Tue, 19 Mar 2024 22:49:15 +0900 Subject: [PATCH 3/5] =?UTF-8?q?=E2=9C=A8=20feat:=20Head=20=ED=83=9C?= =?UTF-8?q?=EA=B7=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/(route)/admin/page.tsx | 2 +- app/(route)/search/page.tsx | 1 - app/_components/MetaTag.tsx | 6 ++++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/(route)/admin/page.tsx b/app/(route)/admin/page.tsx index 2fc575ee..d47048e7 100644 --- a/app/(route)/admin/page.tsx +++ b/app/(route)/admin/page.tsx @@ -46,7 +46,7 @@ const Admin = () => { return ( <> - + {isAdminLogin && (
{isAuth ? ( diff --git a/app/(route)/search/page.tsx b/app/(route)/search/page.tsx index 3198b1bc..21dc0853 100644 --- a/app/(route)/search/page.tsx +++ b/app/(route)/search/page.tsx @@ -21,7 +21,6 @@ const SearchPage = () => {
diff --git a/app/_components/MetaTag.tsx b/app/_components/MetaTag.tsx index fdb7c631..344c19eb 100644 --- a/app/_components/MetaTag.tsx +++ b/app/_components/MetaTag.tsx @@ -1,3 +1,5 @@ +import Head from "next/head"; + interface Props { title?: string; description?: string; @@ -7,7 +9,7 @@ interface Props { const MetaTag = ({ title, description, imgUrl, noFollow = false }: Props) => { return ( - <> + {title ? `${title} | Opener` : "Opener"} { } /> - + ); }; From f805c4f0a3f928698dffbbc7a1c62d4f87d1f5b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=95=88=ED=9D=AC=EC=9B=90?= Date: Tue, 2 Apr 2024 16:20:41 +0900 Subject: [PATCH 4/5] =?UTF-8?q?=E2=9C=A8=20feat:=20=EC=95=84=ED=8B=B0?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EB=A9=94?= =?UTF-8?q?=ED=83=80=ED=83=9C=EA=B7=B8=20SSR=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/(route)/artist/[artistId]/layout.tsx | 35 ++++++++++++++++++++++++ app/(route)/artist/[artistId]/page.tsx | 2 -- app/(route)/search/layout.tsx | 24 ++++++++++++++++ app/_components/MetaTag.tsx | 6 ++-- 4 files changed, 61 insertions(+), 6 deletions(-) create mode 100644 app/(route)/artist/[artistId]/layout.tsx create mode 100644 app/(route)/search/layout.tsx diff --git a/app/(route)/artist/[artistId]/layout.tsx b/app/(route)/artist/[artistId]/layout.tsx new file mode 100644 index 00000000..172db281 --- /dev/null +++ b/app/(route)/artist/[artistId]/layout.tsx @@ -0,0 +1,35 @@ +import { ReactNode } from "react"; +import { getArtist, getGroup } from "@/utils/getArtist"; +import MetaTag from "@/components/MetaTag"; + +interface Props { + children: ReactNode; + params: { artistId: string }; +} + +const getArtistName = async (artistId: string) => { + let res; + try { + const groupData = await fetch(`https://${process.env.NEXT_PUBLIC_BASE_URL}/group?groupId=${artistId}`); + res = await groupData.json(); + if(res.message) throw Error(); + return res; + } catch(err){ + const artistData = await fetch(`https://${process.env.NEXT_PUBLIC_BASE_URL}/artist?artists=${artistId}`); + res = await artistData.json(); + return res[0]; + } +}; + +const layout = async ({ children, params }: Props) => { + const res = await getArtistName(params.artistId); + + return ( + <> + + {children} + + ); +}; + +export default layout; diff --git a/app/(route)/artist/[artistId]/page.tsx b/app/(route)/artist/[artistId]/page.tsx index d76c1381..f28fe855 100644 --- a/app/(route)/artist/[artistId]/page.tsx +++ b/app/(route)/artist/[artistId]/page.tsx @@ -6,7 +6,6 @@ import Image from "next/image"; import { useParams } from "next/navigation"; import { useEffect, useState } from "react"; import KakaoMap from "@/components/KakaoMap"; -import MetaTag from "@/components/MetaTag"; import TimeFilter from "@/components/TimeFilter"; import DottedLayout from "@/components/layout/DottedLayout"; import { instance } from "@/api/api"; @@ -67,7 +66,6 @@ const ArtistIdPage = () => { return ( <> -
{ + console.log(keyword); + return <>{children}; +}; + +export default layout; diff --git a/app/_components/MetaTag.tsx b/app/_components/MetaTag.tsx index 344c19eb..fdb7c631 100644 --- a/app/_components/MetaTag.tsx +++ b/app/_components/MetaTag.tsx @@ -1,5 +1,3 @@ -import Head from "next/head"; - interface Props { title?: string; description?: string; @@ -9,7 +7,7 @@ interface Props { const MetaTag = ({ title, description, imgUrl, noFollow = false }: Props) => { return ( - + <> {title ? `${title} | Opener` : "Opener"} { } /> - + ); }; From d16115ac5d8485e5eb26f9539ab2bce215488ba2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=95=88=ED=9D=AC=EC=9B=90?= Date: Thu, 4 Apr 2024 23:30:35 +0900 Subject: [PATCH 5/5] =?UTF-8?q?=F0=9F=A9=B9=20chore:=20search=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20layout=20=ED=8C=8C=EC=9D=BC=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/(route)/search/layout.tsx | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 app/(route)/search/layout.tsx diff --git a/app/(route)/search/layout.tsx b/app/(route)/search/layout.tsx deleted file mode 100644 index 43647aa2..00000000 --- a/app/(route)/search/layout.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { Metadata } from "next"; -import { ReactNode } from "react"; - -interface Props { - searchParams: any; -} - -export async function getKeyword(context: any) { - const { query } = context; // context 객체에서 쿼리 파라미터를 가져옴 - const keyword = query.keyword; // URL의 id 쿼리 파라미터 - - // 데이터를 가져오거나 다른 작업을 수행할 수 있음 - // 예: const data = await fetchData(id); - - // props로 데이터를 전달 - return keyword; -} - -const layout = ({ children, keyword }: { children: ReactNode; keyword: any }) => { - console.log(keyword); - return <>{children}; -}; - -export default layout;