1
1
import { css , type Interpolation , type Theme , useTheme } from "@emotion/react" ;
2
2
import Badge from "@mui/material/Badge" ;
3
3
import type { FC } from "react" ;
4
+ import { useQuery } from "react-query" ;
5
+ import { myOrganizations } from "api/queries/users" ;
4
6
import type * as TypesGen from "api/typesGenerated" ;
5
7
import { DropdownArrow } from "components/DropdownArrow/DropdownArrow" ;
6
8
import {
@@ -9,6 +11,7 @@ import {
9
11
PopoverTrigger ,
10
12
} from "components/Popover/Popover" ;
11
13
import { UserAvatar } from "components/UserAvatar/UserAvatar" ;
14
+ import { useDashboard } from "modules/dashboard/useDashboard" ;
12
15
import { BUTTON_SM_HEIGHT , navHeight } from "theme/constants" ;
13
16
import { UserDropdownContent } from "./UserDropdownContent" ;
14
17
@@ -26,6 +29,11 @@ export const UserDropdown: FC<UserDropdownProps> = ({
26
29
onSignOut,
27
30
} ) => {
28
31
const theme = useTheme ( ) ;
32
+ const organizationsQuery = useQuery ( {
33
+ ...myOrganizations ( ) ,
34
+ enabled : Boolean ( localStorage . getItem ( "enableMultiOrganizationUi" ) ) ,
35
+ } ) ;
36
+ const { organizationId, setOrganizationId } = useDashboard ( ) ;
29
37
30
38
return (
31
39
< Popover >
@@ -63,6 +71,9 @@ export const UserDropdown: FC<UserDropdownProps> = ({
63
71
user = { user }
64
72
buildInfo = { buildInfo }
65
73
supportLinks = { supportLinks }
74
+ organizations = { organizationsQuery . data }
75
+ organizationId = { organizationId }
76
+ setOrganizationId = { setOrganizationId }
66
77
onSignOut = { onSignOut }
67
78
/>
68
79
</ PopoverContent >
0 commit comments