Skip to content

refactor(web): slim the frontend and move PR display logic to Rust - #33

Merged
imfing merged 2 commits into
mainfrom
refactor/slim-web
Sep 29, 2026
Merged

imfing merged 2 commits into
mainfrom
refactor/slim-web

Conversation

@imfing

@imfing imfing commented Sep 29, 2026

Copy link
Copy Markdown
Owner

Summary

  • Slim the web frontend: drop unused UI primitives, dead helpers, an unused dev dependency, and consolidate settings state into a single useSettings hook (storage keys unchanged, precedence unchanged: localStorage → server config → default)
  • Move PR display logic to Rust: the server now returns a status enum (Open/Draft/Merged/Closed) and pre-computed baseBranch/headBranch labels instead of raw GitHub fields
  • Share thread badge / avatar / delete-button components between the annotation and sidebar views
  • Move the export shell CSS to a real .css file imported with ?raw
  • Web TypeScript drops from 5028 to 4584 lines; Rust is 5030

Follow-up fixes from review

  • PullStatus is a serialized Rust enum so the wire contract with the TS literal union is compiler-checked
  • useSettings reads server-config defaults by typed property, so renaming an AppConfig field fails to compile instead of silently dropping the config.toml default
  • splitPatchByFile warns on a block/file count mismatch instead of silently disabling Copy diff
  • Home/NotFound links use buttonVariants; toolbar link menu renders one DropdownMenuItem with a conditional render prop

Test plan

  • cargo test, cargo clippy -D warnings, cargo fmt --check
  • tsc --noEmit, oxlint, oxfmt --check, vite build
  • Patch parser verified to emit one file per diff --git block for binary, mode-only, submodule, and empty-file blocks

- useSettings: one hook with a per-setting spec (storage key + allowed
  values, first is default) replaces usePersistentState, four validators,
  the config-defaults effect, and the 22-field settings prop plumbing;
  existing localStorage keys are preserved
- gh: compute PR status and branch labels server-side
- DiffView: patchItem helper for version-bumped updates, apiSend for JSON
  requests, one fetchFile loader for hydration, positional copy-diff
  splitting instead of re-parsing patch paths
- Share Home/NotFound layout, thread badges and delete button, toolbar
  chip classes and menu entries; settings popover owns its open state
- Move the export page stylesheet into exportShell.css
- Remove dead code flagged by knip and the unused enhanced-resolve dep
- Serialize PR status as a Rust enum so the wire contract with the
  TypeScript literal union is compiler-checked
- Read server-config defaults by typed property in useSettings so a
  renamed AppConfig field fails to compile instead of silently dropping
  the config.toml default
- Warn on patch block / parsed file count mismatch in splitPatchByFile
  so a missing Copy diff action is explainable
- Use buttonVariants for Home/NotFound links instead of hand-rolled
  positional class strings
- Collapse the duplicated dropdown-item markup in the toolbar link menu
@imfing
imfing merged commit 00c3cb3 into main Sep 29, 2026
8 checks passed
@imfing
imfing deleted the refactor/slim-web branch September 29, 2026 21:16
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