From 1bbda77392e16d644901d3a75f4164ef43bee78d Mon Sep 17 00:00:00 2001 From: Cailyn Sinclair Date: Mon, 11 May 2026 22:00:39 -0700 Subject: [PATCH 1/2] Use compact mobile section menu for competition nav --- .../CompetitionLayout/CompetitionLayout.tsx | 36 +++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/src/layouts/CompetitionLayout/CompetitionLayout.tsx b/src/layouts/CompetitionLayout/CompetitionLayout.tsx index cd496bb..6356879 100644 --- a/src/layouts/CompetitionLayout/CompetitionLayout.tsx +++ b/src/layouts/CompetitionLayout/CompetitionLayout.tsx @@ -1,5 +1,5 @@ import classNames from 'classnames'; -import { useEffect, useRef } from 'react'; +import { useEffect, useMemo, useRef, useState } from 'react'; import { ErrorBoundary } from 'react-error-boundary'; import { Outlet, useLocation, useParams } from 'react-router-dom'; import { BarLoader } from 'react-spinners'; @@ -17,6 +17,7 @@ export function CompetitionLayout() { const { pathname } = useLocation(); const ref = useRef(null); + const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false); const { data: wcif, dataUpdatedAt, isFetching } = useWcif(competitionId!); @@ -25,14 +26,45 @@ export function CompetitionLayout() { wcif: wcif, }); + const currentTab = useMemo( + () => + tabs.find((tab) => pathname === tab.href) || + tabs.find((tab) => pathname.startsWith(tab.href)), + [tabs, pathname], + ); + useEffect(() => { ref.current?.scrollTo(0, 0); + setIsMobileMenuOpen(false); }, [pathname]); const Header = (