@@ -20,7 +20,7 @@ import gitpodIcon from "./icons/gitpod.svg";
20
20
import { ErrorCodes } from "@gitpod/gitpod-protocol/lib/messaging/error" ;
21
21
import { useHistory } from "react-router-dom" ;
22
22
import { trackButtonOrAnchor , trackPathChange , trackLocation } from "./Analytics" ;
23
- import { LicenseInfo , User } from "@gitpod/gitpod-protocol" ;
23
+ import { ContextURL , LicenseInfo , User } from "@gitpod/gitpod-protocol" ;
24
24
import * as GitpodCookie from "@gitpod/gitpod-protocol/lib/util/gitpod-cookie" ;
25
25
import { Experiment } from "./experiments" ;
26
26
import { workspacesPathMain } from "./workspaces/workspaces.routes" ;
@@ -45,6 +45,8 @@ import {
45
45
import { refreshSearchData } from "./components/RepositoryFinder" ;
46
46
import { StartWorkspaceModal } from "./workspaces/StartWorkspaceModal" ;
47
47
import { parseProps } from "./start/StartWorkspace" ;
48
+ import SelectIDEModal from "./settings/SelectIDEModal" ;
49
+ import { StartPage , StartPhase } from "./start/StartPage" ;
48
50
49
51
const Setup = React . lazy ( ( ) => import ( /* webpackPrefetch: true */ "./Setup" ) ) ;
50
52
const Workspaces = React . lazy ( ( ) => import ( /* webpackPrefetch: true */ "./workspaces/Workspaces" ) ) ;
@@ -156,6 +158,7 @@ function App() {
156
158
157
159
const [ loading , setLoading ] = useState < boolean > ( true ) ;
158
160
const [ isWhatsNewShown , setWhatsNewShown ] = useState ( false ) ;
161
+ const [ showUserIdePreference , setShowUserIdePreference ] = useState ( false ) ;
159
162
const [ isSetupRequired , setSetupRequired ] = useState ( false ) ;
160
163
const history = useHistory ( ) ;
161
164
@@ -495,12 +498,26 @@ function App() {
495
498
) ;
496
499
return < div > </ div > ;
497
500
}
501
+ // Prefix with `/#referrer` will specify an IDE for workspace
502
+ // We don't need to show IDE preference in this case
503
+ const shouldUserIdePreferenceShown = User . isOnboardingUser ( user ) && ! hash . startsWith ( ContextURL . REFERRER_PREFIX ) ;
504
+ if ( shouldUserIdePreferenceShown !== showUserIdePreference ) {
505
+ setShowUserIdePreference ( shouldUserIdePreferenceShown ) ;
506
+ }
498
507
const isCreation = window . location . pathname === "/" && hash !== "" ;
499
508
const isWsStart = / \/ s t a r t \/ ? / . test ( window . location . pathname ) && hash !== "" ;
500
509
if ( isWhatsNewShown ) {
501
510
toRender = < WhatsNew onClose = { ( ) => setWhatsNewShown ( false ) } /> ;
502
511
} else if ( isCreation ) {
503
- toRender = < CreateWorkspace contextUrl = { hash } /> ;
512
+ if ( showUserIdePreference ) {
513
+ toRender = (
514
+ < StartPage phase = { StartPhase . Checking } >
515
+ < SelectIDEModal onClose = { ( ) => setShowUserIdePreference ( false ) } />
516
+ </ StartPage >
517
+ ) ;
518
+ } else {
519
+ toRender = < CreateWorkspace contextUrl = { hash } /> ;
520
+ }
504
521
} else if ( isWsStart ) {
505
522
toRender = < StartWorkspace { ...parseProps ( hash , window . location . search ) } /> ;
506
523
} else if ( / ^ ( g i t h u b | g i t l a b ) \. c o m \/ .+ ?/ i. test ( window . location . pathname ) ) {
0 commit comments