b6bda3d692
- Add mobile viewport detection hook - Add virtual keyboard detection with fallback - Add auto-hide hook for header/keys strip - Add special keys mapping hook - Create MobileTerminalHeader, SpecialKeysStrip, SpecialKeysPanel components - Create MobileTerminalWrapper component - Update TerminalComponent with mobile support, font scaling, copy/paste, reconnection - Update AppShell to hide chrome on mobile terminal pages - Update TerminalPage to use MobileTerminalWrapper - Add comprehensive mobile terminal styles - TypeScript check passes - Build succeeds
22 lines
550 B
TypeScript
22 lines
550 B
TypeScript
import { useState, useEffect } from "react";
|
|
|
|
const MOBILE_BREAKPOINT = 768;
|
|
|
|
export function useMobileViewport() {
|
|
const [isMobile, setIsMobile] = useState(() => {
|
|
if (typeof window === "undefined") return false;
|
|
return window.innerWidth < MOBILE_BREAKPOINT;
|
|
});
|
|
|
|
useEffect(() => {
|
|
const handleResize = () => {
|
|
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
};
|
|
|
|
window.addEventListener("resize", handleResize);
|
|
return () => window.removeEventListener("resize", handleResize);
|
|
}, []);
|
|
|
|
return isMobile;
|
|
}
|