From 14de5c6b640919bddea427d4476a7882c8993131 Mon Sep 17 00:00:00 2001 From: Boodland Date: Fri, 19 Jul 2024 13:27:49 +0200 Subject: [PATCH 01/50] Create very basic Root Layout --- app/layout.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 app/layout.tsx diff --git a/app/layout.tsx b/app/layout.tsx new file mode 100644 index 00000000..2f82be2c --- /dev/null +++ b/app/layout.tsx @@ -0,0 +1,13 @@ +export default function RootLayout({ + // Layouts must accept a children prop. + // This will be populated with nested layouts or pages + children, +}: { + children: React.ReactNode; +}) { + return ( + + {children} + + ); +} From 9afa50020a67363c75e4e4eaa48a9439461a45a2 Mon Sep 17 00:00:00 2001 From: Boodland Date: Fri, 19 Jul 2024 13:31:50 +0200 Subject: [PATCH 02/50] Move Montserrat and Open Sans font to global css So they can be loaded for pages and app router --- app/layout.tsx | 2 ++ pages/_document.tsx | 4 ---- styles/globals.css | 2 ++ 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/layout.tsx b/app/layout.tsx index 2f82be2c..178c2fcd 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -1,3 +1,5 @@ +import '../styles/globals.css'; + export default function RootLayout({ // Layouts must accept a children prop. // This will be populated with nested layouts or pages diff --git a/pages/_document.tsx b/pages/_document.tsx index 0c73f3aa..ddb7c7d7 100644 --- a/pages/_document.tsx +++ b/pages/_document.tsx @@ -22,10 +22,6 @@ export default class MyDocument extends Document { type="text/javascript" dangerouslySetInnerHTML={{ __html: this.props.browserTimingHeader }} /> - diff --git a/styles/globals.css b/styles/globals.css index 58439b05..e85ec005 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -1,3 +1,5 @@ +@import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,300;0,400;0,500;1,300;1,400;1,500&family=Open+Sans:ital,wght@0,300;0,400;0,600;1,300;1,400;1,600&display=swap'); + html, body { padding: 0; From 33a121d658e96c50e6f363f6209b259a2db2e6a9 Mon Sep 17 00:00:00 2001 From: Boodland Date: Fri, 19 Jul 2024 15:13:19 +0200 Subject: [PATCH 03/50] Add Newrelic app router configuration --- app/layout.tsx | 39 +++++++++++++++++++++++++++++++++++++-- next.config.js | 17 +++++++++++++++++ 2 files changed, 54 insertions(+), 2 deletions(-) diff --git a/app/layout.tsx b/app/layout.tsx index 178c2fcd..ab6531bc 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -1,15 +1,50 @@ +import newrelic from 'newrelic'; +import Script from 'next/script'; + import '../styles/globals.css'; -export default function RootLayout({ +export default async function RootLayout({ // Layouts must accept a children prop. // This will be populated with nested layouts or pages children, }: { children: React.ReactNode; }) { + // Configuration according to Newrelic app router example + // See https://github.com/newrelic/newrelic-node-nextjs?tab=readme-ov-file#example-projects + // @ts-ignore + if (newrelic.agent.collector.isConnected() === false) { + await new Promise((resolve) => { + // @ts-ignore + newrelic.agent.on('connected', resolve); + }); + } + + const browserTimingHeader = newrelic.getBrowserTimingHeader({ + hasToRemoveScriptWrapper: true, + // @ts-ignore + allowTransactionlessInjection: true, + }); + return ( - {children} + + {children} +