feat(send): preflight balance check at input time#1098
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
| <PageFooter className="sm:pb-14"> | ||
| <Numpad | ||
| showDecimal={maxInputDecimals > 0} | ||
| onButtonClick={(value) => { |
There was a problem hiding this comment.
@claude can you revert this diff on these lines
There was a problem hiding this comment.
Claude finished @gudnuf's task in 1m 27s —— View job
Reverted numpad formatting change
- Locate the diff at
app/features/send/send-input.tsx:276 - Revert the
onButtonClickarrow-function formatting change - Run
bun run fix:allto verify - Commit and push
Restored the original (value) => { handleNumberInput(value, startShakeAnimation); } block-body in app/features/send/send-input.tsx (was changed to an expression body — a pure formatting change unrelated to the preflight balance feature). Pushed as 8b11655.
· branch: feat/preflight-balance
| onSwitch={switchInputCurrency} | ||
| money={convertedValue} | ||
| /> | ||
| {insufficientBalance ? ( |
There was a problem hiding this comment.
i would rather show this somehow without hiding exchange rate
| @@ -262,7 +295,7 @@ export function SendInput() { | |||
| <div className="flex items-center justify-end"> | |||
| <Button | |||
| onClick={() => handleContinue(inputValue, convertedValue)} | |||
| disabled={inputValue.isZero()} | |||
| disabled={inputValue.isZero() || insufficientBalance} | |||
There was a problem hiding this comment.
i wonder if we should allow click but then show insufficient balance toast instead of showing it on every amount change?
| @@ -68,6 +69,20 @@ export default function SendScanner() { | |||
|
|
|||
| const convertedAmount = | |||
| amount.currency !== sendAccount.currency ? convert(amount) : undefined; | |||
|
|
|||
| if (exceedsAccountBalance(amount, convertedAmount, sendAccount)) { | |||
There was a problem hiding this comment.
this is related to my comment on that other pr that changes send scanner and it kind of proves my point there. now scanner becomes even more aware of something it shouldn't be its resposibility
| sendAccount, | ||
| ); | ||
|
|
||
| const wasInsufficient = useRef(false); |
Rebased onto post-monorepo master; paths relocated app/ -> apps/web-wallet/app/. Original commits: - feat(send): preflight balance check at input time - refactor(send): shake inline on numpad keypress - chore(send): drop balance-check unit tests - refactor(send): drop dead check + tighten balance-check JSDoc - docs(send): reword balance-check JSDoc - refactor(send): expose previewNext, shake on balance-transition only - Revert "refactor(send): expose previewNext, shake on balance-transition only" - fix(send): shake on balance-transition via useEffect - revert(send): restore numpad onButtonClick arrow-body formatting
8b11655 to
da6432c
Compare
Closes #425.
exceedsAccountBalancehelper atapp/features/send/balance-check.ts, consumed bysend-input.tsxandsend-scanner.tsx.false) when balance is unknown (Spark account still syncing) — better to attempt the send than block on missing data.inputValue/convertedValuepair; no new converter.UX:
useEffect+useRefon previous value) — not on every keypress while over./sendwith destination chip intact.