Skip to content

Add new portable UI app shell (apps/ui)#2986

Merged
youknowriad merged 6 commits intotrunkfrom
new-ui-app-shell
Apr 17, 2026
Merged

Add new portable UI app shell (apps/ui)#2986
youknowriad merged 6 commits intotrunkfrom
new-ui-app-shell

Conversation

@youknowriad
Copy link
Copy Markdown
Contributor

@youknowriad youknowriad commented Apr 6, 2026

Related issues

  • Related to the new UI initiative

How AI was used in this PR

The app shell was pair-programmed with Claude Code. All code has been reviewed and tested manually.

Proposed Changes

Introduces apps/ui, a new UI layer intended to ship as the Electron renderer. The shell is kept deliberately portable — data access is mediated by a Connector interface so a non-Electron variant could be added later — but all web/REST-specific code (login page, OAuth, Telex/WP.com REST adapter) has been stripped to keep this PR focused on the Electron redesign.

Architecture

  • Connector pattern — a small interface (apps/ui/src/data/core/types.ts) abstracts site, auth, and locale access. Only the IPC connector is included; it delegates to window.ipcApi and exposes an optional init() hook that installs the Electron app menu (so View → Toggle DevTools works in the new renderer).
  • TanStack Router (code-based, wp-calypso style) with layout routes for _dashboard (sidebar) and _onboarding (full-screen).
  • TanStack Query with localStorage persistence for cached site data across reloads.
  • @wordpress/ui + @wordpress/themeButton, Collapsible, Stack replace hand-rolled components; colors, spacing, and typography use --wpds-* design tokens via ThemeProvider (unlocked through @wordpress/private-apis). A small usePrefersColorScheme hook seeds ThemeProvider's bg for dark mode.
  • i18n@wordpress/i18n + @wordpress/react-i18n, sharing the translation dictionary in tools/common/translations. Locale is fetched from the main process at boot via the connector and applied to defaultI18n before render.

Dev workflow

  • npm run start:new launches the full Electron app against the new UI.
  • npm -w @studio/ui run dev runs a standalone Vite dev server (useful for iterating on pure-UI work, though most features require the IPC bridge).

Incidental fix

@wordpress/element 6.43 tightened createInterpolateElement's types to infer allowed tag keys from the template literal — tag names containing spaces (e.g. <ArrowIcon />) are now filtered out. Removed the space before /> in three existing templates (content-tab-assistant, sync-connected-sites, studio-cli-toggle) so the types match. Translations for those strings will need to be re-submitted.

Testing Instructions

  • Run npm run start:new and verify the Electron app launches with the new UI.
  • Open View → Toggle Developer Tools to confirm the app menu is installed.
  • Toggle system dark/light mode and verify background / text colors update.
  • Change Studio's locale in Settings, relaunch with start:new, and verify sidebar labels ("Projects", "Stop all", "Add site") render translated.
  • Run npm -w @studio/ui run dev and verify the Vite dev server starts on port 5200.
  • Run npm run typecheck — all workspaces should pass.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

Introduces a new UI layer that can run as both an Electron renderer
and a standalone web app. Uses an injectable connector pattern for
data access (IPC for Electron, Telex REST API for web), TanStack
Router (code-based) and TanStack Query with localStorage persistence.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Focus the new UI on shipping as the Electron renderer. Removes the
Telex REST connector, login route, OAuth callback handling, auth
guard, and dual-mode Vite config. The Connector interface keeps its
auth surface so a future REST/web connector can be added without
restructuring the UI.

Also renames the npm script from start:new-ui to start:new.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@youknowriad youknowriad marked this pull request as ready for review April 17, 2026 11:21
The new UI no longer needs 'system' as the default to make dark mode
work, so keep the existing 'light' default in the desktop app.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@wpmobilebot
Copy link
Copy Markdown
Collaborator

wpmobilebot commented Apr 17, 2026

📊 Performance Test Results

Comparing 59a7701 vs trunk

app-size

Metric trunk 59a7701 Diff Change
App Size (Mac) 1283.06 MB 1283.01 MB 0.05 MB ⚪ 0.0%

site-editor

Metric trunk 59a7701 Diff Change
load 1913 ms 1857 ms 56 ms 🟢 -2.9%

site-startup

Metric trunk 59a7701 Diff Change
siteCreation 8118 ms 8180 ms +62 ms 🔴 0.8%
siteStartup 4952 ms 4954 ms +2 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

Replaces custom buttons/collapsible/flex CSS with @wordpress/ui Button,
Collapsible, and Stack; swaps hardcoded colors, fonts, and padding for
@wordpress/theme tokens; adds a prefers-color-scheme hook that seeds
ThemeProvider's bg for dark mode; adds an optional Connector.init() hook
so the IPC connector can install the Electron app menu (restores
DevTools).
…t types

The 6.43 type update infers allowed keys from the template literal and
rejects tag names containing spaces. Removes the space before `/>` in
three self-closing tags so the types match.
Wires @wordpress/i18n and @wordpress/react-i18n into apps/ui using the
same translation dictionary as the existing renderer. The IPC connector
exposes getUserLocale(); bootstrap loads the matching translations via
@studio/common/lib/locale and populates defaultI18n before render. All
user-facing strings in the sidebar, onboarding, and dashboard are now
wrapped in __ (with _n / sprintf for pluralization).
@youknowriad
Copy link
Copy Markdown
Contributor Author

I reworked and simplified a bit this PR. Focused it more on the Studio App for now. Let the connector interface in for future work on a web UI if needed.

I'm likely merging this as a hidden initial shell where I can iterate on this project with @mtias.

@youknowriad youknowriad merged commit 8ae1703 into trunk Apr 17, 2026
11 checks passed
@youknowriad youknowriad deleted the new-ui-app-shell branch April 17, 2026 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants