@@ -24,8 +24,9 @@ import {
24
24
MoreMenuTrigger ,
25
25
ThreeDotsButton ,
26
26
} from "components/MoreMenu/MoreMenu" ;
27
- import { ExternalAuth } from "pages/CreateWorkspacePage/ExternalAuth" ;
28
27
import { ExternalAuthPollingState } from "pages/CreateWorkspacePage/CreateWorkspacePage" ;
28
+ import LoadingButton from "@mui/lab/LoadingButton" ;
29
+ import visuallyHidden from "@mui/utils/visuallyHidden" ;
29
30
30
31
export type ExternalAuthPageViewProps = {
31
32
isLoading : boolean ;
@@ -60,8 +61,12 @@ export const ExternalAuthPageView: FC<ExternalAuthPageViewProps> = ({
60
61
< TableHead >
61
62
< TableRow >
62
63
< TableCell > Application</ TableCell >
63
- < TableCell > Link</ TableCell >
64
- < TableCell width = "1%" > </ TableCell >
64
+ < TableCell >
65
+ < span aria-hidden css = { { ...visuallyHidden } } >
66
+ Link to connect
67
+ </ span >
68
+ </ TableCell >
69
+ < TableCell width = "1%" />
65
70
</ TableRow >
66
71
</ TableHead >
67
72
< TableBody >
@@ -133,57 +138,59 @@ const ExternalAuthRow: FC<ExternalAuthRowProps> = ({
133
138
title = { name }
134
139
avatar = {
135
140
app . display_icon && (
136
- < Avatar src = { app . display_icon } variant = "square" fitImage />
141
+ < Avatar
142
+ src = { app . display_icon }
143
+ variant = "square"
144
+ fitImage
145
+ size = "sm"
146
+ />
137
147
)
138
148
}
139
149
/>
140
150
</ TableCell >
141
- < TableCell >
142
- < ExternalAuth
143
- displayName = { name }
144
- // We could specify the user is linked, but the link is invalid.
145
- // This could indicate it expired, or was revoked on the other end.
146
- authenticated = { authenticated }
147
- authenticateURL = { authURL }
148
- displayIcon = ""
149
- message = { authenticated ? "Authenticated" : "Click to Login" }
150
- externalAuthPollingState = { externalAuthPollingState }
151
- startPollingExternalAuth = { startPollingExternalAuth }
152
- fullWidth = { false }
153
- />
151
+ < TableCell css = { { textAlign : "right" } } >
152
+ < LoadingButton
153
+ disabled = { authenticated }
154
+ variant = "contained"
155
+ loading = { externalAuthPollingState === "polling" }
156
+ onClick = { ( ) => {
157
+ window . open ( authURL , "_blank" , "width=900,height=600" ) ;
158
+ startPollingExternalAuth ( ) ;
159
+ } }
160
+ >
161
+ { authenticated ? "Authenticated" : "Click to Login" }
162
+ </ LoadingButton >
154
163
</ TableCell >
155
164
< TableCell >
156
- { ( link || externalAuth ?. authenticated ) && (
157
- < MoreMenu >
158
- < MoreMenuTrigger >
159
- < ThreeDotsButton />
160
- </ MoreMenuTrigger >
161
- < MoreMenuContent >
162
- < MoreMenuItem
163
- onClick = { async ( ) => {
164
- onValidateExternalAuth ( ) ;
165
- // This is kinda jank. It does a refetch of the thing
166
- // it just validated... But we need to refetch to update the
167
- // login button. And the 'onValidateExternalAuth' does the
168
- // message display.
169
- await refetch ( ) ;
170
- } }
171
- >
172
- Test Validate…
173
- </ MoreMenuItem >
174
- < Divider />
175
- < MoreMenuItem
176
- danger
177
- onClick = { async ( ) => {
178
- onUnlinkExternalAuth ( ) ;
179
- await refetch ( ) ;
180
- } }
181
- >
182
- Unlink…
183
- </ MoreMenuItem >
184
- </ MoreMenuContent >
185
- </ MoreMenu >
186
- ) }
165
+ < MoreMenu >
166
+ < MoreMenuTrigger >
167
+ < ThreeDotsButton size = "small" disabled = { ! authenticated } />
168
+ </ MoreMenuTrigger >
169
+ < MoreMenuContent >
170
+ < MoreMenuItem
171
+ onClick = { async ( ) => {
172
+ onValidateExternalAuth ( ) ;
173
+ // This is kinda jank. It does a refetch of the thing
174
+ // it just validated... But we need to refetch to update the
175
+ // login button. And the 'onValidateExternalAuth' does the
176
+ // message display.
177
+ await refetch ( ) ;
178
+ } }
179
+ >
180
+ Test Validate…
181
+ </ MoreMenuItem >
182
+ < Divider />
183
+ < MoreMenuItem
184
+ danger
185
+ onClick = { async ( ) => {
186
+ onUnlinkExternalAuth ( ) ;
187
+ await refetch ( ) ;
188
+ } }
189
+ >
190
+ Unlink…
191
+ </ MoreMenuItem >
192
+ </ MoreMenuContent >
193
+ </ MoreMenu >
187
194
</ TableCell >
188
195
</ TableRow >
189
196
) ;
0 commit comments