Skip to content

Commit 037a480

Browse files
mustard-mhroboquat
authored andcommitted
[dashboard] increase IDE awareness for onboarding user when starting workspace
1 parent b294096 commit 037a480

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

components/dashboard/src/App.tsx

+16-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import gitpodIcon from "./icons/gitpod.svg";
2020
import { ErrorCodes } from "@gitpod/gitpod-protocol/lib/messaging/error";
2121
import { useHistory } from "react-router-dom";
2222
import { trackButtonOrAnchor, trackPathChange, trackLocation } from "./Analytics";
23-
import { LicenseInfo, User } from "@gitpod/gitpod-protocol";
23+
import { ContextURL, LicenseInfo, User } from "@gitpod/gitpod-protocol";
2424
import * as GitpodCookie from "@gitpod/gitpod-protocol/lib/util/gitpod-cookie";
2525
import { Experiment } from "./experiments";
2626
import { workspacesPathMain } from "./workspaces/workspaces.routes";
@@ -45,6 +45,8 @@ import {
4545
import { refreshSearchData } from "./components/RepositoryFinder";
4646
import { StartWorkspaceModal } from "./workspaces/StartWorkspaceModal";
4747
import { parseProps } from "./start/StartWorkspace";
48+
import SelectIDEModal from "./settings/SelectIDEModal";
49+
import { StartPage, StartPhase } from "./start/StartPage";
4850

4951
const Setup = React.lazy(() => import(/* webpackPrefetch: true */ "./Setup"));
5052
const Workspaces = React.lazy(() => import(/* webpackPrefetch: true */ "./workspaces/Workspaces"));
@@ -495,12 +497,24 @@ function App() {
495497
);
496498
return <div></div>;
497499
}
500+
// Prefix with `/#referrer` will specify an IDE for workspace
501+
// We don't need to show IDE preference in this case
502+
const shouldUserIdePreferenceShown = User.isOnboardingUser(user) && !hash.startsWith(ContextURL.REFERRER_PREFIX);
503+
498504
const isCreation = window.location.pathname === "/" && hash !== "";
499505
const isWsStart = /\/start\/?/.test(window.location.pathname) && hash !== "";
500506
if (isWhatsNewShown) {
501507
toRender = <WhatsNew onClose={() => setWhatsNewShown(false)} />;
502508
} else if (isCreation) {
503-
toRender = <CreateWorkspace contextUrl={hash} />;
509+
if (shouldUserIdePreferenceShown) {
510+
toRender = (
511+
<StartPage phase={StartPhase.Checking}>
512+
<SelectIDEModal />
513+
</StartPage>
514+
);
515+
} else {
516+
toRender = <CreateWorkspace contextUrl={hash} />;
517+
}
504518
} else if (isWsStart) {
505519
toRender = <StartWorkspace {...parseProps(hash, window.location.search)} />;
506520
} else if (/^(github|gitlab)\.com\/.+?/i.test(window.location.pathname)) {

components/dashboard/src/settings/SelectIDEModal.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import SelectIDE, { updateUserIDEInfo } from "./SelectIDE";
1111
import Modal from "../components/Modal";
1212
import { UserContext } from "../user-context";
1313

14-
export default function () {
14+
export default function (props: { onClose?: () => void }) {
1515
const { user, setUser } = useContext(UserContext);
1616
const [visible, setVisible] = useState(true);
1717

@@ -23,11 +23,13 @@ export default function () {
2323
const handleContinue = async () => {
2424
setVisible(false);
2525
if (!user || User.hasPreferredIde(user)) {
26+
props.onClose && props.onClose();
2627
return;
2728
}
2829
// TODO: We need to get defaultIde in ideOptions..
2930
const defaultIde = "code";
3031
await actualUpdateUserIDEInfo(user, defaultIde, false);
32+
props.onClose && props.onClose();
3133
};
3234

3335
return (

0 commit comments

Comments
 (0)