Skip to content

[WIP] feat: Experiments V2 wizard + Warehouse Connection Settings UI#7195

Draft
talissoncosta wants to merge 9 commits intomainfrom
feat/experiments-v2
Draft

[WIP] feat: Experiments V2 wizard + Warehouse Connection Settings UI#7195
talissoncosta wants to merge 9 commits intomainfrom
feat/experiments-v2

Conversation

@talissoncosta
Copy link
Copy Markdown
Contributor

  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Contributes to the Experiments V2 and Data Warehouse features


1. Storybook Dark Mode Fixes

The Storybook docs page had white backgrounds in dark mode on the canvas preview, toolbar, and controls table.

  • Reactive DocsContainer — switches theme when toggling light/dark in the toolbar
  • CSS overrides for .sb-anchor, .docblock-argstable, and toolbar backgrounds
  • react-docgen-typescript for proper prop name extraction in controls
  • Legacy globals registered (React, propTypes, OptionalString, etc.) for Input.js compatibility
  • Utils stub via webpack alias to break circular dependency (utils → account-store → constants)
  • Ionic/stencil stubbed to prevent secondary circular dep chain

2. Experiments V2 — Wizard + Results Dashboard

Full frontend scaffolding for the new experiment creation wizard and results dashboard, built from Pencil designs with mock data.

Architecture — 4 layers under web/components/experiments-v2/:

Layer Components
wizard/ WizardLayout, WizardSidebar, WizardStepIndicator, WizardHeader, WizardNavButtons — reusable, zero experiment knowledge
shared/ SelectableCard, VariationTable, TrafficSplitBar, StatusBadge, ExperimentStatCard, MetricsComparisonTable
steps/ ExperimentDetailsStep, SelectMetricsStep, FlagVariationsStep, AudienceTrafficStep, ReviewLaunchStep
flag-detail/ LinkedExperimentSection (experiment card + empty state for flag detail page)

Pages:

  • Create Experiment (/experiments/create) — 5-step wizard: Details → Metrics → Flags & Variations → Audience & Traffic → Review & Launch
  • Experiment Results (/experiments/:experimentId) — Stat cards, recommendation callout, metrics comparison table, experiment config grid, timeline progress

Routes gated behind experimental_flags feature flag.

3. Data Warehouse Connection Settings

New settings page with 5 states, built from Pencil designs with mock data.

State Description
Empty "No warehouse connected" CTA
Config Form Snowflake/BigQuery/Databricks type selector + connection fields (reuses SelectableCard)
Testing Spinner + staggered progress steps (only motion library usage — functional, not cosmetic)
Connected Status card with stats (Last Delivery, Flag Evaluations 24h, Custom Events 24h) + connection details grid
Error Error message box with JWT failure example + retry + connection details

Route: /organisation/:organisationId/warehouse

4. Shared Infrastructure

  • Motion presets (common/utils/motion.ts) — 10 reusable animation variants (fadeIn, slideInRight, staggerContainer, springBounce, shakeX, etc.). Foundation for gradual motion adoption.
  • CSS animations (web/styles/_animations.scss) — Shared keyframes (shake, spin, fade-in, pulse) + mixins (focus-ring, spinner, input-error-shake)
  • Storybook Motion demos — Interactive playground under "Design System/Motion Presets"

5. Design Quality

  • All values tokenised — no hardcoded font-size, font-weight, font-family, or colours. Uses --font-body-size, --font-weight-semibold, --color-text-default, etc.
  • box-shadow: var(--shadow-sm) on cards and tables for depth
  • SelectableCard border-width fix (no layout shift on selection)
  • flex-wrap on stat cards for tablet responsiveness

How to demo

In the app

  1. ENV=local npm run dev
  2. Experiments wizard: Navigate to any project/environment → go to /experiments/create → step through the 5-step wizard (pre-populated with mock data)
  3. Experiment results: Go to /experiments/exp-1 → stat cards, recommendation, metrics table
  4. Warehouse: Go to /organisation/{orgId}/warehouse → click "Connect Data Warehouse" → Config Form → "Test Connection" → Testing (3s) → Connected or Error (random)

