1
1
import Divider from "@material-ui/core/Divider"
2
- import ListItemIcon from "@material-ui/core/ListItemIcon"
3
- import ListItemText from "@material-ui/core/ListItemText"
4
2
import MenuItem from "@material-ui/core/MenuItem"
5
3
import { makeStyles } from "@material-ui/core/styles"
6
- import Tooltip from "@material-ui/core/Tooltip"
7
- import Typography from "@material-ui/core/Typography"
8
4
import AccountIcon from "@material-ui/icons/AccountCircleOutlined"
9
5
import BugIcon from "@material-ui/icons/BugReportOutlined"
10
- import ChatIcon from "@material-ui/icons/Chat"
11
- import LaunchIcon from "@material-ui/icons/Launch"
6
+ import ChatIcon from "@material-ui/icons/ChatOutlined"
7
+ import LaunchIcon from "@material-ui/icons/LaunchOutlined"
8
+ import { Stack } from "components/Stack/Stack"
12
9
import { FC } from "react"
13
10
import { Link } from "react-router-dom"
14
11
import * as TypesGen from "../../api/typesGenerated"
15
- import { navHeight } from "../../theme/constants"
16
- import { DocsIcon } from "../Icons/DocsIcon"
17
- import { LogoutIcon } from "../Icons/LogoutIcon"
18
- import { UserAvatar } from "../UserAvatar/UserAvatar"
12
+ import DocsIcon from "@material-ui/icons/MenuBook"
13
+ import LogoutIcon from "@material-ui/icons/ExitToAppOutlined"
14
+ import { combineClasses } from "util/combineClasses"
19
15
20
16
export const Language = {
21
17
accountLabel : "Account" ,
@@ -46,38 +42,27 @@ export const UserDropdownContent: FC<UserDropdownContentProps> = ({
46
42
const discordUrl = `https://coder.com/chat?utm_source=coder&utm_medium=coder&utm_campaign=server-footer`
47
43
48
44
return (
49
- < div className = { styles . userInfo } >
50
- < div className = { styles . root } >
51
- < div className = { styles . avatarContainer } >
52
- < UserAvatar
53
- className = { styles . avatar }
54
- username = { user . username }
55
- avatarURL = { user . avatar_url }
56
- />
57
- </ div >
58
- < Typography className = { styles . userName } > { user . username } </ Typography >
59
- < Typography className = { styles . userEmail } > { user . email } </ Typography >
60
- </ div >
61
-
62
- < Divider />
45
+ < div >
46
+ < Stack className = { styles . info } spacing = { 0 } >
47
+ < span className = { styles . userName } > { user . username } </ span >
48
+ < span className = { styles . userEmail } > { user . email } </ span >
49
+ </ Stack >
50
+
51
+ < Divider className = { styles . divider } />
63
52
64
53
< Link to = "/settings/account" className = { styles . link } >
65
54
< MenuItem className = { styles . menuItem } onClick = { onPopoverClose } >
66
- < ListItemIcon className = { styles . icon } >
67
- < AccountIcon />
68
- </ ListItemIcon >
69
- < ListItemText primary = { Language . accountLabel } />
55
+ < AccountIcon className = { styles . menuItemIcon } />
56
+ < span className = { styles . menuItemText } > { Language . accountLabel } </ span >
70
57
</ MenuItem >
71
58
</ Link >
72
59
73
60
< MenuItem className = { styles . menuItem } onClick = { onSignOut } >
74
- < ListItemIcon className = { styles . icon } >
75
- < LogoutIcon />
76
- </ ListItemIcon >
77
- < ListItemText primary = { Language . signOutLabel } />
61
+ < LogoutIcon className = { styles . menuItemIcon } />
62
+ < span className = { styles . menuItemText } > { Language . signOutLabel } </ span >
78
63
</ MenuItem >
79
64
80
- < Divider />
65
+ < Divider className = { styles . divider } />
81
66
82
67
< a
83
68
href = "https://coder.com/docs/coder-oss"
@@ -86,10 +71,8 @@ export const UserDropdownContent: FC<UserDropdownContentProps> = ({
86
71
className = { styles . link }
87
72
>
88
73
< MenuItem className = { styles . menuItem } onClick = { onPopoverClose } >
89
- < ListItemIcon className = { styles . icon } >
90
- < DocsIcon />
91
- </ ListItemIcon >
92
- < ListItemText primary = { Language . docsLabel } />
74
+ < DocsIcon className = { styles . menuItemIcon } />
75
+ < span className = { styles . menuItemText } > { Language . docsLabel } </ span >
93
76
</ MenuItem >
94
77
</ a >
95
78
@@ -100,10 +83,8 @@ export const UserDropdownContent: FC<UserDropdownContentProps> = ({
100
83
className = { styles . link }
101
84
>
102
85
< MenuItem className = { styles . menuItem } onClick = { onPopoverClose } >
103
- < ListItemIcon className = { styles . icon } >
104
- < BugIcon />
105
- </ ListItemIcon >
106
- < ListItemText primary = { Language . bugLabel } />
86
+ < BugIcon className = { styles . menuItemIcon } />
87
+ < span className = { styles . menuItemText } > { Language . bugLabel } </ span >
107
88
</ MenuItem >
108
89
</ a >
109
90
@@ -114,93 +95,89 @@ export const UserDropdownContent: FC<UserDropdownContentProps> = ({
114
95
className = { styles . link }
115
96
>
116
97
< MenuItem className = { styles . menuItem } onClick = { onPopoverClose } >
117
- < ListItemIcon className = { styles . icon } >
118
- < ChatIcon />
119
- </ ListItemIcon >
120
- < ListItemText primary = { Language . discordLabel } />
98
+ < ChatIcon className = { styles . menuItemIcon } />
99
+ < span className = { styles . menuItemText } > { Language . discordLabel } </ span >
121
100
</ MenuItem >
122
101
</ a >
123
102
124
- < Divider />
103
+ < Divider className = { styles . divider } />
125
104
126
- < Tooltip title = "Browse Source Code" >
105
+ < Stack className = { styles . info } spacing = { 0 } >
127
106
< a
128
- className = { styles . footerText }
107
+ title = "Browse Source Code"
108
+ className = { combineClasses ( [ styles . footerText , styles . buildInfo ] ) }
129
109
href = { buildInfo ?. external_url }
130
110
target = "_blank"
131
111
rel = "noreferrer"
132
112
>
133
113
{ buildInfo ?. version } < LaunchIcon />
134
114
</ a >
135
- </ Tooltip >
136
115
137
- < div className = { styles . footerText } > { Language . copyrightText } </ div >
116
+ < div className = { styles . footerText } > { Language . copyrightText } </ div >
117
+ </ Stack >
138
118
</ div >
139
119
)
140
120
}
141
121
142
122
const useStyles = makeStyles ( ( theme ) => ( {
143
- root : {
144
- padding : theme . spacing ( 3 , 2 ) ,
145
- textAlign : "center" ,
146
- } ,
147
- avatarContainer : {
148
- width : "100%" ,
149
- display : "flex" ,
150
- alignItems : "center" ,
151
- justifyContent : "center" ,
152
- } ,
153
- avatar : {
154
- width : 48 ,
155
- height : 48 ,
156
- borderRadius : "50%" ,
157
- marginBottom : theme . spacing ( 1 ) ,
158
- transition : `transform .2s` ,
159
-
160
- "&:hover" : {
161
- transform : `scale(1.1)` ,
162
- } ,
123
+ info : {
124
+ padding : theme . spacing ( 2.5 ) ,
163
125
} ,
164
126
userName : {
165
- fontSize : 16 ,
166
- marginTop : theme . spacing ( 1 ) ,
127
+ fontWeight : 600 ,
167
128
} ,
168
129
userEmail : {
169
- fontSize : 14 ,
170
- letterSpacing : 0.2 ,
171
130
color : theme . palette . text . secondary ,
131
+ width : "100%" ,
132
+ textOverflow : "ellipsis" ,
133
+ overflow : "hidden" ,
172
134
} ,
173
135
link : {
174
136
textDecoration : "none" ,
175
137
color : "inherit" ,
176
138
} ,
177
139
menuItem : {
178
- height : navHeight ,
179
- padding : ` ${ theme . spacing ( 1.5 ) } px ${ theme . spacing ( 2.75 ) } px` ,
140
+ gap : theme . spacing ( 2.5 ) ,
141
+ padding : theme . spacing ( 1 , 2.5 ) ,
180
142
181
143
"&:hover" : {
182
144
backgroundColor : theme . palette . action . hover ,
183
145
transition : "background-color 0.3s ease" ,
184
146
} ,
185
147
} ,
186
- userInfo : {
187
- marginBottom : theme . spacing ( 1 ) ,
188
- } ,
189
- icon : {
148
+ menuItemIcon : {
190
149
color : theme . palette . text . secondary ,
150
+ width : theme . spacing ( 2.5 ) ,
151
+ height : theme . spacing ( 2.5 ) ,
152
+ } ,
153
+ menuItemText : {
154
+ fontSize : 14 ,
155
+ } ,
156
+ divider : {
157
+ margin : theme . spacing ( 1 , 0 ) ,
158
+
159
+ "&:first-of-type" : {
160
+ marginTop : 0 ,
161
+ } ,
162
+
163
+ "&:last-of-type" : {
164
+ marginBottom : 0 ,
165
+ } ,
191
166
} ,
192
167
footerText : {
168
+ fontSize : 12 ,
193
169
textDecoration : "none" ,
194
170
color : theme . palette . text . secondary ,
195
- marginTop : theme . spacing ( 1.5 ) ,
196
171
display : "flex" ,
197
172
alignItems : "center" ,
198
- justifyContent : "center" ,
173
+ gap : 4 ,
199
174
200
175
"& svg" : {
201
- width : 14 ,
202
- height : 14 ,
203
- marginLeft : theme . spacing ( 0.5 ) ,
176
+ width : 12 ,
177
+ height : 12 ,
204
178
} ,
205
179
} ,
180
+ buildInfo : {
181
+ color : theme . palette . text . primary ,
182
+ } ,
206
183
} ) )
0 commit comments