Skip to content

feat(desktop): settings + theme + command palette + better preview states#10

Merged
hqhq1025 merged 1 commit intomainfrom
wt/preview-ux-v2
Apr 18, 2026
Merged

feat(desktop): settings + theme + command palette + better preview states#10
hqhq1025 merged 1 commit intomainfrom
wt/preview-ux-v2

Conversation

@hqhq1025
Copy link
Copy Markdown
Collaborator

Summary

Polishes the renderer shell with Tier-1 UX building blocks. Onboarding gate is preserved; this PR is purely additive on top of the chat shell, plus an extraction of the existing chat / preview into named components.

UX improvements

  • TopBar — wordmark + breadcrumb status + 3 icon buttons (command palette, theme toggle, settings)
  • Sidebar — chat-only panel extracted from App.tsx; autosizing textarea, Enter sends / Shift+Enter newlines, generating dot indicator
  • PreviewPane — composes EmptyState / LoadingState / ErrorState / iframe and keeps the existing PreviewToolbar mounted unchanged
  • EmptyState — cleaner illustration (peach-aura sparkle) + 3 starter chips that populate the prompt
  • LoadingState — pure-CSS shimmer skeleton; no JS animation library
  • ErrorState — friendly card with Retry (re-runs last user prompt) and Copy Error actions
  • Settings overlay — modal with 4 tabs (Models stub since onboarding owns key entry, Appearance with theme picker, Storage pointing at the TOML config path, Advanced placeholder)
  • CommandPalette (Cmd+K) — plain modal with 4 actions (New Design / Toggle Theme / Open Settings / Export stub) + arrow-key + filter
  • Keyboard shortcutsCmd/Ctrl+Enter sends prompt, Cmd+, opens Settings, Cmd+K opens palette, Esc closes overlays
  • Toast notifications — Zustand-backed stack, bottom-right, 4s auto-dismiss, success / error / info variants
  • Dark mode — reads localStorage on mount, applies .dark to <html> before React paints (FOUC-free inline script in index.html), persists on toggle

Tier-1 / no-bloat confirmation

  • No new prod deps. Uses only existing lucide-react, zustand, React 19. CSS keyframes for all overlay / panel / toast / shimmer animations. Plain addEventListener for keyboard shortcuts.
  • No Radix Dialog, no react-hotkeys, no react-toastify, no framer-motion.
  • All UI uses var(--color-*), var(--text-*), var(--space-*), var(--radius-*) tokens. Added 3 missing tokens (--color-toast-success, --color-toast-error, --color-overlay); no hex / px in component code.
  • Strict TS, import type for type-only imports, no any.

Backward-compat notes

  • The store keeps every existing slice (config, configLoaded, loadConfig, completeOnboarding, messages, previewHtml, isGenerating, errorMessage, toastMessage, sendPrompt, exportActive, dismissToast). Adds: theme, settingsOpen, commandPaletteOpen, toasts, lastError, retryLastPrompt, clearError, setTheme, toggleTheme, open/closeSettings, open/closeCommandPalette, pushToast.
  • dismissToast accepts an optional id so the existing PreviewToolbar (which calls dismissToast() to clear the legacy toastMessage) keeps working unchanged. New multi-toast viewport calls dismissToast(id).
  • Onboarding gate (if (config === null || !config.hasKey) return <Onboarding />) and loadConfig effect preserved at the top of App.tsx.

Integration notes

  • Overlaps with wt/reliability-v2 on App.tsx — both wrap the panes. The ErrorBoundary integration (wrapping <TopBar/> + grid + overlays) should land in a follow-up commit once wt/reliability-v2 merges. No conflicting structural changes here beyond the slim shell.
  • PreviewToolbar.tsx is intentionally unmodified — the new PreviewPane mounts it. Toolbar's toastMessage slice continues to fire on export status; new multi-toast pipeline is used for generation success/failure and command-palette feedback.
  • The Models tab is a deliberate stub. Provider key entry stays in onboarding; richer in-place provider switching lands once the schema supports multiple providers.

§5b checks

  • ✅ Compatible — onboarding gate, store, IPC contract all preserved
  • ✅ Upgradeable — new tokens are additive; new store slices are additive; PreviewToolbar untouched
  • ✅ No-bloat — zero new prod deps; CSS-only animations; <200 LOC of net new component code per concern
  • ✅ Elegant — single useKeyboard hook for all shortcuts; one Tooltip primitive (CSS-only with 400ms hover delay); IconButton primitive shared across TopBar / ThemeToggle

Test plan

  • pnpm install && pnpm -r typecheck && pnpm lint && pnpm -r test all green locally (verified)
  • Onboarding still loads on first run; once complete the new shell appears
  • Cmd+K opens palette; arrow keys + Enter run an action; Esc closes
  • Cmd+, opens Settings; clicking outside / pressing Esc closes
  • Theme toggle in TopBar persists across reload (no light flash)
  • Empty state chips populate the prompt textarea
  • Trigger an error (bad key / network drop) → ErrorState shows; Retry re-runs last prompt; Copy Error puts message on clipboard
  • Successful export still fires the legacy toolbar toast unchanged

…ates

Polish the renderer shell with Tier-1 building blocks:

- Settings overlay with 4 tabs (Models stub, Appearance with light/dark
  picker, Storage config-file pointer, Advanced placeholder)
- Preview states: EmptyState with 3 starter chips, pure-CSS shimmer
  LoadingState, friendly ErrorState card with Retry + Copy Error
- TopBar with wordmark + 3 icon buttons (command palette, theme, settings)
- Sidebar extracted from App.tsx — chat-only panel, autosizing textarea
- PreviewPane composes EmptyState / LoadingState / ErrorState / iframe
  and mounts the existing PreviewToolbar unchanged
- Keyboard shortcuts: Cmd/Ctrl+Enter sends, Cmd+, opens Settings,
  Cmd+K opens command palette, Esc closes overlays
- Multi-toast Zustand slice (4s auto-dismiss, stack bottom-right)
- Dark mode with FOUC-free localStorage hydration in index.html
- Command palette with 4 actions (New Design / Toggle Theme / Open
  Settings / Export stub) and keyboard navigation

Tier-1 building blocks only: CSS keyframes, addEventListener, no Radix
Dialog, no react-hotkeys, no react-toastify, no framer-motion, no new
prod deps. Onboarding gate and existing exportActive / toastMessage
slices preserved for backward compat (dismissToast accepts an optional
id to keep PreviewToolbar working).

Adds tokens: --color-toast-success, --color-toast-error, --color-overlay.
Adds packages/ui: IconButton, Tooltip (CSS-only, 400ms hover delay).

Signed-off-by: hqhq1025 <[email protected]>
@hqhq1025 hqhq1025 merged commit 4719540 into main Apr 18, 2026
7 checks passed
@hqhq1025 hqhq1025 deleted the wt/preview-ux-v2 branch April 18, 2026 07:47
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