Skip to content

refactor(app): extract prompt-input action bar to action-bar.tsx - #1099

Merged
Astro-Han merged 1 commit into
devfrom
claude/prompt-action-bar
Jun 3, 2026
Merged

refactor(app): extract prompt-input action bar to action-bar.tsx#1099
Astro-Han merged 1 commit into
devfrom
claude/prompt-action-bar

Conversation

@Astro-Han

@Astro-Han Astro-Han commented Jun 3, 2026

Copy link
Copy Markdown
Owner

What

Slice 4 of the serial slimming of packages/app/src/components/prompt-input.tsx. Moves the composer's bottom action bar JSX out of prompt-input.tsx into a new PromptActionBar component in prompt-input/action-bar.tsx.

The new component owns the controls it renders:

  • left group: attach IconButton, PromptModelControl, home-mode WorkspaceChip
  • right group: SessionContextUsage + send/stop Tooltip/SendButton

The button-reveal spring (useSpring driven by mode), its motion style helper, the buttons memo, and the send/stop tip() helper move with it, since they are used only by the action bar. The action bar <div> is always mounted (no <Show> gates it), so relocating the spring into the child preserves its lifetime and animation behavior.

Why

Continue extracting cohesive units so prompt-input.tsx stays small and grep-friendly. prompt-input.tsx drops from 572 to 496 lines.

Change boundary

Pure extraction — no behavior, DOM, aria, copy, or storage-key change. The only seam edits are reading injected props (props.mode, props.actionReady(), props.language, …) in place of the parent's locals. mode is passed as a value prop (mode={store.mode}), kept reactive by Solid's compiled prop getter, so the spring target still tracks store.mode.

Two files touched:

  • prompt-input.tsx (−91): drop the action bar JSX, the spring/motion/buttons trio, tip(), and 8 now-unused imports; add the PromptActionBar import + element.
  • prompt-input/action-bar.tsx (new, +125).

Verification

  • bun run typecheck — 8 successful, 8 total
  • bun test src/components/prompt-input/ — 406 pass, 0 fail
  • bunx eslint on both files — clean
  • Visual: bun run snap prompt-placeholder — action bar renders identically across en/zh × 1440/768/768+rightpanel (attach +, model control, home-mode workspace chip, orange send button, correct left/right layout)
  • Codex review (xhigh) — no P0/P1/P2/P3 findings; confirmed reactivity preserved and rendered output aligned

Risk

Low. Bounded JSX extraction with identical output; no test mounts the full PromptInput, so coverage is the unchanged unit tests of the moved components plus the visual snap.

Summary by CodeRabbit

  • Refactor
    • Reorganized the prompt input interface by refactoring the action bar into a dedicated component structure. This improves internal code organization and maintainability while preserving all user-facing functionality, including send/stop controls, file attachments, model selection, and workspace management.

Move the composer's bottom action bar (attach button, model control,
workspace chip, context-usage, send/stop button) out of prompt-input.tsx
into a new PromptActionBar component in prompt-input/action-bar.tsx. The
button-reveal spring, its motion style helper, the buttons memo, and the
send/stop tooltip move with it since they serve only the action bar.

Pure extraction: no behavior, DOM, aria, copy, or storage-key change.
prompt-input.tsx drops from 572 to 496 lines.
@Astro-Han Astro-Han added P2 Medium priority app Application behavior and product flows ui Design system and user interface task Narrow execution, audit, spike, migration, tracking, or upstream follow-up work labels Jun 3, 2026
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 5bc605cf-3cb6-4bca-8065-5a04ff39ac32

📥 Commits

Reviewing files that changed from the base of the PR and between f076c25 and 9f453cb.

📒 Files selected for processing (2)
  • packages/app/src/components/prompt-input.tsx
  • packages/app/src/components/prompt-input/action-bar.tsx

📝 Walkthrough

Walkthrough

PromptInput's bottom action bar is extracted into a new PromptActionBar component. The existing spring-animated inline implementation is removed, including animation setup, styling helpers, and layout logic. The parent component now delegates to PromptActionBar with state and callback wiring, reducing code duplication and centralizing action bar concerns.

Changes

Action Bar Component Extraction

Layer / File(s) Summary
New PromptActionBar component
packages/app/src/components/prompt-input/action-bar.tsx
PromptActionBar renders animated left-side controls (attach, model, workspace) conditional on mode, and a send/stop button with dynamic tooltip. Visibility and disabled states respond to actionReady, working, abortReady, and stopping signals.
Refactor PromptInput to use PromptActionBar
packages/app/src/components/prompt-input.tsx
Imports are updated to remove useSpring and add PromptActionBar; the inline action bar implementation (animation, helpers, explicit layout) is removed; the bottom action bar is replaced with a PromptActionBar component call passing mode, homeMode, editor state accessors, and callbacks (pick, restoreFocus).

Possibly Related PRs

  • Astro-Han/pawwork#217: Overlaps with spring/animation-driven WorkspaceChip styling changes in the same prompt-input composer UI.
  • Astro-Han/pawwork#1083: Restructures action-bar logic while reusing derived state values (actionReady, abortReady, working, blank, stopping) that are moved into createPromptDerivedState() in that PR.

Poem

🐰 A button bar hops to its own module,
Spring animations dance in the new wrapper,
Send and stop now toggle with flair,
PromptInput breathes lighter air,
bounce bounce


🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: extracting the prompt-input action bar into a separate component file.
Description check ✅ Passed The description is well-structured and covers all required template sections: Summary, Why, Related Issue context, Human Review Status, Review Focus, Risk Notes, and How To Verify with actual verification results.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/prompt-action-bar

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested priority: P2 (includes user-path files (packages/app/src/components/prompt-input.tsx, packages/app/src/components/prompt-input/action-bar.tsx)).

P1/P0 are reserved for maintainer confirmation. Please relabel manually if this is a release blocker, security issue, data-loss risk, or updater/runtime failure.

@Astro-Han
Astro-Han merged commit 46d11c9 into dev Jun 3, 2026
37 of 38 checks passed
@Astro-Han
Astro-Han deleted the claude/prompt-action-bar branch June 3, 2026 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app Application behavior and product flows P2 Medium priority task Narrow execution, audit, spike, migration, tracking, or upstream follow-up work ui Design system and user interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant