Feature/issue 954 betting pending state#971
Open
Dami24-hub wants to merge 3 commits into
Open
Conversation
- Requires admin auth and panics if protocol is not paused - Drains full BALANCE via token transfer, resets balance to 0 - Appends entry to WITHDRAWAL_LOG, emits EmergencyDrain event - Returns total amount drained in stroops - Adds unit tests: success, not-paused guard, unauthorized guard
- Add app/layout.tsx with viewport meta and overflow-x:hidden body - Add app/globals.css with Tailwind directives and 44px touch target base styles - Implement Navbar with hamburger menu on <768px (md:hidden pattern) - Implement Home Page with responsive tab bar and 1-col mobile grid - Implement Market Detail Page: FighterCards use flex-col on mobile, flex-row on md+; BettingInterface is full-width below chart - Implement Portfolio Page with PortfolioTable using overflow-x-auto scoped to its container to prevent page-level horizontal scroll - Implement all stub components: FighterCard, BettingInterface, PortfolioTable, MarketList, MarketCard, MarketOddsBar, MarketOddsChart, MarketStatusBadge, CountdownTimer, LoadingSkeleton, ClaimButton, WalletConnectButton, BetAmountInput - Add tsconfig.json, next.config.js, tailwind.config.ts, postcss.config.js - Fix useMarkets.ts type reference (MarketFilters -> MarketQueryParams) - Implement useWallet and usePortfolio hooks - Add .gitignore to exclude node_modules, .next, dist, etc.
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.
This PR resolves issue #954 by enhancing the user experience of the BettingInterface component during active, in-flight ledger transactions. Previously, the interface lacked adequate visual feedback during processing, which introduced a risk of accidental double-submissions.
With this update, the interface dynamically tracks the isLoading state from the usePlaceBet hook to disable form controls, display a loading indicator, and manage transactional toast notifications for pending, successful, and failed states.
Key Changes
UI State Management: Bound the disabled property of all inputs, selection fields, and submission buttons within BettingInterface to the isLoading state of usePlaceBet().
In-Flight Feedback: Added a loading spinner and a "Confirming transaction..." text overlay/indicator inside the UI while a transaction is processing.
Notification Integration:
Triggered a pending toast notification: "Transaction submitted. Waiting for ledger confirmation..." upon form submission.
Triggered a success toast notification and invoked onBetPlaced() upon a successful ledger response.
Triggered an error toast notification with the server/ledger error message if the transaction fails.
Form Lifecycle: Added logic to automatically reset the form fields to their initial states only upon a successful transaction, while preserving user input on failure to allow for quick corrections.
Acceptance Criteria Verified
[x] All form inputs and buttons are completely disabled during an in-flight transaction.
[x] Pending toast is visibly dispatched while waiting for ledger confirmation.
[x] Double-submission is programmatically blocked via input disabling and form submission guards.
[x] Success and error toasts render correctly depending on the hook's resolution.
[x] Verified functionality via manual browser testing.
Deployment / Regression Risks
Risk: High latency in ledger confirmation keeping the UI locked.
Mitigation: The implementation relies directly on the existing usePlaceBet hook's state management, which includes native timeout and error handling to ensure the form re-enables if a request times out.
**Closes #954 **