Skip to content

Add storybook#1361

Open
dobesv wants to merge 1 commit intokagent-dev:mainfrom
dobesv:feat/storybook
Open

Add storybook#1361
dobesv wants to merge 1 commit intokagent-dev:mainfrom
dobesv:feat/storybook

Conversation

@dobesv
Copy link
Contributor

@dobesv dobesv commented Feb 23, 2026

When working on UI elements it is a lot easier to iterate and test in storybook where you can put up the interesting cases as stories and browse through them instead of having construct scenarios in a live running app.

Copilot AI review requested due to automatic review settings February 23, 2026 01:35
@dobesv dobesv requested a review from peterj as a code owner February 23, 2026 01:35
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Storybook to the ui/ package to make UI component development and verification easier outside of the running Next.js app.

Changes:

  • Adds Storybook configuration (ui/.storybook/*) and npm scripts to run/build Storybook.
  • Introduces initial Storybook stories for sidebar and chat/components.
  • Adds Vitest + Storybook addon-vitest setup for running story-based tests in a browser (Playwright).

Reviewed changes

Copilot reviewed 26 out of 28 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
ui/vitest.shims.d.ts Adds Vitest browser Playwright types reference.
ui/vitest.config.ts Adds Vitest config for Storybook addon-vitest + Playwright browser runner.
ui/.storybook/main.ts Storybook framework/addons/stories configuration.
ui/.storybook/preview.ts Global preview parameters, global CSS import, decorator setup.
ui/.storybook/vitest.setup.ts Applies Storybook project annotations for Vitest story tests (incl. a11y).
ui/src/components/sidebars/SessionGroup.stories.tsx Adds Storybook stories for SessionGroup sidebar grouping UI.
ui/src/components/sidebars/GroupedChats.stories.tsx Adds stories for grouped chats rendering across timeframes.
ui/src/components/sidebars/EmptyState.stories.tsx Adds EmptyState sidebar story.
ui/src/components/sidebars/ChatItem.stories.tsx Adds stories for chat item rendering/overflow cases.
ui/src/components/sidebars/AgentSwitcher.stories.tsx Adds AgentSwitcher stories for single/multi agent lists.
ui/src/components/sidebars/AgentDetailsSidebar.stories.tsx Adds AgentDetailsSidebar stories covering tools/no-tools/BYO.
ui/src/components/chat/TruncatableText.stories.tsx Adds TruncatableText stories for various markdown/text cases.
ui/src/components/chat/TokenStats.stories.tsx Adds TokenStats stories for multiple usage sizes.
ui/src/components/chat/StreamingMessage.stories.tsx Adds StreamingMessage stories incl. empty-content behavior.
ui/src/components/chat/StatusDisplay.stories.tsx Adds StatusDisplay stories for all statuses and messages.
ui/src/components/chat/CodeBlock.stories.tsx Adds CodeBlock stories for multiple languages and lengths.
ui/src/components/chat/ChatMessage.stories.tsx Adds ChatMessage stories for multiple message variants.
ui/src/components/chat/AgentCallDisplay.stories.tsx Adds AgentCallDisplay stories for call lifecycle variants.
ui/src/components/ToolDisplay.stories.tsx Adds ToolDisplay stories including “chat layout” decorator variants.
ui/src/components/LoadingState.stories.tsx Adds LoadingState story.
ui/src/components/Header.stories.tsx Adds Header stories incl. mobile viewport.
ui/src/components/Footer.stories.tsx Adds Footer story.
ui/src/components/ErrorState.stories.tsx Adds ErrorState stories for message-length and button variants.
ui/src/components/AgentCard.stories.tsx Adds AgentCard stories for readiness/acceptance/BYO/long text cases.
ui/package.json Adds Storybook scripts + Storybook/Vitest/Playwright dev dependencies.
ui/eslint.config.mjs Enables eslint-plugin-storybook recommended flat config.
ui/.gitignore Ignores Storybook static build output.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@peterj
Copy link
Collaborator

peterj commented Mar 3, 2026

@dobesv can you sign the DCO?

peterj
peterj previously approved these changes Mar 3, 2026
@dobesv dobesv force-pushed the feat/storybook branch 2 times, most recently from bfdfe2c to 01d36ab Compare March 7, 2026 18:13
@dobesv
Copy link
Contributor Author

dobesv commented Mar 7, 2026

@peterj I fixed some stories and pushed with signoff. Thanks for looking at this!

@dobesv
Copy link
Contributor Author

dobesv commented Mar 7, 2026

I realized that some of the things I want to change make network requests, so I added msw support to this PR so that API calls can be mocked for storybook stories. This can also make it a foundation for future front-end testing using storybook interaction tests.

@dobesv dobesv force-pushed the feat/storybook branch 2 times, most recently from 146d0ed to d50fc32 Compare March 9, 2026 17:34
@dobesv
Copy link
Contributor Author

dobesv commented Mar 9, 2026

I fixed the type errors caused by the other PR merging. Also fixed a lint warning for the msw file, by adding it to the eslint ignore list.

When working on UI elements it is a lot easier to iterate and test in storybook where you can put up the interesting cases as stories and browse through them instead of having construct scenarios in a live running app.

Signed-off-by: Dobes Vandermeer <dobes.vandermeer@newsela.com>
@dobesv
Copy link
Contributor Author

dobesv commented Mar 10, 2026

Fixed another couple typescript errors that popped up this evening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants