|
| 1 | +import type { Plan } from "@features/sessions/types"; |
| 2 | +import type { Meta, StoryObj } from "@storybook/react-vite"; |
| 3 | +import { PlanStatusBar } from "./PlanStatusBar"; |
| 4 | + |
| 5 | +const meta: Meta<typeof PlanStatusBar> = { |
| 6 | + title: "Sessions/PlanStatusBar", |
| 7 | + component: PlanStatusBar, |
| 8 | + parameters: { |
| 9 | + layout: "fullscreen", |
| 10 | + }, |
| 11 | +}; |
| 12 | + |
| 13 | +export default meta; |
| 14 | +type Story = StoryObj<typeof PlanStatusBar>; |
| 15 | + |
| 16 | +const createPlan = ( |
| 17 | + entries: Array<{ |
| 18 | + content: string; |
| 19 | + status: "pending" | "in_progress" | "completed" | "failed"; |
| 20 | + }>, |
| 21 | +): Plan => |
| 22 | + ({ |
| 23 | + sessionUpdate: "plan", |
| 24 | + entries: entries.map((e) => ({ |
| 25 | + content: e.content, |
| 26 | + activeForm: e.content, |
| 27 | + status: e.status, |
| 28 | + })), |
| 29 | + }) as unknown as Plan; |
| 30 | + |
| 31 | +export const InProgress: Story = { |
| 32 | + args: { |
| 33 | + plan: createPlan([ |
| 34 | + { content: "Create database schema", status: "completed" }, |
| 35 | + { content: "Implement authentication endpoints", status: "completed" }, |
| 36 | + { content: "Add middleware for protected routes", status: "in_progress" }, |
| 37 | + { content: "Write unit tests", status: "pending" }, |
| 38 | + { content: "Write integration tests", status: "pending" }, |
| 39 | + ]), |
| 40 | + }, |
| 41 | +}; |
| 42 | + |
| 43 | +export const JustStarted: Story = { |
| 44 | + args: { |
| 45 | + plan: createPlan([ |
| 46 | + { content: "Analyze codebase structure", status: "in_progress" }, |
| 47 | + { content: "Identify files to modify", status: "pending" }, |
| 48 | + { content: "Implement changes", status: "pending" }, |
| 49 | + { content: "Run tests", status: "pending" }, |
| 50 | + ]), |
| 51 | + }, |
| 52 | +}; |
| 53 | + |
| 54 | +export const NearlyComplete: Story = { |
| 55 | + args: { |
| 56 | + plan: createPlan([ |
| 57 | + { content: "Create database schema", status: "completed" }, |
| 58 | + { content: "Implement authentication endpoints", status: "completed" }, |
| 59 | + { content: "Add middleware for protected routes", status: "completed" }, |
| 60 | + { content: "Write unit tests", status: "completed" }, |
| 61 | + { content: "Write integration tests", status: "in_progress" }, |
| 62 | + ]), |
| 63 | + }, |
| 64 | +}; |
| 65 | + |
| 66 | +export const WithFailure: Story = { |
| 67 | + args: { |
| 68 | + plan: createPlan([ |
| 69 | + { content: "Create database schema", status: "completed" }, |
| 70 | + { content: "Implement authentication endpoints", status: "failed" }, |
| 71 | + { content: "Add middleware for protected routes", status: "pending" }, |
| 72 | + { content: "Write unit tests", status: "pending" }, |
| 73 | + ]), |
| 74 | + }, |
| 75 | +}; |
| 76 | + |
| 77 | +export const AllComplete: Story = { |
| 78 | + args: { |
| 79 | + plan: createPlan([ |
| 80 | + { content: "Create database schema", status: "completed" }, |
| 81 | + { content: "Implement authentication endpoints", status: "completed" }, |
| 82 | + { content: "Add middleware for protected routes", status: "completed" }, |
| 83 | + ]), |
| 84 | + }, |
| 85 | + parameters: { |
| 86 | + docs: { |
| 87 | + description: { |
| 88 | + story: "When all tasks are complete, the status bar is hidden.", |
| 89 | + }, |
| 90 | + }, |
| 91 | + }, |
| 92 | +}; |
| 93 | + |
| 94 | +export const NoPlan: Story = { |
| 95 | + args: { |
| 96 | + plan: null, |
| 97 | + }, |
| 98 | + parameters: { |
| 99 | + docs: { |
| 100 | + description: { |
| 101 | + story: "When there is no plan, the status bar is hidden.", |
| 102 | + }, |
| 103 | + }, |
| 104 | + }, |
| 105 | +}; |
0 commit comments