diff --git a/app/[lang]/(live)/current-content-page/page.tsx b/app/[lang]/(live)/current-content-page/page.tsx
index 71feae069..2585f6982 100644
--- a/app/[lang]/(live)/current-content-page/page.tsx
+++ b/app/[lang]/(live)/current-content-page/page.tsx
@@ -3,13 +3,7 @@ import { notFound } from "next/navigation"
import { request } from "@/lib/request";
import { GetCurrentBlockPage } from "@/lib/graphql/Query/CurrentBlockPage.graphql";
-import Aside from "@/components/Current/Aside"
-import Blocks from "@/components/Current/Blocks"
-import Header from "@/components/Current/Header"
-import Hero from "@/components/Current/Hero"
-import Preamble from "@/components/Current/Preamble"
-import Section from "@/components/Current/Section"
-import SubnavMobile from "@/components/Current/SubnavMobile"
+import ContentPage from "@/components/Current/ContentPage"
import type { PageArgs, LangParams, UriParams } from "@/types/params"
import type { GetCurrentBlockPageData } from "@/types/requests/currentBlockPage"
@@ -38,40 +32,12 @@ export default async function CurrentContentPage({
throw new Error("Not found")
}
- const page = response.data.all_current_blocks_page.items[0]
- const images = page.hero?.imagesConnection
- const breadcrumbs = page.breadcrumbs.parentsConnection
- const parent = breadcrumbs.edges.at(-1)
-
return (
- <>
-
- {images?.totalCount ? : null}
-
-
-
-
-
-
- >
+
)
} catch (err) {
return notFound()
diff --git a/app/[lang]/(preview)/preview/page.tsx b/app/[lang]/(preview)/preview/page.tsx
index 1d63fdd34..a94eb2107 100644
--- a/app/[lang]/(preview)/preview/page.tsx
+++ b/app/[lang]/(preview)/preview/page.tsx
@@ -1,17 +1,11 @@
-import { notFound } from "next/navigation"
-
import { previewRequest } from "@/lib/previewRequest"
import { GetCurrentBlockPage } from "@/lib/graphql/Query/CurrentBlockPage.graphql"
-import Aside from "@/components/Current/Aside"
-import Blocks from "@/components/Current/Blocks"
-import Header from "@/components/Current/Header"
-import Hero from "@/components/Current/Hero"
-
import type { PageArgs, LangParams, UriParams } from "@/types/params"
import type { GetCurrentBlockPageData } from "@/types/requests/currentBlockPage"
import ContentstackLivePreview from "@contentstack/live-preview-utils"
import LoadingPreview from "@/components/Current/LoadingPreview"
+import ContentPage from "@/components/Current/ContentPage"
export default async function CurrentContentPage({
params,
@@ -26,7 +20,7 @@ export default async function CurrentContentPage({
const response = await previewRequest(
GetCurrentBlockPage,
- { locale: params.lang, uid: searchParams.uri }
+ { locale: params.lang, uri: searchParams.uri }
)
if (!response.data?.all_current_blocks_page?.total) {
@@ -36,19 +30,12 @@ export default async function CurrentContentPage({
throw new Error("Not found")
}
- const page = response.data.all_current_blocks_page.items[0]
- const images = page.hero?.imagesConnection
-
return (
- <>
-
- {images?.totalCount ? : null}
-
- {page.title}
-
-
-
- >
+
)
} catch (error) {
// TODO: throw 500
diff --git a/components/Current/ContentPage/index.tsx b/components/Current/ContentPage/index.tsx
new file mode 100644
index 000000000..dffebd2b6
--- /dev/null
+++ b/components/Current/ContentPage/index.tsx
@@ -0,0 +1,48 @@
+import Aside from "@/components/Current/Aside"
+import Blocks from "@/components/Current/Blocks"
+import Header from "@/components/Current/Header"
+import Hero from "@/components/Current/Hero"
+import Preamble from "@/components/Current/Preamble"
+import Section from "@/components/Current/Section"
+import SubnavMobile from "@/components/Current/SubnavMobile"
+
+import type { ContentPageProps } from "@/types/components/current/contentPage"
+
+
+export default function ContentPage({ data, lang, uri }: ContentPageProps) {
+ const page = data.all_current_blocks_page.items[0]
+ const images = page.hero?.imagesConnection
+ const breadcrumbs = page.breadcrumbs.parentsConnection
+ const parent = breadcrumbs.edges.at(-1)
+
+ return (
+ <>
+
+ {images?.totalCount ? : null}
+
+
+
+
+
+
+ >
+ )
+}
diff --git a/types/components/current/contentPage.ts b/types/components/current/contentPage.ts
new file mode 100644
index 000000000..73f029864
--- /dev/null
+++ b/types/components/current/contentPage.ts
@@ -0,0 +1,8 @@
+import type { Lang } from "@/types/lang"
+import type { GetCurrentBlockPageData } from "@/types/requests/currentBlockPage"
+
+export type ContentPageProps = {
+ data: GetCurrentBlockPageData
+ uri: string
+ lang: Lang
+}