diff --git a/src/app/(frontend)/[slug]/page.client.tsx b/src/app/(frontend)/[slug]/page.client.tsx index 2d52669..69443e9 100644 --- a/src/app/(frontend)/[slug]/page.client.tsx +++ b/src/app/(frontend)/[slug]/page.client.tsx @@ -1,14 +1,32 @@ 'use client' import { useHeaderTheme } from '@/providers/HeaderTheme' import React, { useEffect } from 'react' +import { usePathname } from 'next/navigation' const PageClient: React.FC = () => { - /* Force the header to be dark mode while we have an image behind it */ const { setHeaderTheme } = useHeaderTheme() + const pathname = usePathname() useEffect(() => { setHeaderTheme('light') }, [setHeaderTheme]) + + useEffect(() => { + const hash = window.location.hash + if (!hash) return + + const tryScroll = (attempts = 0) => { + const el = document.querySelector(hash) + if (el) { + el.scrollIntoView({ behavior: 'smooth' }) + } else if (attempts < 10) { + setTimeout(() => tryScroll(attempts + 1), 100) + } + } + + tryScroll() + }, [pathname]) + return } diff --git a/src/app/(frontend)/[slug]/page.tsx b/src/app/(frontend)/[slug]/page.tsx index dd4ec5c..4632970 100644 --- a/src/app/(frontend)/[slug]/page.tsx +++ b/src/app/(frontend)/[slug]/page.tsx @@ -12,6 +12,7 @@ import { RenderHero } from '@/heros/RenderHero' import { generateMeta } from '@/utilities/generateMeta' import PageClient from './page.client' import { LivePreviewListener } from '@/components/LivePreviewListener' +import ScrollToTop from '@/components/ScrollToTop' import HeroBackground from '@/components/HeroBackground' import HeroPage from '@/components/HeroPage' @@ -28,7 +29,6 @@ type Args = { }> } -// Add any slugs here that should use the landing page layout const LANDING_PAGE_SLUGS = ['home'] export default async function Page({ params: paramsPromise }: Args) { @@ -51,16 +51,15 @@ export default async function Page({ params: paramsPromise }: Args) { const { hero, layout } = page - // Landing page layout — canvas + hero section with border lines if (LANDING_PAGE_SLUGS.includes(decodedSlug)) { return ( + ) } - // All other pages — canvas background + standard content return (
@@ -73,6 +72,7 @@ export default async function Page({ params: paramsPromise }: Args) { +
) } @@ -104,4 +104,4 @@ const queryPageBySlug = cache(async ({ slug }: { slug: string }) => { }) return result.docs?.[0] || null -}) \ No newline at end of file +})