mirror of
https://github.com/coder/coder.git
synced 2026-09-21 20:51:01 +08:00
chore: fix storybook flakes (#19366)
Close https://github.com/coder/coder/issues/19365
This commit is contained in:
@@ -6,13 +6,13 @@ const meta: Meta<typeof ActiveUserChart> = {
|
||||
component: ActiveUserChart,
|
||||
args: {
|
||||
data: [
|
||||
{ date: "2024-01-01", amount: 5 },
|
||||
{ date: "2024-01-02", amount: 6 },
|
||||
{ date: "2024-01-03", amount: 7 },
|
||||
{ date: "2024-01-04", amount: 8 },
|
||||
{ date: "2024-01-05", amount: 9 },
|
||||
{ date: "2024-01-06", amount: 10 },
|
||||
{ date: "2024-01-07", amount: 11 },
|
||||
{ date: "2024-01-01", amount: 12 },
|
||||
{ date: "2024-01-02", amount: 8 },
|
||||
{ date: "2024-01-03", amount: 15 },
|
||||
{ date: "2024-01-04", amount: 3 },
|
||||
{ date: "2024-01-05", amount: 22 },
|
||||
{ date: "2024-01-06", amount: 7 },
|
||||
{ date: "2024-01-07", amount: 18 },
|
||||
],
|
||||
},
|
||||
decorators: [
|
||||
@@ -31,12 +31,31 @@ export const Example: Story = {};
|
||||
|
||||
export const ManyDataPoints: Story = {
|
||||
args: {
|
||||
data: Array.from({ length: 30 }).map((_, i) => {
|
||||
const date = new Date(2024, 0, i + 1);
|
||||
return {
|
||||
date: date.toISOString().split("T")[0],
|
||||
amount: 5 + Math.floor(Math.random() * 15),
|
||||
};
|
||||
}),
|
||||
data: [
|
||||
{ date: "2024-01-01", amount: 12 },
|
||||
{ date: "2024-01-02", amount: 8 },
|
||||
{ date: "2024-01-03", amount: 15 },
|
||||
{ date: "2024-01-04", amount: 3 },
|
||||
{ date: "2024-01-05", amount: 22 },
|
||||
{ date: "2024-01-06", amount: 7 },
|
||||
{ date: "2024-01-07", amount: 18 },
|
||||
{ date: "2024-01-08", amount: 31 },
|
||||
{ date: "2024-01-09", amount: 5 },
|
||||
{ date: "2024-01-10", amount: 27 },
|
||||
{ date: "2024-01-11", amount: 14 },
|
||||
{ date: "2024-01-12", amount: 9 },
|
||||
{ date: "2024-01-13", amount: 35 },
|
||||
{ date: "2024-01-14", amount: 21 },
|
||||
{ date: "2024-01-15", amount: 6 },
|
||||
{ date: "2024-01-16", amount: 29 },
|
||||
{ date: "2024-01-17", amount: 11 },
|
||||
{ date: "2024-01-18", amount: 17 },
|
||||
{ date: "2024-01-19", amount: 4 },
|
||||
{ date: "2024-01-20", amount: 25 },
|
||||
{ date: "2024-01-21", amount: 13 },
|
||||
{ date: "2024-01-22", amount: 33 },
|
||||
{ date: "2024-01-23", amount: 19 },
|
||||
{ date: "2024-01-24", amount: 26 },
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import isChromatic from "chromatic/isChromatic";
|
||||
import {
|
||||
animals,
|
||||
colors,
|
||||
@@ -6,6 +7,9 @@ import {
|
||||
} from "unique-names-generator";
|
||||
|
||||
export const generateWorkspaceName = () => {
|
||||
if (isChromatic()) {
|
||||
return "yellow-bird-23";
|
||||
}
|
||||
const numberDictionary = NumberDictionary.generate({ min: 0, max: 99 });
|
||||
return uniqueNamesGenerator({
|
||||
dictionaries: [colors, animals, numberDictionary],
|
||||
|
||||
+4
-4
@@ -11,7 +11,7 @@ import { templateByNameKey } from "api/queries/templates";
|
||||
import { workspaceByOwnerAndNameKey } from "api/queries/workspaces";
|
||||
import type { Workspace } from "api/typesGenerated";
|
||||
import {
|
||||
reactRouterNestedAncestors,
|
||||
reactRouterOutlet,
|
||||
reactRouterParameters,
|
||||
} from "storybook-addon-remix-react-router";
|
||||
import { WorkspaceSettingsLayout } from "../WorkspaceSettingsLayout";
|
||||
@@ -19,7 +19,7 @@ import WorkspaceSchedulePage from "./WorkspaceSchedulePage";
|
||||
|
||||
const meta = {
|
||||
title: "pages/WorkspaceSchedulePage",
|
||||
component: WorkspaceSchedulePage,
|
||||
component: WorkspaceSettingsLayout,
|
||||
decorators: [withAuthProvider, withDashboardProvider],
|
||||
parameters: {
|
||||
layout: "fullscreen",
|
||||
@@ -52,11 +52,11 @@ function workspaceRouterParameters(workspace: Workspace) {
|
||||
workspace: workspace.name,
|
||||
},
|
||||
},
|
||||
routing: reactRouterNestedAncestors(
|
||||
routing: reactRouterOutlet(
|
||||
{
|
||||
path: "/:username/:workspace/settings/schedule",
|
||||
},
|
||||
<WorkspaceSettingsLayout />,
|
||||
<WorkspaceSchedulePage />,
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user