Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

feat(auth): center the sign-in form and drop the login illustration (#21647)

Danny Xuef31ba271125
diff --git a/docs/design/onboarding-flow.md b/docs/design/onboarding-flow.md
index b2ebc39b71..ad6247e9b7 100644
--- a/docs/design/onboarding-flow.md
+++ b/docs/design/onboarding-flow.md
@@ -248,7 +248,7 @@ file, which a follow-up may play with the site's `RivePlayer` (`rive.wasm` self-
lazy-loaded on the setup route only, one frame under reduced motion); the query and exploring
pictures are composed for the panel and stay still. Every picture takes 70% of the panel's column,
never under 512px or over 800px, and never taller than the window; the drawn ones scale as one, so a
-wide screen gets the same picture larger. The rocket illustration stays on sign-in and sign-up. Rejected: a constant stage
+wide screen gets the same picture larger. Sign-in and sign-up render in one centered column with no illustration. Rejected: a constant stage
(the panel teaches nothing); the website's closing slogan, or its brand art alone, on screen 1
(decoration beside a form that already has its heading); for screen 3, a diagram of instance,
database and project as labelled boxes (it read as a lesson in three words at once); for screen 4,
@@ -421,7 +421,7 @@ returns to the same screen with the draft.
|---|---|
| `frontend/src/routes/auth/WorkspaceSetupPage.tsx` | Rewrite as four screens with the local draft, validation under each field, and the single commit at Finish. Finish navigates to the project home, as the wizard has since [#21572]. |
| `frontend/src/routes/auth/WorkspaceSetupQuestionnaireStep.tsx` | Retire; the goal moves to screen 2 and the team question is removed. |
-| `frontend/src/app/layouts/SplashLayout.tsx` | Setup variant: a panel slot instead of the fixed illustration. |
+| `frontend/src/app/layouts/SplashLayout.tsx` | Setup variant: a panel slot in the left column; every other auth route renders in one centered column with no illustration. |
| `frontend/src/routes/auth/workspace-setup/` (new) | Beside the route that is their only consumer: screen components, the left panel (the workspace preview, the project with its instances, the project's members, a still frame from bytebase.com's hero Rive file and two pictures composed for the panel), the chips input, whose text field keeps the shared `Input`'s `xs` size, the chips' text size, and only drops its border. The screens use the shared `StepIndicator`, `RadioGroup` and form primitives, with each validation message under its field. |
| `frontend/src/modules/workspace-setup-guide/` | Take the goal and the team size from the wizard; store "just exploring" as a goal of its own, which uses the query journey; mark "explore database" done on arrival with the sample; start at "Connect instance" on the own-instance path; show the team step only above "Just me". |
| `frontend/src/routes/project/projectHomeNextSteps.ts` | Take the goal as an input. With a database present, "Query a database" comes before "Change a database" for the query goal and for "just exploring"; the order is unchanged otherwise. |
diff --git a/frontend/src/app/layouts/SplashLayout.test.tsx b/frontend/src/app/layouts/SplashLayout.test.tsx
index 8d384ed5a0..32acb55638 100644
--- a/frontend/src/app/layouts/SplashLayout.test.tsx
+++ b/frontend/src/app/layouts/SplashLayout.test.tsx
@@ -1,14 +1,9 @@
import { render } from "@testing-library/react";
-import { beforeEach, describe, expect, test, vi } from "vitest";
+import { describe, expect, test, vi } from "vitest";
import { AUTH_SETUP_MODULE, AUTH_SIGNIN_MODULE } from "@/app/router/handles";
-import { PlanType } from "@/types/proto-es/v1/subscription_service_pb";
import { SplashLayout, SplashPanel } from "./SplashLayout";
-const storeState = vi.hoisted(() => ({
- currentPlan: 0,
- isTrialing: false,
- routeName: "",
-}));
+const routeState = vi.hoisted(() => ({ routeName: "" }));
// The routed page, which may put a panel of its own in the left column.
vi.mock("react-router", () => ({
@@ -19,64 +14,57 @@ vi.mock("react-router", () => ({
</SplashPanel>
</div>
),
- useMatches: () => [{ handle: { name: storeState.routeName } }],
+ useMatches: () => [{ handle: { name: routeState.routeName } }],
}));
-vi.mock("@/stores/app", () => {
- type MockState = {
- currentPlan: () => number;
- isTrialing: () => boolean;
- };
- const state = {
- currentPlan: () => storeState.currentPlan,
- isTrialing: () => storeState.isTrialing,
- } satisfies MockState;
- const useAppStore = (selector: (state: MockState) => unknown) =>
- selector(state);
- useAppStore.getState = () => state;
- return { useAppStore };
-});
+// jsdom has no matchMedia; `wide` is whether the viewport is at least lg.
+function renderLayout(routeName: string, { wide = true } = {}) {
+ routeState.routeName = routeName;
+ window.matchMedia = ((query: string) => ({
+ matches: wide,
+ media: query,
+ onchange: null,
+ addEventListener: () => {},
+ removeEventListener: () => {},
+ addListener: () => {},
+ removeListener: () => {},
+ dispatchEvent: () => true,
+ })) as unknown as typeof window.matchMedia;
+ return render(<SplashLayout />);
+}
describe("SplashLayout", () => {
- beforeEach(() => {
- storeState.currentPlan = PlanType.FREE;
- storeState.isTrialing = false;
- storeState.routeName = AUTH_SIGNIN_MODULE;
- });
-
- test("keeps the mounted auth layout stable when subscription loads during login", () => {
- const { container, rerender } = render(<SplashLayout />);
+ test("renders a page alone in one full-width column, whatever panel the page offers", () => {
+ const { container, getByTestId, queryByText } = renderLayout(
+ AUTH_SIGNIN_MODULE
+ );
- expect(container.querySelector("img")).toBeInTheDocument();
-
- storeState.currentPlan = PlanType.ENTERPRISE;
- rerender(<SplashLayout />);
-
- expect(container.querySelector("img")).toBeInTheDocument();
- });
-
- test("keeps the illustration on sign-in, whatever panel the page offers", () => {
- const { container, queryByText } = render(<SplashLayout />);
-
- expect(container.querySelector("img")).toBeInTheDocument();
+ const columns = container.firstElementChild?.children ?? [];
+ expect(columns).toHaveLength(1);
+ expect(columns[0]).toContainElement(getByTestId("auth-page"));
+ expect(columns[0]).not.toHaveClass("lg:w-1/2");
+ expect(columns[0]).not.toHaveClass("lg:flex-none");
expect(queryByText("the page's own panel")).not.toBeInTheDocument();
});
- test.each([
- { plan: "the free plan", currentPlan: PlanType.FREE },
- { plan: "a paid plan", currentPlan: PlanType.ENTERPRISE },
- ])("gives the left column to the setup wizard's panel on $plan", ({
- currentPlan,
- }) => {
- storeState.routeName = AUTH_SETUP_MODULE;
- storeState.currentPlan = currentPlan;
- const { container, getByText, getByTestId } = render(<SplashLayout />);
+ test("gives the left column to the setup wizard's panel from lg", () => {
+ const { container, getByText, getByTestId } =
+ renderLayout(AUTH_SETUP_MODULE);
const panel = getByText("the page's own panel");
const [leftColumn, rightColumn] = container.firstElementChild?.children ?? [];
- expect(container.querySelector("img")).not.toBeInTheDocument();
expect(leftColumn).toContainElement(panel);
expect(rightColumn).toContainElement(getByTestId("auth-page"));
expect(rightColumn).not.toContainElement(panel);
+ expect(rightColumn).toHaveClass("lg:w-1/2", "lg:flex-none");
+ });
+
+ test("gives the setup page no slot below lg, where the left column is hidden", () => {
+ const { getByTestId, queryByText } = renderLayout(AUTH_SETUP_MODULE, {
+ wide: false,
+ });
+
+ expect(getByTestId("auth-page")).toBeInTheDocument();
+ expect(queryByText("the page's own panel")).not.toBeInTheDocument();
});
});
diff --git a/frontend/src/app/layouts/SplashLayout.tsx b/frontend/src/app/layouts/SplashLayout.tsx
index d38df0e3c8..2cef61abfb 100644
--- a/frontend/src/app/layouts/SplashLayout.tsx
+++ b/frontend/src/app/layouts/SplashLayout.tsx
@@ -1,66 +1,60 @@
import { createContext, type ReactNode, useContext, useState } from "react";
import { createPortal } from "react-dom";
import { Outlet, useMatches } from "react-router";
-import { AUTH_SETUP_MODULE, AUTH_SIGNUP_MODULE } from "@/app/router/handles";
-import signinImage from "@/assets/illustration/signin.webp";
-import signupImage from "@/assets/illustration/signup.webp";
-import { useAppStore } from "@/stores/app";
-import { PlanType } from "@/types/proto-es/v1/subscription_service_pb";
+import { AUTH_SETUP_MODULE } from "@/app/router/handles";
+import { useMediaQuery } from "@/hooks/useMediaQuery";
+import { cn } from "@/lib/utils";
// The left column's element on a route that hands that column to its page.
export const SplashPanelContext = createContext<HTMLElement | null>(null);
-// Renders `children` in the layout's left column. On a route that keeps the
-// branding illustration there, it renders nothing.
+// Renders `children` in the layout's left column. On a route that has no
+// left column, it renders nothing.
export function SplashPanel({ children }: { readonly children: ReactNode }) {
const slot = useContext(SplashPanelContext);
return slot ? createPortal(children, slot) : null;
}
-// Two-column auth chrome: the left column holds the branding illustration
-// (shown unless the workspace is on a non-trialing enterprise plan), or on the
-// setup route the wizard's own panel; the routed auth page is on the right.
+// Tailwind's `lg` breakpoint, from which the setup route's left column shows.
+const LEFT_COLUMN_QUERY = "(min-width: 1024px)";
+
+// Auth chrome: the routed auth page is centered in one column. The setup
+// route alone splits in two from lg, with the wizard's own panel on the left
+// and the page in the right half; below lg that column is hidden and the page
+// gets no slot, so the panel is not mounted unseen.
//
-// The right column owns the gutter and the page's share of the viewport (all
-// of it below lg, half from lg). A routed page fills the column up to its own
-// cap (`w-full max-w-*`) and adds no width fraction or side padding of its
-// own, which would compound with the column's.
+// The column owns the gutter and centers the page, which fills it up to its
+// own cap (`w-full max-w-*`) and adds no width fraction or side padding of its
+// own, which would compound with the column's. The column is also the
+// containing block for the page's absolutely positioned children: `pb-24`
+// keeps the sign-in and sign-up `AuthFooter` (`absolute bottom-0`) clear of
+// the form, which therefore sits 24px above true center on every route.
export function SplashLayout() {
const matches = useMatches();
const currentRouteName = (
matches.at(-1)?.handle as { name?: string } | undefined
)?.name;
const pageOwnsPanel = currentRouteName === AUTH_SETUP_MODULE;
+ const leftColumnShown = useMediaQuery(LEFT_COLUMN_QUERY);
const [panelSlot, setPanelSlot] = useState<HTMLElement | null>(null);
- const [showBrandingImage] = useState(() => {
- const store = useAppStore.getState();
- const currentPlan = store.currentPlan();
- return currentPlan !== PlanType.ENTERPRISE || store.isTrialing();
- });
-
return (
- <div className="min-h-screen overflow-hidden flex">
- {pageOwnsPanel ? (
+ <div className="min-h-screen flex">
+ {pageOwnsPanel && (
<div
ref={setPanelSlot}
- className="hidden bg-control-bg lg:flex relative w-0 flex-1 items-center justify-center p-12"
+ className="hidden bg-control-bg lg:flex w-0 flex-1 items-center justify-center p-12"
/>
- ) : showBrandingImage ? (
- <div className="hidden bg-background lg:block relative w-0 flex-1">
- <img
- className="absolute inset-0 h-full w-full object-cover"
- src={
- currentRouteName === AUTH_SIGNUP_MODULE
- ? signupImage
- : signinImage
- }
- alt=""
- />
- </div>
- ) : null}
- <div className="relative mx-auto flex-1 flex flex-col justify-center py-12 pb-24 px-4 sm:px-6 lg:flex-none lg:px-20 lg:w-1/2 xl:px-24">
- <SplashPanelContext.Provider value={pageOwnsPanel ? panelSlot : null}>
+ )}
+ <div
+ className={cn(
+ "relative flex-1 flex flex-col items-center justify-center py-12 pb-24 px-4 sm:px-6",
+ pageOwnsPanel && "lg:flex-none lg:px-20 lg:w-1/2 xl:px-24"
+ )}
+ >
+ <SplashPanelContext.Provider
+ value={pageOwnsPanel && leftColumnShown ? panelSlot : null}
+ >
<Outlet />
</SplashPanelContext.Provider>
</div>
diff --git a/frontend/src/assets/illustration/signin.webp b/frontend/src/assets/illustration/signin.webp
deleted file mode 100644
index 7d1f662428..0000000000
Binary files a/frontend/src/assets/illustration/signin.webp and /dev/null differ
diff --git a/frontend/src/assets/illustration/signup.webp b/frontend/src/assets/illustration/signup.webp
deleted file mode 100644
index 46dd0b1395..0000000000
Binary files a/frontend/src/assets/illustration/signup.webp and /dev/null differ
diff --git a/frontend/src/routes/auth/OAuth2ConsentPage.tsx b/frontend/src/routes/auth/OAuth2ConsentPage.tsx
index ee0c9cb574..fb7898ec6f 100644
--- a/frontend/src/routes/auth/OAuth2ConsentPage.tsx
+++ b/frontend/src/routes/auth/OAuth2ConsentPage.tsx
@@ -363,8 +363,10 @@ export function OAuth2ConsentPage() {
return (
// An interstitial centered on the whole viewport: the card keeps one width
- // wherever it fits and narrows only on narrower screens. SplashLayout's
- // half-width column would narrow it on screens 1024px to 1727px wide.
+ // wherever it fits and narrows only on narrower screens. It stays outside
+ // SplashLayout, whose column reserves `pb-24` for an AuthFooter this page
+ // does not render and widens the gutter to 24px from sm, while the e2e
+ // spec pins a 16px gutter at every width.
<div className="min-h-screen flex flex-col items-center justify-center gap-8 px-4 py-8">
<BytebaseLogo />
<div