fix(android): replace env() with JS-set CSS vars for safe areas
This commit is contained in:
@@ -104,7 +104,7 @@ export function Layout() {
|
|||||||
<div className="h-full w-full bg-gb-bg text-gb-fg font-mono flex flex-col">
|
<div className="h-full w-full bg-gb-bg text-gb-fg font-mono flex flex-col">
|
||||||
{/* Outer terminal frame with safe area */}
|
{/* Outer terminal frame with safe area */}
|
||||||
<div className="flex-1 terminal-border bg-gb-bg-h flex flex-col min-h-0"
|
<div className="flex-1 terminal-border bg-gb-bg-h flex flex-col min-h-0"
|
||||||
style={{ padding: 'max(env(safe-area-inset-top), 1.5rem) max(env(safe-area-inset-right), 0) max(env(safe-area-inset-bottom), 0.75rem) max(env(safe-area-inset-left), 0)' }}>
|
style={{ padding: 'var(--safe-top, env(safe-area-inset-top, 1.5rem)) var(--safe-right, env(safe-area-inset-right, 0)) var(--safe-bottom, env(safe-area-inset-bottom, 0.75rem)) var(--safe-left, env(safe-area-inset-left, 0))' }}>
|
||||||
|
|
||||||
{/* Top bar — minimal on mobile */}
|
{/* Top bar — minimal on mobile */}
|
||||||
<div className="flex items-center justify-between px-2 md:px-3 py-1 border-b border-gb-bg-t bg-gb-bg-s gap-1">
|
<div className="flex items-center justify-between px-2 md:px-3 py-1 border-b border-gb-bg-t bg-gb-bg-s gap-1">
|
||||||
@@ -237,7 +237,7 @@ function MobileBottomNav({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="md:hidden flex items-center bg-gb-bg-h border-t border-gb-bg-t shrink-0"
|
<div className="md:hidden flex items-center bg-gb-bg-h border-t border-gb-bg-t shrink-0"
|
||||||
style={{ paddingBottom: 'env(safe-area-inset-bottom)' }}>
|
style={{ paddingBottom: 'var(--safe-bottom, env(safe-area-inset-bottom))' }}>
|
||||||
<NavTab active={mobileView === 'sidebar'} onClick={() => onViewChange('sidebar')}>
|
<NavTab active={mobileView === 'sidebar'} onClick={() => onViewChange('sidebar')}>
|
||||||
[SERVERS]
|
[SERVERS]
|
||||||
</NavTab>
|
</NavTab>
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ export function MobileNav({ activeTab, onTabChange, onToggleDrawer }: MobileNavP
|
|||||||
<ThemeToggle />
|
<ThemeToggle />
|
||||||
</div>
|
</div>
|
||||||
{/* Safe area for phones with bottom notch */}
|
{/* Safe area for phones with bottom notch */}
|
||||||
<div className="h-[env(safe-area-inset-bottom)]" />
|
<div className="h-[var(--safe-bottom,env(safe-area-inset-bottom))]" />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,14 @@ import App from './App.tsx';
|
|||||||
|
|
||||||
const isTauri = 'window' in globalThis && '__TAURI_INTERNALS__' in window;
|
const isTauri = 'window' in globalThis && '__TAURI_INTERNALS__' in window;
|
||||||
if (isTauri) {
|
if (isTauri) {
|
||||||
|
// Tauri Android WebView doesn't support CSS env(safe-area-inset-*).
|
||||||
|
// Set explicit fallbacks via JS.
|
||||||
|
if (navigator.userAgent.includes('Android')) {
|
||||||
|
document.documentElement.style.setProperty('--safe-top', '1.5rem');
|
||||||
|
document.documentElement.style.setProperty('--safe-bottom', '0.75rem');
|
||||||
|
document.documentElement.style.setProperty('--safe-left', '0px');
|
||||||
|
document.documentElement.style.setProperty('--safe-right', '0px');
|
||||||
|
}
|
||||||
const TARGET = 'https://dumpster.dustin.coffee';
|
const TARGET = 'https://dumpster.dustin.coffee';
|
||||||
const WS_TARGET = 'wss://dumpster.dustin.coffee';
|
const WS_TARGET = 'wss://dumpster.dustin.coffee';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user