Skip to content

feat: Misc Sideshift page polish#667

Open
Klakurka wants to merge 1 commit into
masterfrom
feat/sideshift-polish-20260723
Open

feat: Misc Sideshift page polish#667
Klakurka wants to merge 1 commit into
masterfrom
feat/sideshift-polish-20260723

Conversation

@Klakurka

@Klakurka Klakurka commented Jul 24, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features
    • Added clearer back-navigation options throughout the alternative payment flow.
    • Back actions now return to the appropriate previous step when editing payment amounts or selecting rates.
  • Bug Fixes
    • Improved minimum and maximum amount validation messaging.
    • Enhanced error-state handling for editable payment details.
  • Style
    • Improved loading, error, and payment layouts with more consistent sizing, spacing, and centering.

@Klakurka Klakurka self-assigned this Jul 24, 2026
@Klakurka Klakurka added the enhancement (UI/UX/feature) New feature or request label Jul 24, 2026
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Altpayment widget layout sizing and loading/error presentation were revised. Manual amount validation now uses a computed message, while Back navigation conditionally resets trades, returns to rate selection, or exits the widget.

Changes

Altpayment UI flow

Layer / File(s) Summary
Altpayment layout and presentation
react/lib/components/Widget/AltpaymentWidget.tsx, react/lib/components/Widget/Widget.tsx
Updated altpayment container sizing, loading alignment, Back link styling, amount error presentation, and parent wrapper dimensions.
Back-navigation state and callbacks
react/lib/components/Widget/AltpaymentWidget.tsx
Added manual amount navigation state and callbacks, conditionally rendered Back controls, and routed the widget-level Back action through backToWidget.
Amount validation rendering
react/lib/components/Widget/AltpaymentWidget.tsx
Replaced separate min/max error blocks with one visibility-controlled AmountError using the computed validation message, with navigation back to rate selection.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • PayButton/paybutton#607: Both changes modify altpayment layout sizing and positioning in AltpaymentWidget.tsx.
  • PayButton/paybutton#651: Both changes are coupled to altpayment rendering, flow callbacks, and sizing across the widget components.
  • PayButton/paybutton#653: Both changes update ShiftReady UI and altpayment sizing in the same components.

Suggested reviewers: chedieck

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning No PR description was provided, so the required template sections are missing. Add the template sections: Related to, Description, Test plan, and optional Depends on/Remarks with concrete details.
Title check ❓ Inconclusive The title is related, but "Misc" is vague and doesn't describe the specific UI changes. Make the title specific, e.g. mention the Sideshift altpayment widget layout and back-navigation updates.
✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ 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 feat/sideshift-polish-20260723

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

react/lib/components/Widget/AltpaymentWidget.tsx

Parsing error: error TS5012: Cannot read file '/tsconfig.json': ENOENT: no such file or directory, open '/tsconfig.json'.

react/lib/components/Widget/Widget.tsx

Parsing error: error TS5012: Cannot read file '/tsconfig.json': ENOENT: no such file or directory, open '/tsconfig.json'.


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.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@react/lib/components/Widget/AltpaymentWidget.tsx`:
- Around line 748-755: Update the altpaymentError branch in AltpaymentWidget so
non-editable flows also render an exit or retry action when
showManualAmountBackButton is false. Use backToWidget or the existing resetTrade
path as appropriate, while preserving the current manual-amount Back behavior.
- Around line 734-736: Update backToWidget to reset the parent-owned altpayment
trade, loading, shift, and error state before calling setUseAltpayment(false).
Reuse the existing state-reset mechanism or setters exposed by Widget.tsx, and
apply the same reset behavior to the other Back handler around the alternate
location.
- Around line 709-715: Update the amountValidationMessage logic in
AltpaymentWidget so null validation flags do not produce error messages; only
display the below- or above-maximum messages when isAboveMinimumAltpaymentAmount
or isBelowMaximumAltpaymentAmount is explicitly false, while preserving the
existing pairAmount requirement.
- Around line 414-417: Update the BackLink clickable element to use a native
button with type="button" or an equivalent MUI button primitive, preserving its
existing styling and click handling while making it keyboard-focusable and
operable.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8c1362df-ef23-49f3-ad44-8a04c9a2371d

📥 Commits

Reviewing files that changed from the base of the PR and between e32983a and f63ffbb.

📒 Files selected for processing (2)
  • react/lib/components/Widget/AltpaymentWidget.tsx
  • react/lib/components/Widget/Widget.tsx

Comment on lines +414 to 417
fontSize: '14px', cursor: 'pointer',
border: '1px solid #000', opacity: '0.7', padding: '2px 20px',
borderRadius: '3px', '&:hover': { opacity: '1' },
})

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== locate file =="
fd -a 'AltpaymentWidget.tsx$' . || true

echo "== file stats =="
wc -l react/lib/components/Widget/AltpaymentWidget.tsx

echo "== BackLink usages and definitions around referenced ranges =="
sed -n '390,430p' react/lib/components/Widget/AltpaymentWidget.tsx
printf '\n--- range 740-760 ---\n'
sed -n '740,760p' react/lib/components/Widget/AltpaymentWidget.tsx
printf '\n--- range 845-865 ---\n'
sed -n '845,865p' react/lib/components/Widget/AltpaymentWidget.tsx
printf '\n--- range 905-925 ---\n'
sed -n '905,925p' react/lib/components/Widget/AltpaymentWidget.tsx
printf '\n--- range 994-1014 ---\n'
sed -n '994,1014p' react/lib/components/Widget/AltpaymentWidget.tsx

echo "== search BackLink definitions/usages =="
rg -n "BackLink|backToWidget|showManualAmountBackButton|AmountBackButton" react/lib/components/Widget/AltpaymentWidget.tsx

Repository: PayButton/paybutton

Length of output: 5044


Make BackLink keyboard-accessible.

BackLink is rendered as a clickable <div> without focusability or a keyboard handler, so keyboard and assistive-technology users cannot operate these navigation controls. Use a real <button type="button"> or MUI button primitive while preserving the same styling and handling.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@react/lib/components/Widget/AltpaymentWidget.tsx` around lines 414 - 417,
Update the BackLink clickable element to use a native button with type="button"
or an equivalent MUI button primitive, preserving its existing styling and click
handling while making it keyboard-focusable and operable.

