diff --git a/apps/web/src/components/app-shell.tsx b/apps/web/src/components/app-shell.tsx index 8636e49..d01b798 100644 --- a/apps/web/src/components/app-shell.tsx +++ b/apps/web/src/components/app-shell.tsx @@ -1,11 +1,12 @@ -import { useCallback, useEffect } from "react"; -import { Link, NavLink, Outlet } from "react-router-dom"; +import { useCallback, useEffect, useState } from "react"; +import { Link, NavLink, Outlet, useLocation } from "react-router-dom"; import { getUserSessions } from "../api/sessions"; import type { Session } from "../api/sessions"; import { useTheme } from "../hooks/use-theme"; import { useAuth } from "../state/auth"; import { useSessions } from "../state/sessions"; +import { useMobileViewport } from "../hooks/use-mobile-viewport"; import { Icon } from "./icon"; import type { IconName } from "../utils/icons"; @@ -39,6 +40,11 @@ export const AppShell = () => { useTheme(); const { user, logout } = useAuth(); const { sessions, setAllSessions } = useSessions(); + const location = useLocation(); + const isMobile = useMobileViewport(); + const [mobileMenuOpen, setMobileMenuOpen] = useState(false); + + const isMobileTerminal = isMobile && location.pathname.includes("/instances/") && location.pathname.includes("/terminal"); const loadSessions = useCallback(async () => { try { @@ -58,6 +64,19 @@ export const AppShell = () => { return () => clearInterval(interval); }, [loadSessions]); + // Close mobile menu on route change + useEffect(() => { + setMobileMenuOpen(false); + }, [location.pathname]); + + if (isMobileTerminal) { + return ( +
+ +
+ ); + } + return (
@@ -82,7 +101,17 @@ export const AppShell = () => {
-