1
+ import * as Property from "~/components/primitives/PropertyTable" ;
1
2
import { ShieldCheckIcon } from "@heroicons/react/20/solid" ;
2
3
import {
3
4
Tooltip ,
4
5
TooltipContent ,
5
6
TooltipProvider ,
6
7
TooltipTrigger ,
7
8
} 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" ;
10
16
11
17
export function AdminDebugTooltip ( { children } : { children : React . ReactNode } ) {
12
18
const hasAdminAccess = useHasAdminAccess ( ) ;
@@ -22,10 +28,46 @@ export function AdminDebugTooltip({ children }: { children: React.ReactNode }) {
22
28
< TooltipTrigger >
23
29
< ShieldCheckIcon className = "size-5" />
24
30
</ 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 >
27
33
</ TooltipContent >
28
34
</ Tooltip >
29
35
</ TooltipProvider >
30
36
) ;
31
37
}
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