diff --git a/components/dashboard/src/App.tsx b/components/dashboard/src/App.tsx index 3285d62b77d228..8259da14dfc1c5 100644 --- a/components/dashboard/src/App.tsx +++ b/components/dashboard/src/App.tsx @@ -20,7 +20,7 @@ import gitpodIcon from "./icons/gitpod.svg"; import { ErrorCodes } from "@gitpod/gitpod-protocol/lib/messaging/error"; import { useHistory } from "react-router-dom"; import { trackButtonOrAnchor, trackPathChange, trackLocation } from "./Analytics"; -import { LicenseInfo, User } from "@gitpod/gitpod-protocol"; +import { ContextURL, LicenseInfo, User } from "@gitpod/gitpod-protocol"; import * as GitpodCookie from "@gitpod/gitpod-protocol/lib/util/gitpod-cookie"; import { Experiment } from "./experiments"; import { workspacesPathMain } from "./workspaces/workspaces.routes"; @@ -45,6 +45,8 @@ import { import { refreshSearchData } from "./components/RepositoryFinder"; import { StartWorkspaceModal } from "./workspaces/StartWorkspaceModal"; import { parseProps } from "./start/StartWorkspace"; +import SelectIDEModal from "./settings/SelectIDEModal"; +import { StartPage, StartPhase } from "./start/StartPage"; const Setup = React.lazy(() => import(/* webpackPrefetch: true */ "./Setup")); const Workspaces = React.lazy(() => import(/* webpackPrefetch: true */ "./workspaces/Workspaces")); @@ -495,12 +497,24 @@ function App() { ); return
; } + // Prefix with `/#referrer` will specify an IDE for workspace + // We don't need to show IDE preference in this case + const shouldUserIdePreferenceShown = User.isOnboardingUser(user) && !hash.startsWith(ContextURL.REFERRER_PREFIX); + const isCreation = window.location.pathname === "/" && hash !== ""; const isWsStart = /\/start\/?/.test(window.location.pathname) && hash !== ""; if (isWhatsNewShown) { toRender = setWhatsNewShown(false)} />; } else if (isCreation) { - toRender = ; + if (shouldUserIdePreferenceShown) { + toRender = ( + + + + ); + } else { + toRender = ; + } } else if (isWsStart) { toRender = ; } else if (/^(github|gitlab)\.com\/.+?/i.test(window.location.pathname)) { diff --git a/components/dashboard/src/settings/SelectIDEModal.tsx b/components/dashboard/src/settings/SelectIDEModal.tsx index df6ddb2b19a2de..3457bf6d503c2d 100644 --- a/components/dashboard/src/settings/SelectIDEModal.tsx +++ b/components/dashboard/src/settings/SelectIDEModal.tsx @@ -11,7 +11,7 @@ import SelectIDE, { updateUserIDEInfo } from "./SelectIDE"; import Modal from "../components/Modal"; import { UserContext } from "../user-context"; -export default function () { +export default function (props: { onClose?: () => void }) { const { user, setUser } = useContext(UserContext); const [visible, setVisible] = useState(true); @@ -23,11 +23,13 @@ export default function () { const handleContinue = async () => { setVisible(false); if (!user || User.hasPreferredIde(user)) { + props.onClose && props.onClose(); return; } // TODO: We need to get defaultIde in ideOptions.. const defaultIde = "code"; await actualUpdateUserIDEInfo(user, defaultIde, false); + props.onClose && props.onClose(); }; return (