Skip to content

feat(framework-editor): dark mode (FRAME-5)#3128

Open
tofikwest wants to merge 2 commits into
mainfrom
tofik/frame-5-framework-editor-dark-mode
Open

feat(framework-editor): dark mode (FRAME-5)#3128
tofikwest wants to merge 2 commits into
mainfrom
tofik/frame-5-framework-editor-dark-mode

Conversation

@tofikwest

@tofikwest tofikwest commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

What

Adds a working dark mode + theme toggle to the Framework Editor.

Why (FRAME-5)

Joe asked to "replicate what you've got in the app" for less eyestrain.

Important finding: it wasn't actually a quick wire-up. The main app gets its dark tokens from @trycompai/design-system, but the Framework Editor uses @trycompai/ui, whose .dark token block is identical to light (--background: 0 0% 100% in both). So just toggling a dark class changed nothing — a real dark palette was needed.

Changes

  • next-themes provider (attribute="class", system-aware, default light) wrapping the app; suppressHydrationWarning on <html>.
  • Sun/Moon toggle in the header (theme-toggle.tsx) — mount-guarded to avoid hydration mismatch.
  • A real dark palette in styles/globals.css, declared after the @trycompai/ui import so it overrides the library's placeholder .dark tokens. Scoped to framework-editor only — does not touch @trycompai/ui or other apps.
  • next-themes added to package.json (+1 line in bun.lock).

⚠️ Needs your visual QA on the preview

I can't verify dark rendering headlessly. Please click through in dark mode. Known spots that may need follow-up polish (a handful of hardcoded colors that don't read from tokens):

  • Tasks page status pills (bg-gray-200, text-gray-700)
  • Version diff add/remove chips (bg-green-100 / bg-red-100)
  • User-menu email color (text-[#606060])

These degrade rather than break; happy to do a token-cleanup pass if you want them perfect.

Testing

  • theme-toggle.test.tsx: 2 tests (light → dark, dark → light).
  • turbo typecheck --filter=@trycompai/framework-editor: clean.

🤖 Generated with Claude Code


Summary by cubic

Adds system-aware dark mode and a header theme toggle to the Framework Editor. Fulfills FRAME-5 by matching the main app’s theme options and providing a real dark palette for reduced eyestrain.

  • New Features

    • Integrated next-themes provider (class strategy, system-aware, default light); <html> uses suppressHydrationWarning.
    • Added Sun/Moon theme toggle in the header with an SSR-safe mount guard.
    • Defined a real dark color palette in styles/globals.css, overriding @trycompai/ui’s .dark tokens and scoped to the editor.
  • Dependencies

    • Added next-themes to apps/framework-editor/package.json.

Written for commit e77c0eb. Summary will update on new commits.

Review in cubic

The editor inherited @trycompai/ui's `.dark` token block, whose values are
identical to light — so there was no dark theme and no way to switch.

- Add next-themes ThemeProvider (class strategy, system-aware, default light).
- Add a Sun/Moon toggle in the header.
- Define a real dark palette in the editor's globals (overrides the library's
  placeholder `.dark` tokens), scoped to framework-editor only.

Closes FRAME-5

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@linear

linear Bot commented Jun 12, 2026

Copy link
Copy Markdown

FRAME-5

@vercel

vercel Bot commented Jun 12, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
comp-framework-editor Ready Ready Preview, Comment Jun 12, 2026 7:11pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
app Skipped Skipped Jun 12, 2026 7:11pm
portal Skipped Skipped Jun 12, 2026 7:11pm

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

cubic analysis

No issues found across 8 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Linked issue analysis

Linked issue: FRAME-5: Framework Editor - Theme options - Dark mode please

Status Acceptance criteria Notes
Add a theme toggle UI in the header that switches theme HeaderFrameworks.tsx adds and theme-toggle.tsx implements a button that calls setTheme to toggle between light/dark.
Integrate next-themes provider with class attribute, default light, and system-aware behavior; avoid hydration mismatch on layout.tsx wraps app with ThemeProvider configured (attribute="class", defaultTheme="light", enableSystem) and adds suppressHydrationWarning on ; theme-provider.tsx forwards to next-themes.
Provide a real dark palette that overrides the library's placeholder .dark tokens scoped to the Framework Editor globals.css declares a .dark token block after importing @trycompai/ui so it wins the cascade and is scoped to this app.
Avoid SSR hydration mismatch for theme-specific UI (mount guard) theme-toggle.tsx uses useEffect to set a mounted flag and only treats resolvedTheme as reliable after mount to prevent hydration mismatch.
Add tests covering theme toggle behavior (light→dark and dark→light) theme-toggle.test.tsx includes two tests that mock useTheme and assert setTheme called with 'dark' or 'light' on click.

Re-trigger cubic

@vercel vercel Bot temporarily deployed to Preview – app June 12, 2026 19:10 Inactive
@vercel vercel Bot temporarily deployed to Preview – portal June 12, 2026 19:10 Inactive
@tofikwest

Copy link
Copy Markdown
Contributor Author

@cubic-dev-ai review it

@cubic-dev-ai

cubic-dev-ai Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review it

@tofikwest I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 8 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

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.

1 participant