File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -5,12 +5,14 @@ import {
5
5
TooltipProvider ,
6
6
TooltipTrigger ,
7
7
} from "~/components/primitives/Tooltip" ;
8
+ import { useIsImpersonating } from "~/hooks/useOrganizations" ;
8
9
import { useHasAdminAccess } from "~/hooks/useUser" ;
9
10
10
11
export function AdminDebugTooltip ( { children } : { children : React . ReactNode } ) {
11
12
const hasAdminAccess = useHasAdminAccess ( ) ;
13
+ const isImpersonating = useIsImpersonating ( ) ;
12
14
13
- if ( ! hasAdminAccess ) {
15
+ if ( ! hasAdminAccess && ! isImpersonating ) {
14
16
return null ;
15
17
}
16
18
Original file line number Diff line number Diff line change @@ -53,3 +53,11 @@ export function useIsNewOrganizationPage(matches?: UIMatch[]): boolean {
53
53
export const useOrganizationChanged = ( action : ( org : MatchedOrganization | undefined ) => void ) => {
54
54
useChanged ( useOptionalOrganization , action ) ;
55
55
} ;
56
+
57
+ export function useIsImpersonating ( matches ?: UIMatch [ ] ) {
58
+ const data = useTypedMatchesData < typeof orgLoader > ( {
59
+ id : "routes/_app.orgs.$organizationSlug" ,
60
+ matches,
61
+ } ) ;
62
+ return data ?. isImpersonating === true ;
63
+ }
You can’t perform that action at this time.
0 commit comments