@@ -14,7 +14,6 @@ import ContextMenu, { ContextMenuEntry } from "../components/ContextMenu";
14
14
import CaretDown from "../icons/CaretDown.svg" ;
15
15
import Plus from "../icons/Plus.svg" ;
16
16
import Switch from "../icons/Switch.svg" ;
17
- import NoAccess from "../icons/NoAccess.svg" ;
18
17
import search from "../icons/search.svg" ;
19
18
import moment from "moment" ;
20
19
import { UserContext } from "../user-context" ;
@@ -30,7 +29,6 @@ export default function NewProject() {
30
29
const [ reposInAccounts , setReposInAccounts ] = useState < ProviderRepository [ ] > ( [ ] ) ;
31
30
const [ repoSearchFilter , setRepoSearchFilter ] = useState < string > ( "" ) ;
32
31
const [ selectedAccount , setSelectedAccount ] = useState < string | undefined > ( undefined ) ;
33
- const [ noOrgs , setNoOrgs ] = useState < boolean > ( false ) ;
34
32
const [ showGitProviders , setShowGitProviders ] = useState < boolean > ( false ) ;
35
33
const [ selectedRepo , setSelectedRepo ] = useState < ProviderRepository | undefined > ( undefined ) ;
36
34
const [ selectedTeamOrUser , setSelectedTeamOrUser ] = useState < Team | User | undefined > ( undefined ) ;
@@ -147,7 +145,6 @@ export default function NewProject() {
147
145
return ;
148
146
}
149
147
( async ( ) => {
150
- updateOrgsState ( ) ;
151
148
await updateReposInAccounts ( ) ;
152
149
} ) ( ) ;
153
150
} , [ selectedProviderHost ] ) ;
@@ -183,20 +180,6 @@ export default function NewProject() {
183
180
return [ ] ;
184
181
}
185
182
186
- const getToken = async ( host : string ) => {
187
- return getGitpodService ( ) . server . getToken ( { host } ) ;
188
- }
189
-
190
- const updateOrgsState = async ( ) => {
191
- if ( selectedProviderHost && isGitHub ( ) ) {
192
- try {
193
- const ghToken = await getToken ( selectedProviderHost ) ;
194
- setNoOrgs ( ghToken ?. scopes . includes ( "read:org" ) !== true ) ;
195
- } catch {
196
- }
197
- }
198
- }
199
-
200
183
const reconfigure = ( ) => {
201
184
openReconfigureWindow ( {
202
185
account : selectedAccount ,
@@ -210,21 +193,6 @@ export default function NewProject() {
210
193
} ) ;
211
194
}
212
195
213
- const grantReadOrgPermissions = async ( ) => {
214
- try {
215
- await openAuthorizeWindow ( {
216
- host : "github.com" ,
217
- scopes : [ "read:org" ] ,
218
- onSuccess : ( ) => {
219
- updateReposInAccounts ( ) ;
220
- updateOrgsState ( ) ;
221
- }
222
- } )
223
- } catch ( error ) {
224
- console . log ( error ) ;
225
- }
226
- }
227
-
228
196
const createProject = async ( teamOrUser : Team | User , repo : ProviderRepository ) => {
229
197
if ( ! selectedProviderHost || isBitbucket ( ) ) {
230
198
return ;
@@ -266,7 +234,15 @@ export default function NewProject() {
266
234
< span className = { "pl-2 text-gray-600 dark:text-gray-100 text-base " + ( addClasses || "" ) } > { label } </ span >
267
235
</ div > )
268
236
const result : ContextMenuEntry [ ] = [ ] ;
269
- for ( const [ account , props ] of accounts . entries ( ) ) {
237
+
238
+ if ( ! selectedAccount && user && user . name && user . avatarUrl ) {
239
+ result . push ( {
240
+ title : "user" ,
241
+ customContent : renderItemContent ( user ?. name , user ?. avatarUrl ) ,
242
+ separator : true ,
243
+ } )
244
+ }
245
+ for ( const [ account , props ] of accounts . entries ( ) ) {
270
246
result . push ( {
271
247
title : account ,
272
248
customContent : renderItemContent ( account , props . avatarUrl , "font-semibold" ) ,
@@ -300,15 +276,24 @@ export default function NewProject() {
300
276
const showSearchInput = ! ! repoSearchFilter || filteredRepos . length > 0 ;
301
277
302
278
const renderRepos = ( ) => ( < >
303
- { ! isBitbucket ( ) && < p className = "text-gray-500 text-center text-base" > Select a Git repository on < strong > { selectedProviderHost } </ strong > . (< a className = "gp-link cursor-pointer" onClick = { ( ) => setShowGitProviders ( true ) } > change</ a > )</ p > }
304
- < div className = { `mt-10 border rounded-xl border-gray-100 dark:border-gray-800 flex-col` } >
305
- < div className = "px-8 pt-8 flex flex-col space-y-2" data-analytics = '{"label":"Identity"}' >
279
+ < p className = "text-gray-500 text-center text-base" > Projects allow you to manage prebuilds and workspaces for your repository. < a href = "https://www.gitpod.io/docs/teams-and-projects" rel = "noopener" className = "gp-link" > Learn more</ a > </ p >
280
+ < p className = "text-gray-500 text-center text-base mt-12" > Select acccount on < b > { selectedProviderHost } </ b > (< a className = "gp-link cursor-pointer" onClick = { ( ) => setShowGitProviders ( true ) } > change</ a > )</ p >
281
+ < div className = { `mt-2 flex-col w-96` } >
282
+ < div className = "px-8 pt-5 flex flex-col space-y-2" data-analytics = '{"label":"Identity"}' >
306
283
< ContextMenu classes = "w-full left-0 cursor-pointer" menuEntries = { getDropDownEntries ( accounts ) } >
307
284
< div className = "w-full" >
285
+ { ! selectedAccount && (
286
+ < >
287
+ < img src = { user ?. avatarUrl } className = "rounded-full w-6 h-6 absolute top-1/4 left-3" />
288
+ < input className = "w-full px-12 cursor-pointer font-semibold" readOnly type = "text" value = { user ?. name } > </ input >
289
+ </ >
290
+ ) }
308
291
{ icon && (
309
- < img src = { icon } className = "rounded-full w-6 h-6 absolute top-1/4 left-4" />
292
+ < >
293
+ < img src = { icon } className = "rounded-full w-6 h-6 absolute top-1/4 left-3" />
294
+ < input className = "w-full px-12 cursor-pointer font-semibold" readOnly type = "text" value = { selectedAccount } > </ input >
295
+ </ >
310
296
) }
311
- < input className = "w-full px-12 cursor-pointer font-semibold" readOnly type = "text" value = { selectedAccount || "" } > </ input >
312
297
< img src = { CaretDown } title = "Select Account" className = "filter-grayscale absolute top-1/2 right-3" />
313
298
</ div >
314
299
</ ContextMenu >
@@ -348,49 +333,35 @@ export default function NewProject() {
348
333
) }
349
334
{ loaded && noReposAvailable && isGitHub ( ) && ( < div >
350
335
< div className = "px-12 py-20 text-center text-gray-500 bg-gray-50 dark:bg-gray-800 rounded-xl" >
351
- < img src = { NoAccess } title = "No Access" className = "m-auto mb-4" />
352
- < h3 className = "text-center text-gray-600 dark:text-gray-50 pb-3 font-bold" >
353
- No Access
354
- </ h3 >
355
336
< span className = "dark:text-gray-400" >
356
- Authorize GitHub (github.com) or select a different account .
337
+ Additional authorization is required to allow access to your repositories and trigger prebuilds for every new push to any of your branches .
357
338
</ span >
358
339
< br />
359
- < button className = "mt-6" onClick = { ( ) => reconfigure ( ) } > Authorize </ button >
340
+ < button className = "mt-6" onClick = { ( ) => reconfigure ( ) } > Configure Gitpod App </ button >
360
341
</ div >
361
342
</ div > ) }
362
343
</ div >
363
344
364
345
</ div >
365
- { isGitHub ( ) && (
366
- < div className = "pt-3" >
367
- < div className = "text-gray-500 text-center w-96 mx-8" >
368
- Repository not found? < a href = "javascript:void(0)" onClick = { e => reconfigure ( ) } className = "text-gray-400 underline underline-thickness-thin underline-offset-small hover:text-gray-600" > Reconfigure</ a >
369
- </ div >
370
- { isGitHub ( ) && noOrgs && (
371
- < div className = "text-gray-500 mx-auto text-center" >
372
- Missing organizations? < a href = "javascript:void(0)" onClick = { e => grantReadOrgPermissions ( ) } className = "text-gray-400 underline underline-thickness-thin underline-offset-small hover:text-gray-600" > Grant permissions</ a >
373
- </ div >
374
- ) }
375
- </ div >
376
- ) }
377
- < p className = "text-left w-full mt-12 text-gray-500" >
378
- < strong > Teams & Projects</ strong > are currently in Beta. < a href = "https://github.com/gitpod-io/gitpod/issues/5095" target = "gitpod-feedback-issue" rel = "noopener" className = "gp-link" > Send feedback</ a > or open a < a href = "/workspaces" className = "gp-link" > New Workspace</ a > with an example repository.
346
+ < p className = "text-center w-full mt-12 text-gray-500" >
347
+ < strong > Teams & Projects</ strong > are currently in Beta. < a href = "https://github.com/gitpod-io/gitpod/issues/5095" target = "gitpod-feedback-issue" rel = "noopener" className = "gp-link" > Send feedback</ a >
379
348
</ p >
380
349
</ >
381
350
) ;
382
351
383
- const renderLoadingState = ( ) => ( < div >
384
- < div className = "mt-8 border rounded-xl border-gray-100 dark:border-gray-700 flex-col" >
385
- < div >
386
- < div className = "px-12 py-16 text-center text-gray-500 bg-gray-50 dark:bg-gray-800 rounded-xl w-96 h-h96 flex items-center justify-center" >
387
- < h3 className = "mb-2 text-gray-400 dark:text-gray-600 animate-pulse" >
388
- Loading ...
389
- </ h3 >
352
+ const renderLoadingState = ( ) => (
353
+ < div >
354
+ < p className = "text-gray-500 text-center text-base" > Projects allow you to manage prebuilds and workspaces for your repository. < a href = "https://www.gitpod.io/docs/teams-and-projects" rel = "noopener" className = "gp-link" > Learn more</ a > </ p >
355
+ < div className = "mt-8 border rounded-xl border-gray-100 dark:border-gray-700 flex-col" >
356
+ < div >
357
+ < div className = "px-12 py-16 text-center text-gray-500 bg-gray-50 dark:bg-gray-800 rounded-xl w-96 h-h96 flex items-center justify-center" >
358
+ < h3 className = "mb-2 text-gray-400 dark:text-gray-600 animate-pulse" >
359
+ Loading ...
360
+ </ h3 >
361
+ </ div >
390
362
</ div >
391
363
</ div >
392
- </ div >
393
- </ div > )
364
+ </ div > )
394
365
395
366
const onGitProviderSeleted = async ( host : string , updateUser ?: boolean ) => {
396
367
if ( updateUser ) {
@@ -458,13 +429,13 @@ export default function NewProject() {
458
429
const renderBitbucketWarning = ( ) => {
459
430
return (
460
431
< div className = "mt-16 flex space-x-2 py-6 px-6 w-96 justify-betweeen bg-gitpod-kumquat-light rounded-xl" >
461
- < div className = "pr-3 self-center w-6" >
462
- < img src = { exclamation } />
463
- </ div >
464
- < div className = "flex-1 flex flex-col" >
465
- < p className = "text-gitpod-red text-sm" > Bitbucket support for projects is not available yet. Follow < a className = "gp-link" href = "https://github.com/gitpod-io/gitpod/issues/5980" > #5980</ a > for updates.</ p >
466
- </ div >
467
- </ div > ) ;
432
+ < div className = "pr-3 self-center w-6" >
433
+ < img src = { exclamation } />
434
+ </ div >
435
+ < div className = "flex-1 flex flex-col" >
436
+ < p className = "text-gitpod-red text-sm" > Bitbucket support for projects is not available yet. Follow < a className = "gp-link" href = "https://github.com/gitpod-io/gitpod/issues/5980" > #5980</ a > for updates.</ p >
437
+ </ div >
438
+ </ div > ) ;
468
439
}
469
440
470
441
const onNewWorkspace = async ( ) => {
0 commit comments