refactor: render TrackingSDK as first child to pages

This helps with debugging and profiling.

Also tracking isn't tied to the rendering of the UI. So nitpicking could also
justify this change :)
This commit is contained in:
Michael Zetterberg
2024-07-30 15:44:48 +02:00
parent 2c0116e67b
commit bbc8801d3f
4 changed files with 43 additions and 30 deletions

View File

@@ -20,18 +20,21 @@ export default async function LoyaltyPage({ lang }: LangParams) {
const { tracking, loyaltyPage } = loyaltyPageRes
return (
<section className={styles.content}>
{loyaltyPage.sidebar.length ? (
<Sidebar blocks={loyaltyPage.sidebar} lang={lang} />
) : null}
<MaxWidth className={styles.blocks} tag="main">
<Title>{loyaltyPage.heading}</Title>
{loyaltyPage.blocks ? (
<Blocks blocks={loyaltyPage.blocks} lang={lang} />
<>
<section className={styles.content}>
{loyaltyPage.sidebar.length ? (
<Sidebar blocks={loyaltyPage.sidebar} lang={lang} />
) : null}
</MaxWidth>
<MaxWidth className={styles.blocks} tag="main">
<Title>{loyaltyPage.heading}</Title>
{loyaltyPage.blocks ? (
<Blocks blocks={loyaltyPage.blocks} lang={lang} />
) : null}
</MaxWidth>
</section>
<TrackingSDK pageData={tracking} />
</section>
</>
)
}