Skip to content

refactor: canton offers mobile#14946

Open
ishaba wants to merge 2 commits intodevelopfrom
refactor/canton-offers-mobile
Open

refactor: canton offers mobile#14946
ishaba wants to merge 2 commits intodevelopfrom
refactor/canton-offers-mobile

Conversation

@ishaba
Copy link
Contributor

@ishaba ishaba commented Mar 2, 2026

✅ Checklist

  • npx changeset was attached.
  • Covered by automatic tests.
  • Impact of the changes:
    • live-mobile

📝 Description

Refactor PendingTransferProposals mobile components

❓ Context


🧐 Checklist for the PR Reviewers

  • The code aligns with the requirements described in the linked JIRA or GitHub issue.
  • The PR description clearly documents the changes made and explains any technical trade-offs or design decisions.
  • There are no undocumented trade-offs, technical debt, or maintainability issues.
  • The PR has been tested thoroughly, and any potential edge cases have been considered and handled.
  • Any new dependencies have been justified and documented.
  • Performance considerations have been taken into account. (changes have been profiled or benchmarked if necessary)

@ishaba ishaba requested a review from a team as a code owner March 2, 2026 20:31
Copilot AI review requested due to automatic review settings March 2, 2026 20:31
@live-github-bot live-github-bot bot added the mobile Has changes in LLM label Mar 2, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

⚠️ E2E tests are required

Changes detected require e2e testing before merge (even before asking for any review).

📱 Mobile

-> Run Mobile E2E

  • Select "Run workflow"
  • Branch: refactor/canton-offers-mobile
  • Device: nanoX

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors the Canton PendingTransferProposals feature on ledger-live-mobile by extracting proposal processing into utilities and moving UI logic into dedicated view models, while adding Jest coverage for the new units.

Changes:

  • Extracted proposal processing / grouping / restore-state validation into utils/transferProposals.ts and centralized related types in types.ts.
  • Introduced view models (usePendingTransferProposalsViewModel, details + device modal VMs) and split UI into smaller components (e.g., ProposalsSection, ProposalRow).
  • Added Jest tests for the new utilities, view models, and the extracted View component; added a changeset for live-mobile.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
apps/ledger-live-mobile/src/families/canton/PendingTransferProposals/utils/transferProposals.ts New shared utilities for instruction mapping, proposal processing, grouping, and restore-state validation.
apps/ledger-live-mobile/src/families/canton/PendingTransferProposals/usePendingTransferProposalsViewModel.ts New view model encapsulating modal/details state, grouping, and device confirmation flow.
apps/ledger-live-mobile/src/families/canton/PendingTransferProposals/usePendingTransferProposalsDetailsViewModel.ts New view model for details drawer actions (time remaining, copy, action handler).
apps/ledger-live-mobile/src/families/canton/PendingTransferProposals/useDeviceAppModalViewModel.ts New view model for device app modal confirmation state machine.
apps/ledger-live-mobile/src/families/canton/PendingTransferProposals/types.ts New/expanded shared types for raw/processed proposals, grouping, and modal state.
apps/ledger-live-mobile/src/families/canton/PendingTransferProposals/index.tsx Refactored container to use the new view model and extracted View for testing.
apps/ledger-live-mobile/src/families/canton/PendingTransferProposals/components/useProposalRowViewModel.ts New view model for proposal row display data + callbacks.
apps/ledger-live-mobile/src/families/canton/PendingTransferProposals/components/ProposalsSection.tsx New section component rendering grouped proposals.
apps/ledger-live-mobile/src/families/canton/PendingTransferProposals/components/ProposalRow.tsx New row component using the row view model.
apps/ledger-live-mobile/src/families/canton/PendingTransferProposals/PendingTransferProposalsDetails.tsx Refactored details drawer to consume a processed proposal and a view model.
apps/ledger-live-mobile/src/families/canton/PendingTransferProposals/DeviceAppModal.tsx Refactored device modal to use the new device modal view model.
apps/ledger-live-mobile/src/families/canton/PendingTransferProposals/tests/useProposalRowViewModel.test.ts New unit tests for proposal row view model.
apps/ledger-live-mobile/src/families/canton/PendingTransferProposals/tests/usePendingTransferProposalsViewModel.test.ts New unit tests for main view model behaviors (grouping, modal, restore, device confirm).
apps/ledger-live-mobile/src/families/canton/PendingTransferProposals/tests/usePendingTransferProposalsDetailsViewModel.test.ts New unit tests for details view model.
apps/ledger-live-mobile/src/families/canton/PendingTransferProposals/tests/useDeviceAppModalViewModel.test.ts New unit tests for device modal view model state transitions.
apps/ledger-live-mobile/src/families/canton/PendingTransferProposals/tests/transferProposals.test.ts New unit tests for proposal processing/grouping/restore validation utilities.
apps/ledger-live-mobile/src/families/canton/PendingTransferProposals/tests/test-utils.ts New shared test factories/mocks for Canton accounts and proposals.
apps/ledger-live-mobile/src/families/canton/PendingTransferProposals/tests/index.test.tsx New component test coverage for the extracted View.
.changeset/beige-readers-allow.md Changeset for live-mobile release.

@ishaba ishaba force-pushed the refactor/canton-offers-mobile branch from 5627488 to 8c0bee5 Compare March 2, 2026 20:46
Copilot AI review requested due to automatic review settings March 2, 2026 22:06
@ishaba ishaba force-pushed the refactor/canton-offers-mobile branch from 8c0bee5 to 5c90260 Compare March 2, 2026 22:06
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.

amaslakov
amaslakov previously approved these changes Mar 2, 2026
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 3, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
7.0% Duplication on New Code (required ≤ 3%)
4 New Code Smells (required ≤ 1)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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

Labels

mobile Has changes in LLM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants