Skip to content

refactor(ui): consolidate Send and Sweep precondition alerts - #1402

Open
kishore08-07 wants to merge 1 commit into
develfrom
kishore/alerts
Open

refactor(ui): consolidate Send and Sweep precondition alerts#1402
kishore08-07 wants to merge 1 commit into
develfrom
kishore/alerts

Conversation

@kishore08-07

@kishore08-07 kishore08-07 commented Aug 2, 2026

Copy link
Copy Markdown
Member

This PR refactors the redundant precondition alert banners for Send and Sweep operations into a single, reusable PreconditionAlert component.

  • Created unified component: Added PreconditionAlert in src/components/ui/jam/ which accepts a summary data object and an i18nPrefix to determine which set of translation keys to load.
  • Updated SendCoinjoinPreconditionAlert and SweepPreconditionAlert to act as wrappers pass their specific localization namespaces (send.coinjoin_precondition and scheduler.precondition) down to the unified component.
  • Consolidated Stories: Deleted the duplicate stories files and created PreconditionAlert.stories.tsx to handle visual variants for both Send and Sweep in one place.

Closes #1396

Signed-off-by: kishore08-07 <kishorebsm8@gmail.com>
@kishore08-07 kishore08-07 self-assigned this Aug 2, 2026
Copilot AI review requested due to automatic review settings August 2, 2026 17:00
@kishore08-07 kishore08-07 added refactoring Code refactoring without functional changes SoB Issues, PRs, tasks, and discussions related to Summer of Bitcoin. labels Aug 2, 2026
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🟢 Lines 89.75% (🎯 85%) 4625 / 5153
🟢 Statements 89.29% (🎯 85%) 5079 / 5688
🟢 Functions 87.43% (🎯 85%) 1635 / 1870
🟢 Branches 81.76% (🎯 80%) 3081 / 3768
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/components/send/SendCoinjoinPreconditionAlert.tsx 100% 100% 100% 100%
src/components/sweep/SweepPreconditionAlert.tsx 100% 100% 100% 100%
src/components/ui/jam/PreconditionAlert.tsx 100% 100% 100% 100%
Generated in workflow #3555 for commit e9fbaf7 by the Vitest Coverage Report Action

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR consolidates the previously duplicated “precondition alert banner” UI for Send (coinjoin) and Sweep flows into a single reusable PreconditionAlert component, keeping the existing wrapper components as thin, i18n-prefixed adapters.

Changes:

  • Added a shared PreconditionAlert component that renders all precondition hints based on a passed summary and i18nPrefix.
  • Refactored SendCoinjoinPreconditionAlert and SweepPreconditionAlert to delegate rendering to the shared component.
  • Consolidated Storybook coverage into a single PreconditionAlert.stories.tsx and removed the two redundant stories.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/stories/jam/SweepPreconditionAlert.stories.tsx Removed duplicate Sweep-only stories in favor of unified stories.
src/stories/jam/SendCoinJoinPreconditionAlert.stories.tsx Removed duplicate Send-only stories in favor of unified stories.
src/stories/jam/PreconditionAlert.stories.tsx Added combined Storybook variants for both Send and Sweep i18n prefixes.
src/components/ui/jam/PreconditionAlert.tsx Introduced the shared alert implementation parameterized by summary + i18nPrefix.
src/components/sweep/SweepPreconditionAlert.tsx Refactored to a thin wrapper around PreconditionAlert with the Sweep namespace.
src/components/send/SendCoinjoinPreconditionAlert.tsx Refactored to a thin wrapper around PreconditionAlert with the Send namespace.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactoring Code refactoring without functional changes SoB Issues, PRs, tasks, and discussions related to Summer of Bitcoin.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: SendCoinjoinPreconditionAlert and SweepPreconditionAlert are similar

2 participants