From cdc3fe3325fc2cb17ce4b8067e1e53b0cf319c77 Mon Sep 17 00:00:00 2001 From: Mathias Oterhals Myklebust <24361490+mathiazom@users.noreply.github.com> Date: Thu, 10 Oct 2024 09:25:54 +0000 Subject: [PATCH] feat: remove unused nested page route (#749) --- src/app/(main)/[lang]/[slug]/[id]/page.tsx | 59 ---------------------- 1 file changed, 59 deletions(-) delete mode 100644 src/app/(main)/[lang]/[slug]/[id]/page.tsx diff --git a/src/app/(main)/[lang]/[slug]/[id]/page.tsx b/src/app/(main)/[lang]/[slug]/[id]/page.tsx deleted file mode 100644 index 4d8434130..000000000 --- a/src/app/(main)/[lang]/[slug]/[id]/page.tsx +++ /dev/null @@ -1,59 +0,0 @@ -import { loadQuery } from "@sanity/react-loader"; -import { Metadata } from "next"; - -import PostPage from "src/post/PostPage"; -import PostPagePreview from "src/post/PostPagePreview"; -import { getDraftModeInfo } from "src/utils/draftmode"; -import { fetchPostSeoData, generateMetadataFromSeo } from "src/utils/seo"; -import { BlogPage, Post } from "studio/lib/interfaces/pages"; -import { - BLOG_PAGE_QUERY, - MORE_POST_PREVIEW, - POST_SLUG_QUERY, - SEO_POST_SLUG_QUERY, -} from "studio/lib/queries/pages"; - -type Props = { - params: { - id: string; - slug: string; - }; -}; - -export async function generateMetadata({ params }: Props): Promise { - const seo = await fetchPostSeoData(SEO_POST_SLUG_QUERY, { id: params.id }); - return generateMetadataFromSeo(seo); -} - -const NestedSlugPage = async ({ params }: Props) => { - const { id, slug } = params; - const { perspective, isDraftMode } = getDraftModeInfo(); - - const [initialPost, initialBlogPage, initialPosts] = await Promise.all([ - loadQuery(POST_SLUG_QUERY, { id }, { perspective }), - loadQuery(BLOG_PAGE_QUERY, { slug }, { perspective }), - loadQuery(MORE_POST_PREVIEW, {}, { perspective }), - ]); - - if (isDraftMode) { - return ( - - ); - } - return ( - - ); -}; - -export default NestedSlugPage;