fix: link workspaces empty state to template builder (#28280)

This commit is contained in:
McKayla はな
2026-08-18 18:30:28 -06:00
committed by GitHub
parent 71e95a3611
commit 60722bb653
2 changed files with 39 additions and 1 deletions
@@ -54,7 +54,7 @@ export const WorkspacesEmpty: FC<WorkspacesEmptyProps> = ({
description={`${defaultMessage} To create a workspace, you first need to create a template.`}
cta={
<Button asChild>
<Link to="/templates">Go to templates</Link>
<Link to="/templates/new/builder">Create a template</Link>
</Button>
}
className="pb-0"
@@ -7,6 +7,7 @@ import {
waitFor,
within,
} from "storybook/test";
import { reactRouterParameters } from "storybook-addon-remix-react-router";
import { API } from "#/api/api";
import { getAuthorizationKey } from "#/api/queries/authCheck";
import { workspacePermissionsByOrganization } from "#/api/queries/organizations";
@@ -241,6 +242,43 @@ export const Empty: Story = {
},
};
export const EmptyWithoutTemplates: Story = {
parameters: {
permissions: {
createTemplates: true,
createWorkspace: true,
},
queries: [
{
key: getTemplatesQueryKey(),
data: [],
},
{
key: workspacesKey({ q: "owner:me", limit: 25, offset: 0 }),
data: { workspaces: [], count: 0 },
},
],
reactRouter: reactRouterParameters({
location: { path: "/workspaces" },
routing: [
{ path: "/workspaces", useStoryElement: true },
{
path: "/templates/new/builder",
element: <div>Template builder</div>,
},
],
}),
},
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
const user = userEvent.setup();
await user.click(
await canvas.findByRole("link", { name: "Create a template" }),
);
await canvas.findByText("Template builder");
},
};
export const RendersWorkspaces: Story = {
beforeEach: () => {
spyOn(API, "getWorkspaces").mockResolvedValue(MockWorkspacesResponse);