import { useLayoutEffect, useState } from 'react'
import { Outlet, useLocation } from 'react-router-dom'
import { AppShell } from '@astryxdesign/core/AppShell'
import { Icon } from '@astryxdesign/core/Icon'
import { IconButton } from '@astryxdesign/core/IconButton'
import { NavIcon } from '@astryxdesign/core/NavIcon'
import { SideNav, SideNavItem, SideNavSection } from '@astryxdesign/core/SideNav'
import { TopNav, TopNavHeading } from '@astryxdesign/core/TopNav'
import { Moon, Sparkles, Sun } from 'lucide-react'
import { isRouteActive, navRoutes } from '../app-routes'
import { useThemeMode } from '../theme/useThemeMode'
export function AppLayout() {
const { pathname } = useLocation()
const { mode, toggleMode } = useThemeMode()
const [isMobileNavOpen, setIsMobileNavOpen] = useState(false)
useLayoutEffect(() => {
const main = document.getElementById('astryx-app-shell-main')
if (main) main.scrollTop = 0
window.scrollTo(0, 0)
}, [pathname])
const nextMode = mode === 'light' ? 'dark' : 'light'
return (
}
/>
}
/>
}
endContent={
}
onClick={toggleMode}
/>
}
/>
}
sideNav={
{navRoutes.map(({ label, path, icon }) => (
setIsMobileNavOpen(false)}
/>
))}
}>
)
}