diff --git a/.env.example b/.env.local.example similarity index 55% rename from .env.example rename to .env.local.example index 3fe666e0d..0592f3b4a 100644 --- a/.env.example +++ b/.env.local.example @@ -2,3 +2,5 @@ CMS_ACCESS_TOKEN="" CMS_API_KEY="" CMS_ENVIRONMENT="development" CMS_URL="https://eu-graphql.contentstack.com/stacks/${CMS_API_KEY}?environment=${CMS_ENVIRONMENT}" +CMS_PREVIEW_URL="https://graphql-preview.contentstack.com/stacks/${CMS_API_KEY}?environment=${CMS_ENVIRONMENT}"; +CMS_PREVIEW_TOKEN="" \ No newline at end of file diff --git a/app/[lang]/current-content-page/page.tsx b/app/[lang]/(live)/current-content-page/page.tsx similarity index 74% rename from app/[lang]/current-content-page/page.tsx rename to app/[lang]/(live)/current-content-page/page.tsx index dafb03931..71feae069 100644 --- a/app/[lang]/current-content-page/page.tsx +++ b/app/[lang]/(live)/current-content-page/page.tsx @@ -1,7 +1,7 @@ import { notFound } from "next/navigation" -import { request } from "@/lib/request" -import { GetCurrentBlockPage } from "@/lib/graphql/Query/CurrentBlockPage.graphql" +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" @@ -23,10 +23,13 @@ export default async function CurrentContentPage({ throw new Error("Bad URI") } - const response = await request(GetCurrentBlockPage, { - locale: params.lang, - url: searchParams.uri, - }) + const response = await request( + GetCurrentBlockPage, + { + locale: params.lang, + url: searchParams.uri, + } + ) if (!response.data?.all_current_blocks_page?.total) { console.log("#### DATA ####") @@ -44,13 +47,18 @@ export default async function CurrentContentPage({ <>
{images?.totalCount ? : null} -
- - +
+ + +

Something went wrong!

+ + ) +} diff --git a/app/[lang]/(preview)/layout.tsx b/app/[lang]/(preview)/layout.tsx new file mode 100644 index 000000000..13c2a638f --- /dev/null +++ b/app/[lang]/(preview)/layout.tsx @@ -0,0 +1,55 @@ +import "../../core.css"; +import "../../scandic.css"; + +import Footer from "@/components/Current/Footer"; +import LangPopup from "@/components/Current/LangPopup"; +import Script from "next/script"; +import SkipToMainContent from "@/components/SkipToMainContent"; + +import type { Metadata } from "next"; +import type { LangParams, LayoutArgs } from "@/types/params"; +import InitLivePreview from "@/components/Current/LivePreview"; + +export const metadata: Metadata = { + description: "New web", + title: "Scandic Hotels New Web", +}; + +export default function RootLayout({ + children, + params, +}: React.PropsWithChildren>) { + return ( + + +