@@ -10,7 +10,7 @@ import SelectIDEModal from "../user-settings/SelectIDEModal";
10
10
import { StartPage , StartPhase } from "../start/StartPage" ;
11
11
import { getURLHash , isGitpodIo , isLocalPreview } from "../utils" ;
12
12
import { shouldSeeWhatsNew , WhatsNew } from "../whatsnew/WhatsNew" ;
13
- import { Redirect , Route , Switch } from "react-router" ;
13
+ import { Redirect , Route , Switch , useLocation } from "react-router" ;
14
14
import Menu from "../menu/Menu" ;
15
15
import { parseProps } from "../start/StartWorkspace" ;
16
16
import { AppNotifications } from "../AppNotifications" ;
@@ -41,9 +41,10 @@ import { Blocked } from "./Blocked";
41
41
import { BlockedRepositories } from "../admin/BlockedRepositories" ;
42
42
import PersonalAccessTokenCreateView from "../user-settings/PersonalAccessTokensCreateView" ;
43
43
import { StartWorkspaceModalContext } from "../workspaces/start-workspace-modal-context" ;
44
- import { StartWorkspaceOptions } from "../start/start-workspace-options" ;
45
44
import { WebsocketClients } from "./WebsocketClients" ;
46
45
import { OrgRequiredRoute } from "./OrgRequiredRoute" ;
46
+ import { useFeatureFlags } from "../contexts/FeatureFlagContext" ;
47
+ import { CreateWorkspacePage } from "../workspaces/CreateWorkspacePage" ;
47
48
48
49
const Setup = React . lazy ( ( ) => import ( /* webpackPrefetch: true */ "../Setup" ) ) ;
49
50
const WorkspacesNew = React . lazy ( ( ) => import ( /* webpackPrefetch: true */ "../workspaces/WorkspacesNew" ) ) ;
@@ -97,6 +98,8 @@ export const AppRoutes: FunctionComponent<AppRoutesProps> = ({ user, teams }) =>
97
98
const hash = getURLHash ( ) ;
98
99
const { startWorkspaceModalProps, setStartWorkspaceModalProps } = useContext ( StartWorkspaceModalContext ) ;
99
100
const [ isWhatsNewShown , setWhatsNewShown ] = useState ( shouldSeeWhatsNew ( user ) ) ;
101
+ const { startWithOptions } = useFeatureFlags ( ) ;
102
+ const location = useLocation ( ) ;
100
103
101
104
// Prefix with `/#referrer` will specify an IDE for workspace
102
105
// We don't need to show IDE preference in this case
@@ -105,12 +108,12 @@ export const AppRoutes: FunctionComponent<AppRoutesProps> = ({ user, teams }) =>
105
108
) ;
106
109
107
110
// TODO: Add a Route for this instead of inspecting location manually
108
- if ( window . location . pathname . startsWith ( "/blocked" ) ) {
111
+ if ( location . pathname . startsWith ( "/blocked" ) ) {
109
112
return < Blocked /> ;
110
113
}
111
114
112
115
// TODO: Add a Route for this instead of inspecting location manually
113
- if ( window . location . pathname . startsWith ( "/oauth-approval" ) ) {
116
+ if ( location . pathname . startsWith ( "/oauth-approval" ) ) {
114
117
return < OAuthClientApproval /> ;
115
118
}
116
119
@@ -119,26 +122,24 @@ export const AppRoutes: FunctionComponent<AppRoutesProps> = ({ user, teams }) =>
119
122
}
120
123
121
124
// TODO: Try and encapsulate this in a route for "/" (check for hash in route component, render or redirect accordingly)
122
- const isCreation = window . location . pathname === "/" && hash !== "" ;
125
+ const isCreation = location . pathname === "/" && hash !== "" ;
123
126
if ( isCreation ) {
124
127
if ( showUserIdePreference ) {
125
128
return (
126
129
< StartPage phase = { StartPhase . Checking } >
127
130
< SelectIDEModal location = "workspace_start" onClose = { ( ) => setShowUserIdePreference ( false ) } />
128
131
</ StartPage >
129
132
) ;
130
- } else if ( new URLSearchParams ( window . location . search ) . has ( "showOptions" ) ) {
131
- const props = StartWorkspaceOptions . parseSearchParams ( window . location . search ) ;
133
+ } else if (
134
+ new URLSearchParams ( location . search ) . has ( "showOptions" ) ||
135
+ startWithOptions ||
136
+ user ?. additionalData ?. isMigratedToTeamOnlyAttribution
137
+ ) {
132
138
return (
133
- < StartWorkspaceModal
134
- { ...{
135
- contextUrl : hash ,
136
- ide : props ?. ideSettings ?. defaultIde ,
137
- uselatestIde : props ?. ideSettings ?. useLatestVersion ,
138
- workspaceClass : props . workspaceClass ,
139
- onClose : undefined ,
140
- } }
141
- />
139
+ < div className = "container" >
140
+ < Menu />
141
+ < CreateWorkspacePage />
142
+ </ div >
142
143
) ;
143
144
} else {
144
145
return < CreateWorkspace contextUrl = { hash } /> ;
0 commit comments