Comment on lines +709 to +715
const showManualAmountBackButton = altpaymentEditable
const amountValidationMessage =
pairAmount && !isAboveMinimumAltpaymentAmount
? 'Amount is below minimum.'
: pairAmount && !isBelowMaximumAltpaymentAmount
? 'Amount is above maximum.'
: ''

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Do not treat uninitialized validation flags as failures.

Both flags initially equal null; while pairAmount is truthy, !null evaluates to true, so a valid amount can briefly render “Amount is below minimum” before the validation effect runs. Compare explicitly with === false or initialize the flags to a neutral valid state.

Proposed fix
 const amountValidationMessage =
-  pairAmount && !isAboveMinimumAltpaymentAmount
+  pairAmount && isAboveMinimumAltpaymentAmount === false
     ? 'Amount is below minimum.'
-    : pairAmount && !isBelowMaximumAltpaymentAmount
+    : pairAmount && isBelowMaximumAltpaymentAmount === false
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const showManualAmountBackButton = altpaymentEditable
const amountValidationMessage =
pairAmount && !isAboveMinimumAltpaymentAmount
? 'Amount is below minimum.'
: pairAmount && !isBelowMaximumAltpaymentAmount
? 'Amount is above maximum.'
: ''
const showManualAmountBackButton = altpaymentEditable
const amountValidationMessage =
pairAmount && isAboveMinimumAltpaymentAmount === false
? 'Amount is below minimum.'
: pairAmount && isBelowMaximumAltpaymentAmount === false
? 'Amount is above maximum.'
: ''
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@react/lib/components/Widget/AltpaymentWidget.tsx` around lines 709 - 715,
Update the amountValidationMessage logic in AltpaymentWidget so null validation
flags do not produce error messages; only display the below- or above-maximum
messages when isAboveMinimumAltpaymentAmount or isBelowMaximumAltpaymentAmount
is explicitly false, while preserving the existing pairAmount requirement.

Comment on lines +734 to +736
const backToWidget = () => {
setUseAltpayment(false)
}

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.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Reset parent-owned altpayment state before hiding the widget.

Widget.tsx retains coinPair, loadingPair, loadingShift, and shift/error state after setUseAltpayment(false). If Back is pressed during a pending request, the socket is disconnected but loading flags and stale rates remain; reopening can show stale data or hide the rate-selection button indefinitely.

Clear the trade and loading state before leaving the widget.

Proposed fix
 const backToWidget = () => {
+  resetTrade()
+  setLoadingPair(false)
+  setLoadingShift(false)
   setUseAltpayment(false)
 }

Also applies to: 1004-1006

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@react/lib/components/Widget/AltpaymentWidget.tsx` around lines 734 - 736,
Update backToWidget to reset the parent-owned altpayment trade, loading, shift,
and error state before calling setUseAltpayment(false). Reuse the existing
state-reset mechanism or setters exposed by Widget.tsx, and apply the same reset
behavior to the other Back handler around the alternate location.

Comment on lines 748 to +755
{altpaymentError ? (
<Fragment>
<ErrorMsg>Error: {altpaymentError.errorMessage}</ErrorMsg>
<BackLink onClick={resetTrade}>Back</BackLink>
{showManualAmountBackButton ? (
<BackRow>
<BackLink onClick={resetTrade}>Back</BackLink>
</BackRow>
) : null}

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.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Keep an exit or retry action available for every altpayment error.

When altpaymentEditable is false, showManualAmountBackButton is false, so the error branch renders only the error text. Auto-start and fixed-amount users can become trapped in altpayment mode with no way to recover.

Render a Back/Retry action for non-editable flows as well, using backToWidget or an equivalent reset path.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@react/lib/components/Widget/AltpaymentWidget.tsx` around lines 748 - 755,
Update the altpaymentError branch in AltpaymentWidget so non-editable flows also
render an exit or retry action when showManualAmountBackButton is false. Use
backToWidget or the existing resetTrade path as appropriate, while preserving
the current manual-amount Back behavior.

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

Labels

enhancement (UI/UX/feature) New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant