fix(web): keep mobile navigation readable
Some checks failed
Code Review / ai-code-review (push) Successful in 15s
CD Pipeline / tests (push) Successful in 1m44s
CD Pipeline / build-and-deploy (push) Successful in 4m54s
CD Pipeline / post-deploy-checks (push) Has been cancelled

This commit is contained in:
Your Name
2026-06-26 17:44:54 +08:00
parent 4ad579a09c
commit 88630ab7fa
2 changed files with 13 additions and 4 deletions

View File

@@ -68,7 +68,13 @@ export function AppLayout({
useEffect(() => {
const media = window.matchMedia(MOBILE_SHELL_MEDIA)
const updateMobileShell = () => setMobileShell(media.matches)
const updateMobileShell = () => {
const isMobile = media.matches
setMobileShell(isMobile)
if (isMobile) {
setCollapsed(false)
}
}
updateMobileShell()
media.addEventListener('change', updateMobileShell)
@@ -102,7 +108,10 @@ export function AppLayout({
// Keep the navigation shell in the server-rendered HTML. If a rolling deploy
// or stale browser cache delays hydration, the operator still has navigation.
const effectiveCollapsed = mounted ? collapsed : false
const shellCollapsed = mobileShell || effectiveCollapsed
const shellCollapsed = effectiveCollapsed
const contentOffsetClass = shellCollapsed
? mobileShell ? 'ml-[48px]' : 'ml-[64px]'
: 'ml-[224px]'
return (
<div className="min-h-screen bg-nothing-gray-50">
@@ -137,7 +146,7 @@ export function AppLayout({
'relative z-10',
'pt-[68px]',
'transition-all duration-300 ease-out',
mobileShell ? 'ml-[48px]' : shellCollapsed ? 'ml-[64px]' : 'ml-[224px]'
contentOffsetClass
)}
>
{fullBleed ? (

View File

@@ -51,7 +51,7 @@ export function Header({
window.location.href = newPath
}, [locale, pathname])
const brandWidth = compact ? 64 : sidebarCollapsed ? 64 : 224
const brandWidth = sidebarCollapsed ? 64 : 224
return (
<header