import { ShieldCheckIcon } from "@heroicons/react/20/solid"; import { CopyableText } from "~/components/primitives/CopyableText"; import * as Property from "~/components/primitives/PropertyTable"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "~/components/primitives/Tooltip"; import { useOptionalEnvironment } from "~/hooks/useEnvironment"; import { useOptionalOrganization } from "~/hooks/useOrganizations"; import { useOptionalProject } from "~/hooks/useProject"; import { useHasAdminAccess, useUser } from "~/hooks/useUser"; export function AdminDebugTooltip({ children }: { children?: React.ReactNode }) { // `useHasAdminAccess` already folds in impersonation and the "view as user" // toggle, so this one check is enough. const hasAdminAccess = useHasAdminAccess(); if (!hasAdminAccess) { return null; } return ( {/* The copy controls below pass `hideTooltip` so their own tooltips don't fire Radix's global close and dismiss this panel. `pr-8` leaves room for the copy button, which is absolutely positioned to the right of each value. */} {children} ); } function Content({ children }: { children: React.ReactNode }) { const organization = useOptionalOrganization(); const project = useOptionalProject(); const environment = useOptionalEnvironment(); const user = useUser(); return (
User ID {organization && ( Org ID )} {project && ( <> Project ID Project ref )} {environment && ( <> Environment ID Environment type {environment.type} Environment paused {environment.paused ? "Yes" : "No"} )} {children &&
{children}
}
); }