From b6101230302935a90b9f3231c393c6c392640514 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?McKayla=20=E3=81=AF=E3=81=AA?= Date: Thu, 30 Jul 2026 00:21:32 +0000 Subject: [PATCH 1/7] feat(site/src/pages/SetupPage): redirect to the template builder after setup --- site/src/pages/SetupPage/SetupPage.test.tsx | 8 ++++---- site/src/pages/SetupPage/SetupPage.tsx | 4 ++-- site/src/pages/SetupPage/SetupPageView.stories.tsx | 12 +++++++++++- site/src/pages/SetupPage/SetupPageView.tsx | 10 +++++++++- 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/site/src/pages/SetupPage/SetupPage.test.tsx b/site/src/pages/SetupPage/SetupPage.test.tsx index e29128541346b..f3122e42707e2 100644 --- a/site/src/pages/SetupPage/SetupPage.test.tsx +++ b/site/src/pages/SetupPage/SetupPage.test.tsx @@ -71,7 +71,7 @@ describe("Setup Page", () => { await waitFor(() => screen.findByText("Password is too short")); }); - it("redirects to the app when setup is successful", async () => { + it("redirects to the template builder when setup is successful", async () => { let userHasBeenCreated = false; server.use( @@ -110,8 +110,8 @@ describe("Setup Page", () => { element: , }, { - path: "/templates", - element:

Templates

, + path: "/templates/new/builder", + element:

Template Builder

, }, ], { initialEntries: ["/setup"] }, @@ -119,7 +119,7 @@ describe("Setup Page", () => { ); await waitForLoaderToBeRemoved(); await fillForm(); - await waitFor(() => screen.findByText("Templates")); + await waitFor(() => screen.findByText("Template Builder")); }); it("calls sendBeacon with telemetry", async () => { diff --git a/site/src/pages/SetupPage/SetupPage.tsx b/site/src/pages/SetupPage/SetupPage.tsx index b1bac76c5a862..1e678e2d126ee 100644 --- a/site/src/pages/SetupPage/SetupPage.tsx +++ b/site/src/pages/SetupPage/SetupPage.tsx @@ -8,7 +8,7 @@ import { useAuthContext } from "#/contexts/auth/AuthProvider"; import { useEmbeddedMetadata } from "#/hooks/useEmbeddedMetadata"; import { pageTitle } from "#/utils/page"; import { sendDeploymentEvent } from "#/utils/telemetry"; -import { SetupPageView } from "./SetupPageView"; +import { SetupPageView, setupCompleteRedirect } from "./SetupPageView"; export const SetupPage: FC = () => { const { @@ -41,7 +41,7 @@ export const SetupPage: FC = () => { // If the user is logged in, navigate to the app if (isSignedIn) { return setupRequired.current ? ( - + ) : ( ); diff --git a/site/src/pages/SetupPage/SetupPageView.stories.tsx b/site/src/pages/SetupPage/SetupPageView.stories.tsx index 5df288a831e1b..52e14cca2ff55 100644 --- a/site/src/pages/SetupPage/SetupPageView.stories.tsx +++ b/site/src/pages/SetupPage/SetupPageView.stories.tsx @@ -2,7 +2,7 @@ import type { Meta, StoryObj } from "@storybook/react-vite"; import { expect, userEvent, waitFor, within } from "storybook/test"; import { chromatic } from "#/testHelpers/chromatic"; import { mockApiError } from "#/testHelpers/entities"; -import { SetupPageView } from "./SetupPageView"; +import { SetupPageView, setupCompleteRedirect } from "./SetupPageView"; const meta: Meta = { title: "pages/SetupPage", @@ -23,6 +23,16 @@ export const WithGitHub: Story = { password: { enabled: true }, }, }, + play: async ({ canvasElement }) => { + const canvas = within(canvasElement); + const github = canvas.getByRole("link", { name: "GitHub" }); + expect(github).toHaveAttribute( + "href", + `/api/v2/users/oauth2/github/callback?redirect=${encodeURIComponent( + setupCompleteRedirect, + )}`, + ); + }, }; export const FormError: Story = { diff --git a/site/src/pages/SetupPage/SetupPageView.tsx b/site/src/pages/SetupPage/SetupPageView.tsx index 2bd0a31c5f73b..bf1c34216f7c8 100644 --- a/site/src/pages/SetupPage/SetupPageView.tsx +++ b/site/src/pages/SetupPage/SetupPageView.tsx @@ -28,6 +28,10 @@ import { onChangeTrimmed, } from "#/utils/formUtils"; +// A deployment that just finished setup has no templates, so the first user is +// handed off to the template builder instead of an empty dashboard. +export const setupCompleteRedirect = "/templates/new/builder"; + const usernameValidator = nameValidator("Username"); const usernameFromEmail = (email: string): string => { try { @@ -210,7 +214,11 @@ export const SetupPageView: FC = ({ {authMethods?.github.enabled && ( <>