Frontend — Modal
Summary
The AddOwner, RemoveOwner, and weight-change proposal forms each need to show a before/after voting-power preview, and left unchecked each one will grow its own slightly different copy of that logic. This issue consolidates that into a single shared component so all three forms present the same preview consistently and any future fix or styling change only has to happen once.
Background
By the time this issue is picked up, the AddOwner, RemoveOwner, and "Propose Weight Change" forms in CreateProposalModal.tsx and OwnersPage.tsx each independently compute and render a "what will total weight and quorum look like after this proposal executes" preview, using the weight-percentage formatting helpers in soroban.ts. Each form's preview shows slightly different specifics (AddOwner shows a fixed +1 weight increase, RemoveOwner shows a decrease and a possible quorum-break warning, weight-change shows an owner's before/after share), but the underlying shape — a labeled before value, an after value, and a percentage — is the same across all three.
What Needs to Be Done
- Create a new component (for example,
frontend/src/components/VotingPowerPreview.tsx) that takes a before weight, an after weight, a total weight, and renders a consistent "before → after" summary with percentage shares, using the existing weight-percentage formatting helpers.
- Support an optional warning state (a boolean plus a message) so the RemoveOwner form's quorum-break warning can use the same component instead of a separate ad hoc warning block.
- Replace the bespoke preview markup in the AddOwner, RemoveOwner, and weight-change forms with this shared component, keeping each form's specific data-fetching logic in place — only the rendering is consolidated.
- Confirm visually (or with a snapshot test) that each form's preview looks the same as it did before the refactor, since this issue is not meant to change behavior, only reduce duplication.
Acceptance Criteria
Files to Look At
frontend/src/components/CreateProposalModal.tsx — AddOwner and RemoveOwner forms with their own preview logic to consolidate
frontend/src/pages/OwnersPage.tsx — weight-change proposal form with its own preview logic to consolidate
frontend/src/lib/soroban.ts — shared weight-percentage formatting helpers the new component should build on
Difficulty: Medium
Frontend — Modal
Summary
The AddOwner, RemoveOwner, and weight-change proposal forms each need to show a before/after voting-power preview, and left unchecked each one will grow its own slightly different copy of that logic. This issue consolidates that into a single shared component so all three forms present the same preview consistently and any future fix or styling change only has to happen once.
Background
By the time this issue is picked up, the AddOwner, RemoveOwner, and "Propose Weight Change" forms in
CreateProposalModal.tsxandOwnersPage.tsxeach independently compute and render a "what will total weight and quorum look like after this proposal executes" preview, using the weight-percentage formatting helpers insoroban.ts. Each form's preview shows slightly different specifics (AddOwner shows a fixed +1 weight increase, RemoveOwner shows a decrease and a possible quorum-break warning, weight-change shows an owner's before/after share), but the underlying shape — a labeled before value, an after value, and a percentage — is the same across all three.What Needs to Be Done
frontend/src/components/VotingPowerPreview.tsx) that takes a before weight, an after weight, a total weight, and renders a consistent "before → after" summary with percentage shares, using the existing weight-percentage formatting helpers.Acceptance Criteria
VotingPowerPreviewcomponent exists and is used by all three governance proposal forms that need a weight preview.Files to Look At
frontend/src/components/CreateProposalModal.tsx— AddOwner and RemoveOwner forms with their own preview logic to consolidatefrontend/src/pages/OwnersPage.tsx— weight-change proposal form with its own preview logic to consolidatefrontend/src/lib/soroban.ts— shared weight-percentage formatting helpers the new component should build onDifficulty: Medium