diff --git a/admin-spa/src/App.tsx b/admin-spa/src/App.tsx index 528f2e7..2d03bec 100644 --- a/admin-spa/src/App.tsx +++ b/admin-spa/src/App.tsx @@ -31,6 +31,7 @@ import DashboardSubmenuBar from './components/nav/DashboardSubmenuBar'; import { DashboardProvider } from '@/contexts/DashboardContext'; import { PageHeaderProvider } from '@/contexts/PageHeaderContext'; import { FABProvider } from '@/contexts/FABContext'; +import { AppProvider } from '@/contexts/AppContext'; import { PageHeader } from '@/components/PageHeader'; import { BottomNav } from '@/components/nav/BottomNav'; import { FAB } from '@/components/FAB'; @@ -447,6 +448,7 @@ function Shell() { const { on, setOn } = useFullscreen(); const { main } = useActiveSection(); const toggle = () => setOn(v => !v); + const exitFullscreen = () => setOn(false); const isDesktop = useIsDesktop(); const location = useLocation(); const scrollContainerRef = React.useRef(null); @@ -463,7 +465,7 @@ function Shell() { const isMorePage = location.pathname === '/more'; return ( - <> + {!isStandalone && } {!isStandalone && }
@@ -485,7 +487,7 @@ function Shell() {
) : ( -
+
{!isMorePage && (isDashboardRoute ? ( @@ -518,7 +520,7 @@ function Shell() {
)}
- +
); } diff --git a/admin-spa/src/contexts/AppContext.tsx b/admin-spa/src/contexts/AppContext.tsx new file mode 100644 index 0000000..c1d18fe --- /dev/null +++ b/admin-spa/src/contexts/AppContext.tsx @@ -0,0 +1,32 @@ +import React, { createContext, useContext, ReactNode } from 'react'; + +interface AppContextType { + isStandalone: boolean; + exitFullscreen?: () => void; +} + +const AppContext = createContext(undefined); + +export function AppProvider({ + children, + isStandalone, + exitFullscreen +}: { + children: ReactNode; + isStandalone: boolean; + exitFullscreen?: () => void; +}) { + return ( + + {children} + + ); +} + +export function useApp() { + const context = useContext(AppContext); + if (context === undefined) { + throw new Error('useApp must be used within an AppProvider'); + } + return context; +} diff --git a/admin-spa/src/routes/More/index.tsx b/admin-spa/src/routes/More/index.tsx index 1412921..410e6cb 100644 --- a/admin-spa/src/routes/More/index.tsx +++ b/admin-spa/src/routes/More/index.tsx @@ -1,8 +1,10 @@ import React, { useEffect } from 'react'; import { useNavigate, Link } from 'react-router-dom'; -import { Tag, Settings as SettingsIcon, ChevronRight } from 'lucide-react'; +import { Tag, Settings as SettingsIcon, ChevronRight, Minimize2, LogOut } from 'lucide-react'; import { __ } from '@/lib/i18n'; import { usePageHeader } from '@/contexts/PageHeaderContext'; +import { useApp } from '@/contexts/AppContext'; +import { Button } from '@/components/ui/button'; interface MenuItem { icon: React.ReactNode; @@ -29,12 +31,18 @@ const menuItems: MenuItem[] = [ export default function MorePage() { const navigate = useNavigate(); const { setPageHeader, clearPageHeader } = usePageHeader(); + const { isStandalone, exitFullscreen } = useApp(); useEffect(() => { setPageHeader(__('More')); return () => clearPageHeader(); }, [setPageHeader, clearPageHeader]); + const handleLogout = () => { + // Clear auth and redirect to login + window.location.href = window.WNW_CONFIG?.wpAdminUrl || '/wp-admin'; + }; + return (
{/* Remove inline header - use PageHeader component instead */} @@ -65,6 +73,29 @@ export default function MorePage() { ))}
+ + {/* Exit Fullscreen / Logout */} +
+ {isStandalone ? ( + + ) : ( + + )} +
); }