In Storybook

  1. npm run storybook
  2. Experiments/ — 19 stories: Wizard (composed), Steps (interactive), SelectableCard, VariationTable, StatusBadge, etc.
  3. Warehouse/ — 6 stories: each state + full page
  4. Design System/Motion Presets — click "Replay" to see each animation

Automated

  • npx eslint — 0 errors on all new files
  • npm run typecheck — 0 type errors in experiments-v2 and warehouse
  • npx storybook build --test — builds successfully

Notes

  • All data is mock/fake — no API calls. Mock data centralised in types.ts files for easy replacement with RTK Query hooks.
  • Motion animations kept minimal — only functional stagger on warehouse testing steps. Cosmetic animations available in presets but not applied (app has no existing animations, would feel inconsistent).
  • SelectableCard and StatusBadge are shared across both features.
  • Sidebar nav links for Experiments and Warehouse are not added — planned as part of a future sidebar navigation refactor.

🤖 Generated with Claude Code

talissoncosta and others added 9 commits April 9, 2026 14:11
The docs page canvas preview, toolbar, and controls table were rendering
with white backgrounds in dark mode. This was caused by Storybook's
emotion-styled components overriding our theme.

- Add reactive DocsContainer that switches theme on toolbar toggle
- Use react-docgen-typescript for proper prop name extraction
- Target .sb-anchor, .docblock-argstable, and toolbar for dark backgrounds
- Improve contrast for prop table text in dark mode

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… stories

Implements the Experiments V2 UI from the Pencil designs as separated,
modular React components with mock data. This is the frontend scaffolding
for the new experiment creation wizard and results dashboard.

## Architecture

Components are organised into four layers:

- `wizard/` — Reusable wizard primitives (Layout, Sidebar, StepIndicator,
  Header, NavButtons). Zero experiment knowledge — can be reused for any
  future multi-step wizard.
- `shared/` — Experiment-specific building blocks (SelectableCard,
  VariationTable, TrafficSplitBar, StatusBadge, ExperimentStatCard,
  MetricsComparisonTable).
- `steps/` — Five wizard step components, each a pure presentation
  component receiving state via props.
- `flag-detail/` — LinkedExperimentSection for the feature flag detail page.

## Pages

- **CreateExperimentPage** (`/experiments/create`) — 5-step wizard:
  1. Experiment Details (name, hypothesis, type)
  2. Select Metrics (search, primary/secondary)
  3. Flag & Variations (flag dropdown, variation table)
  4. Audience & Traffic (segment, traffic slider, split bar)
  5. Review & Launch (summary with edit buttons)

- **ExperimentResultsPage** (`/experiments/:experimentId`) — Dashboard with
  stat cards (users enrolled, winning variation, probability, lift) and
  metrics comparison table.

## Storybook

19 stories under `Experiments/` with interactive controls and light/dark
mode support. Wizard components are nested under `Experiments/Wizard/`.
A composed `Wizard` story demonstrates all primitives working together.

## Notes

- All data is mock/fake — no API calls yet. Mock data is centralised in
  `types.ts` for easy replacement with RTK Query hooks later.
- Routes gated behind `experimental_flags` feature flag.
- Global `Select` (react-select) registered in Storybook preview for
  SearchableSelect compatibility.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Input.js uses window.Utils without importing it (set in web/main.js at
app boot). Chromatic builds failed because this global wasn't available
in the Storybook context.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Replace hardcoded font-size (11-28px) with semantic tokens
  (--font-caption-xs-size through --font-h3-size)
- Replace hardcoded font-weight (400-700) with tokens
  (--font-weight-regular through --font-weight-bold)
- Replace hardcoded JetBrains Mono with var(--font-family)
- Replace hardcoded #ffffff with var(--color-surface-default)
- Fix SelectableCard border-width shift (1px→2px) using inset box-shadow
  for unselected state and 2px transparent border always
- Add box-shadow: var(--shadow-sm) to cards and tables for depth
- Add flex-wrap to stat cards row for tablet responsiveness

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ck state

- Pre-populate wizard with realistic mock data (name, hypothesis, type,
  3 metrics, flag, segment) so the review step looks complete on first visit
- Show hypothesis in a styled block instead of truncated key-value
- Show experiment type with icon badge
- Show metrics with name + description + role badge
- Show variations with coloured dots and value badges
- Show traffic split visualisation bar with labels
- All using semantic tokens

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…d config

