import { useAuth } from '../contexts/AuthContext.jsx' import { useSite } from '../contexts/SiteContext.jsx' import Maintenance from '../routes/public/Maintenance.jsx' // Wraps the public site. When the shard is in maintenance, visitors see the // coming-soon page; a logged-in admin sees the real site (live preview). export default function MaintenanceGate({ children }) { const { mode, loading } = useSite() const { user, loading: authLoading } = useAuth() if (loading || authLoading) { return (
) } if (mode === 'maintenance' && !user) { return } return children }