@@ -20,6 +20,7 @@ import { CopyButton } from "components/CopyButton/CopyButton";
20
20
import { ExternalImage } from "components/ExternalImage/ExternalImage" ;
21
21
import { usePopover } from "components/Popover/Popover" ;
22
22
import { Stack } from "components/Stack/Stack" ;
23
+ import { useDashboard } from "modules/dashboard/useDashboard" ;
23
24
24
25
export const Language = {
25
26
accountLabel : "Account" ,
@@ -84,18 +85,21 @@ const styles = {
84
85
85
86
export interface UserDropdownContentProps {
86
87
user : TypesGen . User ;
88
+ organizations ?: TypesGen . Organization [ ] ;
87
89
buildInfo ?: TypesGen . BuildInfoResponse ;
88
90
supportLinks ?: readonly TypesGen . LinkConfig [ ] ;
89
91
onSignOut : ( ) => void ;
90
92
}
91
93
92
94
export const UserDropdownContent : FC < UserDropdownContentProps > = ( {
93
- buildInfo,
94
95
user,
96
+ organizations,
97
+ buildInfo,
95
98
supportLinks,
96
99
onSignOut,
97
100
} ) => {
98
101
const popover = usePopover ( ) ;
102
+ const { organizationId, setOrganizationId } = useDashboard ( ) ;
99
103
100
104
const onPopoverClose = ( ) => {
101
105
popover . setIsOpen ( false ) ;
@@ -128,6 +132,42 @@ export const UserDropdownContent: FC<UserDropdownContentProps> = ({
128
132
129
133
< Divider css = { { marginBottom : 8 } } />
130
134
135
+ { organizations && (
136
+ < div >
137
+ < div
138
+ css = { {
139
+ padding : "8px 20px 6px" ,
140
+ textTransform : "uppercase" ,
141
+ letterSpacing : 1.1 ,
142
+ lineHeight : 1.1 ,
143
+ fontSize : "0.8em" ,
144
+ } }
145
+ >
146
+ My teams
147
+ </ div >
148
+ { organizations . map ( ( org ) => (
149
+ < MenuItem
150
+ key = { org . id }
151
+ css = { styles . menuItem }
152
+ onClick = { ( ) => {
153
+ setOrganizationId ( org . id ) ;
154
+ popover . setIsOpen ( false ) ;
155
+ } }
156
+ >
157
+ { /* <LogoutIcon css={styles.menuItemIcon} /> */ }
158
+ < Stack direction = "row" spacing = { 1 } css = { styles . menuItemText } >
159
+ { org . name }
160
+ { organizationId == org . id && (
161
+ < span css = { { fontSize : 12 , color : "gray" } } > Current</ span >
162
+ ) }
163
+ </ Stack >
164
+ </ MenuItem >
165
+ ) ) }
166
+ </ div >
167
+ ) }
168
+
169
+ < Divider css = { { marginBottom : 8 } } />
170
+
131
171
< Link to = "/settings/account" css = { styles . link } >
132
172
< MenuItem css = { styles . menuItem } onClick = { onPopoverClose } >
133
173
< AccountIcon css = { styles . menuItemIcon } />
0 commit comments