"use client"; import { usePathname } from "next/navigation"; import type { ReactNode } from "react"; import { isAdminPage } from "../lib/user-view-policy"; import { setUserViewPreview, useUserViewState } from "../lib/viewMode"; export default function AdminViewGate({ children }: { children: ReactNode }) { const pathname = usePathname(); const { enabled, ready } = useUserViewState(); if (!isAdminPage(pathname)) return children; if (!ready) return ( Checking view mode... ); if (!enabled) return children; return ( Administrator tools are hidden Configuration, user management and other admin tools are unavailable while previewing user view. Your account is unchanged. Exit the preview to return to this page. Go to My Requests setUserViewPreview(false)}> Exit user view ); }
Configuration, user management and other admin tools are unavailable while previewing user view.
Your account is unchanged. Exit the preview to return to this page.