Skip to content

Settings: preferences page with section index, grouped rows and complete states; update window polish - #194

Merged
fylorn merged 1 commit into
devfrom
ui/settings
Sep 25, 2026
Merged

fylorn merged 1 commit into
devfrom
ui/settings

Conversation

@fylorn

@fylorn fylorn commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Part of the UI upgrade, built on the kit from #187. Settings becomes a proper preferences page, every part of it gets complete loading / error / empty states, and the update window gets the same treatment.

Settings page (src/settings/SettingsPage.tsx, src/settings/kit.tsx)

  • Layout: a sticky section index on the left with scroll-spy (the grey pill slides to the section in view; a section with unsaved edits gets a dot), and grouped cards of rows on the right: label and a one-line description on the left, the control on the right. At narrow widths the index hides and wrapped controls stay right-aligned.
  • Header summary: the current connection and its state (the same words as the sidebar switcher), the gateway address and who can reach it, and the app version — or "x available", which scrolls to About. New values fade in.
  • General (language, appearance, menu bar, launch at login, notices) is one card. All of it goes through useResource (cached, no flash on revisit), writes are optimistic with rollback and notify.error, switches show pending. Each control has a skeleton of its own size while loading and an inline "Could not load · Retry" if the read fails, instead of the old return null.
  • Listening / Log retention keep the explicit-save forms. The save bar appears only when something changed ("Unsaved changes", Discard, Save), flashes "Saved", and a draft survives switching pages (per connection). The storage meter animates and turns amber when the new cap is below current usage. The interface list is a useResource with a retryable error instead of silently becoming "no interfaces".
  • When the shell has no Overview (first connect, or the read failed) the two sections show a skeleton, "Available once connected to a core" when unlinked, or an error row with Retry. Previously they stayed on skeletons forever when the Overview read failed; the page now asks for it itself and uses the answer.
  • About: app icon, version, install badge (Homebrew / development build), "Check for updates" with the result inline (checking / up to date / failed, reason on hover / new version available). "Update to x…" opens the update window directly through a new update_show command instead of checking the network again. Auto-check switch, data directory, core binary, diagnostics bundle (disabled with a note while core is not connected).
  • Uninstall is a destructive confirm dialog instead of the inline two-step: it lists what will happen (the adopted clients that get restored, by name; launch at login; optional data directory deletion with its path, off by default), runs in place and reports each step.
  • Connections: rows match the sidebar switcher (icon tile, name, "Current", address or last connection in mono, live status). Clicking a remote row edits it, "Switch" is on the row, and every row has the "…" button plus the same right-click menu (switch / edit / delete; delete is disabled on the current connection). Rows slide in and out. The add / switch / delete dialogs use Banner for errors, pending buttons, outline Cancel with the primary action on the right, and titles without question marks.
  • Remote mode keeps the two groups ("The app on this Mac" / "Configuration on "); the server's sections are read-only while the link is down.

Update window (src/UpdateWindow.tsx)

App icon header; a determinate progress bar only when the download size is known; a pulsing dot while waiting for in-flight requests, with a Close button for that step (closing does not stop the update); failures as an error Banner with Retry; the Homebrew command in a surface-coloured field. No expand/collapse animation, since the window's height follows the content.

Navigation

  • The "Listen settings not in effect" notice now opens Settings at the Listening section (view settings:listen); the shell's go and the pending-view handler understand settings:<section>.
  • "Show in app" in the config file editor jumps straight to Listening or Log retention.
  • Command palette settings entries (Command palette: search entities, open page dialogs, shortcut sheet #192) resolve against the new page. Rows have their own anchors (language, appearance, menu bar, launch at login, notices, updates, diagnostics): the page scrolls to the row, highlights its section in the index and briefly tints the row. palette/sections.ts takes its titles from the new dictionaries (its doc asked for exactly this on a settings redesign); the menu bar entry is macOS-only, like the row.

Removed

src/Config.tsx, Appearance, Language, MenubarSettings, NoticeSettings, the settings half of Update and their dictionaries (merged into src/settings/*), and the strings nothing uses any more.

Decisions

  • The index is text only (no per-item icons): the sidebar already carries icons, and a second icon column competes with it.
  • Cards use the popover surface (white in light mode, one step up in dark), like grouped settings in macOS, and no shadow (per the kit).
  • Scroll-spy: a section is active once its top passes a line near the top of the page. The sections at the end that can never reach that line (About, Uninstall) share the last stretch of scrolling in order, so each is highlighted in turn and the last one is active at the bottom; previously About could never become active by scrolling. Verified by a top-to-bottom sweep in seven layouts (zh/en, remote, tall and short windows, ?fail, unlinked).
  • A new version shows as warn (amber): it needs attention but nothing is broken.
  • Diagnostics stays hidden in remote mode, as before.
  • The generated diagnostics path is shown inline under the row, so there is no toast.
  • Copy follows the written style: "当前无已接管的客户端", "无需修改任何客户端。", and a space in "这台 Mac 上" (Latin next to CJK).

Checks

  • pnpm typecheck, pnpm test, pnpm build
  • cargo fmt --check, cargo clippy --all-targets -- -D warnings, cargo test (against twcore v0.47.0)
  • Visual review in the full-app harness: light and dark, zh and en, 1100×720 and 820×560, ?fail, ?slow, ?remote, ?remote=down, ?down=stopped, ?update, install=homebrew|dev, and the update window in each step (idle, downloading, waiting, failed, Homebrew, development build).

🤖 Generated with Claude Code

@fylorn
fylorn force-pushed the ui/settings branch 2 times, most recently from 27025d9 to 11710ea Compare September 24, 2026 23:39
…ete states; update window polish

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fylorn
fylorn merged commit 5539788 into dev Sep 25, 2026
4 checks passed
@fylorn
fylorn deleted the ui/settings branch September 25, 2026 00:07
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