AeThex-OS/temp-forge-extract/aethex-forge-main/client/components/MaintenanceGuard.tsx
MrPiglr b3c308b2c8 Add functional marketplace modules, bottom nav bar, root terminal, arcade games
- ModuleManager: Central tracking for installed marketplace modules
- DataAnalyzerWidget: Real-time CPU/RAM/Battery/Storage widget (unlocked by Data Analyzer module)
- BottomNavBar: Navigation bar for Projects/Chat/Marketplace/Settings
- RootShell: Real root command execution utility
- TerminalActivity: Full root shell with neofetch, sysinfo, real Linux commands
- Terminal Pro module: Adds aliases (ll, la, h), command history
- ArcadeActivity + SnakeGame: Pixel Arcade module unlocks retro games
- fade_in/fade_out animations for smooth transitions
2026-02-18 22:03:50 -07:00

33 lines
1,021 B
TypeScript

import React from "react";
import { useLocation } from "react-router-dom";
import { useMaintenance } from "@/contexts/MaintenanceContext";
import MaintenancePage from "@/pages/Maintenance";
const ALLOWED_PATHS = ["/login", "/staff/login", "/reset-password", "/health"];
interface MaintenanceGuardProps {
children: React.ReactNode;
}
export default function MaintenanceGuard({ children }: MaintenanceGuardProps) {
const { isMaintenanceMode, canBypass, loading } = useMaintenance();
const location = useLocation();
if (loading) {
return (
<div className="min-h-screen bg-gray-900 flex items-center justify-center">
<div className="w-8 h-8 border-2 border-purple-500 border-t-transparent rounded-full animate-spin" />
</div>
);
}
const isAllowedPath = ALLOWED_PATHS.some(path =>
location.pathname === path || location.pathname.startsWith(path)
);
if (isMaintenanceMode && !canBypass && !isAllowedPath) {
return <MaintenancePage />;
}
return <>{children}</>;
}