Skip to content

Commit 0cec52a

Browse files
committed
The admin tooltip now always shows basic org, project and user info
1 parent c523b35 commit 0cec52a

File tree

1 file changed

+46
-4
lines changed

1 file changed

+46
-4
lines changed

apps/webapp/app/components/admin/debugTooltip.tsx

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1+
import * as Property from "~/components/primitives/PropertyTable";
12
import { ShieldCheckIcon } from "@heroicons/react/20/solid";
23
import {
34
Tooltip,
45
TooltipContent,
56
TooltipProvider,
67
TooltipTrigger,
78
} from "~/components/primitives/Tooltip";
8-
import { useIsImpersonating } from "~/hooks/useOrganizations";
9-
import { useHasAdminAccess } from "~/hooks/useUser";
9+
import {
10+
useIsImpersonating,
11+
useOptionalOrganization,
12+
useOrganization,
13+
} from "~/hooks/useOrganizations";
14+
import { useOptionalProject, useProject } from "~/hooks/useProject";
15+
import { useHasAdminAccess, useUser } from "~/hooks/useUser";
1016

1117
export function AdminDebugTooltip({ children }: { children: React.ReactNode }) {
1218
const hasAdminAccess = useHasAdminAccess();
@@ -22,10 +28,46 @@ export function AdminDebugTooltip({ children }: { children: React.ReactNode }) {
2228
<TooltipTrigger>
2329
<ShieldCheckIcon className="size-5" />
2430
</TooltipTrigger>
25-
<TooltipContent className="flex max-h-[90vh] items-center gap-1 overflow-y-auto">
26-
{children}
31+
<TooltipContent className="max-h-[90vh] overflow-y-auto">
32+
<Content>{children}</Content>
2733
</TooltipContent>
2834
</Tooltip>
2935
</TooltipProvider>
3036
);
3137
}
38+
39+
function Content({ children }: { children: React.ReactNode }) {
40+
const organization = useOptionalOrganization();
41+
const project = useOptionalProject();
42+
const user = useUser();
43+
44+
return (
45+
<div className="flex flex-col gap-2 divide-y divide-slate-700">
46+
<Property.Table>
47+
<Property.Item>
48+
<Property.Label>User ID</Property.Label>
49+
<Property.Value>{user.id}</Property.Value>
50+
</Property.Item>
51+
{organization && (
52+
<Property.Item>
53+
<Property.Label>Org ID</Property.Label>
54+
<Property.Value>{organization.id}</Property.Value>
55+
</Property.Item>
56+
)}
57+
{project && (
58+
<>
59+
<Property.Item>
60+
<Property.Label>Project ID</Property.Label>
61+
<Property.Value>{project.id}</Property.Value>
62+
</Property.Item>
63+
<Property.Item>
64+
<Property.Label>Project ref</Property.Label>
65+
<Property.Value>{project.ref}</Property.Value>
66+
</Property.Item>
67+
</>
68+
)}
69+
</Property.Table>
70+
<div className="pt-2">{children}</div>
71+
</div>
72+
);
73+
}

0 commit comments

Comments
 (0)