diff --git a/src/components/header.tsx b/src/components/header.tsx index a89eecd..d4022ea 100644 --- a/src/components/header.tsx +++ b/src/components/header.tsx @@ -74,8 +74,8 @@ function Header({ showMenu = false }: HeaderProps) { const scrollToSection = (sectionId: string) => { const targetId = sectionId.replace('#', ''); - const isOnMainPage = location.pathname === '/'; - const element = isOnMainPage ? document.getElementById(targetId) : null; + const isOn40PlusPage = location.pathname === '/40+'; + const element = isOn40PlusPage ? document.getElementById(targetId) : null; if (element) { // Close drawer first, then scroll after animation completes @@ -96,8 +96,8 @@ function Header({ showMenu = false }: HeaderProps) { window.dispatchEvent(new CustomEvent('pending-scroll-section')); } - if (!isOnMainPage) { - router.navigate({ to: '/' }); + if (!isOn40PlusPage) { + router.navigate({ to: '/40+' }); } }; @@ -128,7 +128,7 @@ function Header({ showMenu = false }: HeaderProps) { const handleMenuClick = (itemId: string) => { if (itemId === 'recipes') { - const isOnRecipePage = location.pathname === '/recipe'; + const isOnRecipePage = location.pathname === '/40+/recipe'; if (isOnRecipePage) { // Already on recipe page, just close drawer @@ -136,8 +136,8 @@ function Header({ showMenu = false }: HeaderProps) { return; } - // Navigate from main page - force reload to ensure Instagram embeds work - window.location.href = '/recipe'; + // Navigate to recipe page - force reload to ensure Instagram embeds work + window.location.href = '/40+/recipe'; return; } else { // Scroll to section (drawer will be closed inside scrollToSection) diff --git a/src/components/layout.tsx b/src/components/layout.tsx index 7b8bb96..3f9e86d 100644 --- a/src/components/layout.tsx +++ b/src/components/layout.tsx @@ -1,4 +1,4 @@ -import { Outlet } from '@tanstack/react-router' +import { Outlet, useRouterState } from '@tanstack/react-router' import { Box, Container, @@ -6,17 +6,23 @@ import { import Footer from './footer' +import OldFooter from './oldFooter' function Layout() { + const { location } = useRouterState() + + // Use oldFooter for main page (/), footer for /40+ pages + const isMainPage = location.pathname === '/' + return ( {/*
*/} -