feat: Auto-enable fullscreen in standalone mode, hide toggle button

This commit is contained in:
dwindown
2025-11-04 23:32:40 +07:00
parent 8a0f2e581e
commit f2bd460e72

View File

@@ -257,13 +257,14 @@ function AddonRoute({ config }: { config: any }) {
return <Component {...(config.props || {})} />;
}
function Header({ onFullscreen, fullscreen }: { onFullscreen: () => void; fullscreen: boolean }) {
function Header({ onFullscreen, fullscreen, showToggle = true }: { onFullscreen: () => void; fullscreen: boolean; showToggle?: boolean }) {
const siteTitle = (window as any).wnw?.siteTitle || 'WooNooW';
return (
<header className={`h-16 border-b border-border flex items-center px-4 justify-between sticky ${fullscreen ? `top-0` : `top-[32px]`} z-40 bg-background md:bg-background/95 md:backdrop-blur md:supports-[backdrop-filter]:bg-background/60`}>
<div className="font-semibold">{siteTitle}</div>
<div className="flex items-center gap-3">
<div className="text-sm opacity-70 hidden sm:block">{window.WNW_API?.isDev ? 'Dev Server' : 'Production'}</div>
{showToggle && (
<button
onClick={onFullscreen}
className="inline-flex items-center gap-2 border rounded-md px-3 py-2 text-sm hover:bg-accent hover:text-accent-foreground"
@@ -272,6 +273,7 @@ function Header({ onFullscreen, fullscreen }: { onFullscreen: () => void; fullsc
{fullscreen ? <Minimize2 className="w-4 h-4" /> : <Maximize2 className="w-4 h-4" />}
<span className="hidden sm:inline">{fullscreen ? 'Exit' : 'Fullscreen'}</span>
</button>
)}
</div>
</header>
);
@@ -341,17 +343,21 @@ function Shell() {
const isDesktop = useIsDesktop();
const location = useLocation();
// Check if standalone mode - force fullscreen and hide toggle
const isStandalone = window.WNW_CONFIG?.standaloneMode ?? false;
const fullscreen = isStandalone ? true : on;
// Check if current route is dashboard
const isDashboardRoute = location.pathname === '/' || location.pathname.startsWith('/dashboard');
const SubmenuComponent = isDashboardRoute ? DashboardSubmenuBar : SubmenuBar;
return (
<>
<ShortcutsBinder onToggle={toggle} />
<CommandPalette toggleFullscreen={toggle} />
<div className={`flex flex-col min-h-screen ${on ? 'woonoow-fullscreen-root' : ''}`}>
<Header onFullscreen={toggle} fullscreen={on} />
{on ? (
{!isStandalone && <ShortcutsBinder onToggle={toggle} />}
{!isStandalone && <CommandPalette toggleFullscreen={toggle} />}
<div className={`flex flex-col min-h-screen ${fullscreen ? 'woonoow-fullscreen-root' : ''}`}>
<Header onFullscreen={toggle} fullscreen={fullscreen} showToggle={!isStandalone} />
{fullscreen ? (
isDesktop ? (
<div className="flex flex-1 min-h-0">
<Sidebar />