- Add experiment timeline progress bar (day 23 of 30)
- Add recommendation callout with green success styling
- Add experiment configuration grid (type, flag, audience, traffic)
- All values using semantic tokens

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
## Shared Animation Foundation

Introduces the `motion` library (v12.38) as the standard for JS-driven
animations in the frontend, alongside existing CSS motion tokens.

- `common/utils/motion.ts` — 10 reusable motion presets (fadeIn, slideInRight,
  staggerContainer, springBounce, shakeX, badgeEntrance, pageCrossfade, etc.)
- `web/styles/_animations.scss` — CSS keyframes (shake, spin, fade-in, pulse)
  and mixins (focus-ring, input-error-shake, spinner)
- `documentation/MotionPresets.stories.tsx` — Interactive Storybook demos

## Warehouse Connection Settings

New "Data Warehouse" settings page with 5 states and animated transitions:

- **Empty** — CTA to connect, fade-in entrance
- **Config Form** — Snowflake/BigQuery/Databricks type selector, connection
  form fields, slide-in-right entrance via motion
- **Testing** — Spinner + staggered progress steps via motion stagger presets
- **Connected** — Status card with spring-bounce icon, badge entrance,
  staggered stats, connection details grid
- **Error** — Shake animation on error card, error message box, retry

State transitions use AnimatePresence with pageCrossfade for smooth crossfades.

All values use semantic design tokens. Mock data for showcase purposes.

## Storybook Fix

Replace `window.Utils` import (caused circular dependency crash) with
minimal mock providing only the functions Input.js actually calls.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…obals

- Remove cosmetic motion animations (fadeIn, slideInRight, springBounce,
  shakeX, badgeEntrance, AnimatePresence crossfade) from warehouse
  components. Keep only the functional stagger on TestingState progress steps.
- Add warehouse route at /organisation/:organisationId/warehouse
- Stub common/utils/utils in Storybook webpack to fix circular dep crash
- Register all legacy prop-type globals (OptionalString, RequiredFunc, etc.)
  in Storybook preview for Input.js compatibility

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The svg colour rule was applying to all descendant svgs, including the
icon inside the CTA button, causing poor contrast on primary buttons.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@talissoncosta talissoncosta requested a review from a team as a code owner April 9, 2026 21:04
@talissoncosta talissoncosta requested review from kyle-ssg and removed request for a team April 9, 2026 21:04
Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

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

⚠️ Code review skipped — your organization's overage spend limit has been reached.

Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit at claude.ai/admin-settings/claude-code.

Once credits are available, reopen this pull request to trigger a review.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
flagsmith-frontend-preview Ready Ready Preview, Comment Apr 9, 2026 9:05pm
flagsmith-frontend-staging Ready Ready Preview, Comment Apr 9, 2026 9:05pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Apr 9, 2026 9:05pm

Request Review

@github-actions github-actions bot added front-end Issue related to the React Front End Dashboard feature New feature or request labels Apr 9, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-api-test:pr-7195 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-e2e:pr-7195 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api:pr-7195 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-7195 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-7195 Finished ✅ Results

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  11 passed

Details

stats  11 tests across 8 suites
duration  51.5 seconds
commit  aa7f863
info  🔄 Run: #15948 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  17 passed

Details

stats  17 tests across 14 suites
duration  1 minute, 1 second
commit  aa7f863
info  🔄 Run: #15948 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  17 passed

Details

stats  17 tests across 14 suites
duration  1 minute, 2 seconds
commit  aa7f863
info  🔄 Run: #15948 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  11 passed

Details

stats  11 tests across 8 suites
duration  52.3 seconds
commit  aa7f863
info  🔄 Run: #15948 (attempt 1)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

Visual Regression

16 screenshots compared. See report for details.
View full report

@talissoncosta talissoncosta changed the title feat: Experiments V2 wizard + Warehouse Connection Settings UI [WIP] feat: Experiments V2 wizard + Warehouse Connection Settings UI Apr 14, 2026
@talissoncosta talissoncosta marked this pull request as draft April 14, 2026 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request front-end Issue related to the React Front End Dashboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant