refactor: extract AdobeScript component
This commit is contained in:
@@ -8,20 +8,13 @@ import SkipToMainContent from "@/components/SkipToMainContent"
|
||||
|
||||
import type { Metadata } from "next"
|
||||
import type { LangParams, LayoutArgs } from "@/types/params"
|
||||
import { env } from "@/env/server.mjs"
|
||||
import AdobeScript from "../AdobeScript"
|
||||
|
||||
export const metadata: Metadata = {
|
||||
description: "New web",
|
||||
title: "Scandic Hotels New Web",
|
||||
}
|
||||
|
||||
const adobeSrcs = {
|
||||
// TODO: decide on naming and environments
|
||||
development: "",
|
||||
test: "https://assets.adobedtm.com/c1bd08b1e4e7/d64a7c1f5f17/launch-84c70d82a50c-staging.min.js",
|
||||
production:
|
||||
"https://assets.adobedtm.com/c1bd08b1e4e7/d64a7c1f5f17/launch-e56085bbe998.min.js",
|
||||
}
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
params,
|
||||
@@ -65,7 +58,7 @@ export default function RootLayout({
|
||||
src="/Static/dist/js/ng/main.js?1705409330990"
|
||||
/>
|
||||
{/* Should this be moved to an app/layout instead? */}
|
||||
<Script src={adobeSrcs[env.NODE_ENV]} />
|
||||
<AdobeScript />
|
||||
{/* <Script
|
||||
data-cookieconsent="ignore"
|
||||
src="/Static/dist/js/main-ng.js?336b801d6b38eff10884"
|
||||
|
||||
13
app/[lang]/AdobeScript.tsx
Normal file
13
app/[lang]/AdobeScript.tsx
Normal file
@@ -0,0 +1,13 @@
|
||||
import Script from "next/script"
|
||||
|
||||
const scriptScrs = {
|
||||
// TODO: decide on naming and environments (development vs. test vs. staging etc)
|
||||
development: "",
|
||||
test: "https://assets.adobedtm.com/c1bd08b1e4e7/d64a7c1f5f17/launch-84c70d82a50c-staging.min.js",
|
||||
production:
|
||||
"https://assets.adobedtm.com/c1bd08b1e4e7/d64a7c1f5f17/launch-e56085bbe998.min.js",
|
||||
}
|
||||
|
||||
export default function AdobeScript() {
|
||||
return <Script src={scriptScrs[process.env.NODE_ENV]} />
|
||||
}
|
||||
Reference in New Issue
Block a user