Repository navigation
refactor(ui): derive step status and ledger account in page - #213
Merged
Merged
Conversation
J-Engine-Session: toshi:ca2d90e5-8e3f-445d-9cb2-12325ea1e42d
Collaborator
✅ Heimdall Review Status
|
jackchuma
marked this pull request as ready for review
October 27, 2026 08:12
xenoliss
approved these changes
Oct 27, 2026
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.
What changed? Why?
Two small cleanups in
src/app/page.tsx, with no behavior change:currentStep === X ? 'current' : (cond ? 'completed' : 'pending') as StepStatusfive times, with an inline union cast on the first entry. A localstepStatus(step, completed)helper now builds every status, and the casts are gone. The confirmation step passesfalse, so it is still onlycurrentorpending.userLedgerAccountwas separate state that only mirroredselectedUser.ledgerId: it was set when a user was selected and reset to 0 when the selection was cleared, the same momentsselectedUserchanges. It is removed, andHardwareSigninggetsselectedUser?.ledgerId ?? 0.Interfaces removed: none.
userLedgerAccountwas local component state, read only by theHardwareSigningprop.Notes to reviewers
(currentStep, condition)pair.ConfigOption.ledgerIdis a requirednumber(src/components/UserSelection.tsx), andHardwareSigningrenders only at theledgerstep, after a user is selected. So the derived value matches the old one, including account 0.?? 0matches the old initial value.How has it been tested?
No new tests: jest runs only
__tests__/**/*.test.tsin a node environment with no component harness, and this is a behavior-preserving refactor. Rannpm run build,npm run lint,npx prettier --check .,npx tsc --noEmit, andnpm test(14 suites, 172 tests); all pass.Why this cleanup
src/app/page.tsx. Tests: unchanged.userLedgerAccountwas local component state).userLedgerAccountandselectedUserstay in sync, or work out why the five step entries use three different cast styles. The step list is now five one-line rows.selectedUser.ledgerId, and the change removes redundant state plus five copies of one ternary, which the in-development cleanup rules call worth doing.