Skip to content

Build: Add withAdeMode decorator#34781

Open
yannbf wants to merge 3 commits into
nextfrom
yann/ade-decorator
Open

Build: Add withAdeMode decorator#34781
yannbf wants to merge 3 commits into
nextfrom
yann/ade-decorator

Conversation

@yannbf
Copy link
Copy Markdown
Member

@yannbf yannbf commented May 13, 2026

Closes #

What I did

This PR adds a decorator to help us understand how a component would look like in an ADE-like environment, using a global toolbar:

export const InAdeSession = meta.story({
  globals: {
    adeMode: 'light',
  },
});

And looking like this:

image

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

Caution

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook publish.yml --field pr=<PR_NUMBER>

Summary by CodeRabbit

  • New Features
    • Added ADE Mode toggle to Storybook toolbar with "off", "light", and "dark" options.
    • Stories can be previewed inside an ADE shell that reproduces app chrome and theme styles.
    • Resizable preview panel for testing component layouts at different widths.
    • New example story demonstrating an ADE light session for quick testing.

Review Change Stack

@yannbf yannbf self-assigned this May 13, 2026
@yannbf yannbf added build Internal-facing build tooling & test updates ci:normal labels May 13, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1b288935-8c2b-462c-b430-0e589f5403e8

📥 Commits

Reviewing files that changed from the base of the PR and between 69dd233 and eac55b3.

📒 Files selected for processing (1)
  • code/.storybook/withAdeMode.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • code/.storybook/withAdeMode.tsx

📝 Walkthrough

Walkthrough

Adds a global Storybook decorator withAdeMode that wraps stories in a ClaudeShell UI when ADE mode is enabled, registers adeMode in preview globals with toolbar options, and adds an InAdeSession demo story set to the light ADE theme.

Changes

ADE Mode Storybook Integration

Layer / File(s) Summary
ADE decorator implementation
code/.storybook/withAdeMode.tsx
Adds withAdeMode including CSS-variable light/dark palettes, styled shell components (sidebar, header, transcript, composer, browser preview), ClaudeShell component with draggable horizontal resizer and clamped preview width, and decorator logic to conditionally wrap stories based on context.globals.adeMode and sb_theme.
Storybook configuration and registration
code/.storybook/preview.tsx
Imports and registers withAdeMode as a global decorator and adds adeMode to globalTypes with toolbar metadata and off/light/dark options.
ADE mode demo story
code/core/src/manager/index.stories.tsx
Adds InAdeSession story configured with globals.adeMode: 'light' to demonstrate the ADE-mode decorator.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@code/.storybook/withAdeMode.tsx`:
- Line 1073: Remove the raw console.log({ mode }) from the decorator render path
in withAdeMode (the decorator function that reads the mode variable); either
delete that line or replace it with Storybook's client logger (importing from
'@storybook/client-logger' and using logger.info/logger.log) so logging follows
Storybook guidelines and does not use console directly.

In `@code/core/src/manager/index.stories.tsx`:
- Around line 205-209: Add a play function to the InAdeSession story (const
InAdeSession = meta.story) that performs the same interaction/assertion pattern
used by the other stories: implement an async play({ canvasElement, step,
userEvent, within, expect }) that queries the rendered component in the canvas,
simulates any required user interactions (via userEvent) and asserts expected UI
state or accessibility attributes (via expect/within) to validate ADE mode
rendering; ensure the play function is attached to the story object passed to
meta.story so it runs during Storybook play mode and follows the same testing
utilities and assertions used by the other stories in this file.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 302ee6ca-d201-4801-b4bd-cd78f4174d15

📥 Commits

Reviewing files that changed from the base of the PR and between 97716bd and 69dd233.

📒 Files selected for processing (3)
  • code/.storybook/preview.tsx
  • code/.storybook/withAdeMode.tsx
  • code/core/src/manager/index.stories.tsx

Comment thread code/.storybook/withAdeMode.tsx Outdated
Comment thread code/core/src/manager/index.stories.tsx
@github-actions github-actions Bot added the Stale label May 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Internal-facing build tooling & test updates ci:normal Stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant