refactor: extract shared UI components (Phase 08)#822
Draft
jSydorowicz21 wants to merge 1 commit intoRunMaestro:rcfrom
Draft
refactor: extract shared UI components (Phase 08)#822jSydorowicz21 wants to merge 1 commit intoRunMaestro:rcfrom
jSydorowicz21 wants to merge 1 commit intoRunMaestro:rcfrom
Conversation
- 08A: Extract GhostIconButton (src/renderer/components/ui/GhostIconButton.tsx) encapsulating the "p-N rounded hover:bg-white/10 transition-colors" icon-button pattern. Migrated 54 call sites across 43 files via AST-aware codemod. - 08B: Extract Spinner (src/renderer/components/ui/Spinner.tsx) for the Loader2 + animate-spin loading indicator pattern. Migrated 84 call sites across 55 files and removed 42 now-unused Loader2 imports. - 08C: Add EmptyStatePlaceholder (src/renderer/components/ui/EmptyStatePlaceholder.tsx) for the generic "No X" icon + title + description pattern. Adopted at 2 call sites (AgentSessionsBrowser, AgentSessionsModal). Distinct from the top-level EmptyStateView welcome screen. Added minimal vitest coverage for each new primitive (13 tests total). All three components exported from src/renderer/components/ui/index.ts. Net impact: 70 files changed, 404 insertions(+), 582 deletions(-).
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extracts three shared UI primitives and migrates existing call sites. Net effect: one canonical pattern per primitive instead of 140+ hand-rolled variants.
Net: +223 lines overall (new components + tests), but -178 lines in migrated call sites (3 new component files + tests account for the delta)
08A - GhostIconButton
New:
src/renderer/components/ui/GhostIconButton.tsx+ test.The standard "icon-only button with hover bg and optional tooltip" pattern used 100+ times across the renderer.
classNamedrop,aria-label->ariaLabel,style={{color:X}}->color={X})08B - Spinner
New:
src/renderer/components/ui/Spinner.tsx+ test.The standard animated loading indicator wrapping
Loader2from lucide-react.Spinnerthat did something different (CSS-driven circular progress) - renamed those toCircularSpinnerto resolve the name collision08C - EmptyStatePlaceholder
New:
src/renderer/components/ui/EmptyStatePlaceholder.tsx+ test.A generic placeholder for "No X" / "No results" / "Select something" states. Intentionally distinct from the existing
EmptyStateView.tsx, which is the specialized welcome-screen component - different purpose, would have needed a confusing mode prop.AgentSessionsBrowser,AgentSessionsModal)Test plan
npm run lintpasses (all 3 tsconfigs)npx prettier --check .passesRisk
Low. Behavior-preserving migration: each call site produces identical DOM/styling. Three new components with dedicated tests. One intentional name-rename (
Spinner->CircularSpinnerin 3 files) for the collision case.Cross-PR interaction
This PR modifies
AgentSessionsModal.tsx, which is deleted by #791 (Phase 01A). Whichever merges second will need a trivial conflict resolution (this PR's edits to that file will be dropped if 01A is already in).