ISSUE-CU06-003: Implement UI-Contract for Claiming Prizes
β¨ Issue Request
Implement the complete user interface for the prize claiming functionality (CU-06), allowing players to visualize their tickets with assigned prizes and execute the claim transaction from the frontend in an intuitive and secure manner.
π Description
This issue focuses exclusively on the frontend implementation for use case CU-06 "Claim Prize". The smart contract functionality must be implemented previously (see SL-CU06-001).
We need to implement:
-
Prize Claiming Page (/claim-prizes)
- Display user's ticket list with assigned prizes
- Filter only tickets with
prize_assigned = true and claimed = false
- Responsive and modern design
-
UI Components
- Ticket cards with detailed information
- "Claim prize" button with dynamic states
- Success/error notifications
- Loading states during transactions
-
Starknet Integration
- Connection with wallet (Argent/Braavos)
- Execute
ClaimPrize transaction
- Automatic UI update after claiming
- Contract error handling
-
Custom Hooks
- Hook to get claimable tickets
- Hook to execute claim
- Hook to verify transaction status
π οΈ Steps to Reproduce (if applicable)
Current context:
- No prize claiming page exists in frontend
- Users cannot visualize their assigned prizes
- No integration with contract's
ClaimPrize function
- No reusable components to display tickets with prizes
πΌοΈ Screenshots (if applicable)
Not applicable - new functionality to implement.
Suggested design references:
- Existing profile page for style consistency
- Dashboard with ticket cards
- Scaffold-Stark components for common patterns
π― Expected Behavior
The implementation must meet the following requirements:
Main Page (/claim-prizes):
- πΉ Display title "Claim Prizes"
- πΉ Verify wallet connection (show message if not connected)
- πΉ Get all finalized draws with
distribution_done = true
- πΉ For each draw, get user's tickets with prizes
- πΉ Display list of claimable ticket cards
- πΉ Show message if no prizes available
- πΉ Loading skeleton while loading data
- πΉ Responsive design (mobile, tablet, desktop)
ClaimPrizeCard Component:
- πΉ Display draw ID and date
- πΉ Display ticket numbers (e.g., "5 - 12 - 23 - 34 - 40")
- πΉ Display prize amount in STRKP with formatting
- πΉ Display match level (1-4 matches)
- πΉ "Claim" button with states:
- Enabled: Prize available
- Disabled: Already claimed or no prize
- Loading: Transaction in progress
- πΉ Status badge (Available / Claimed)
- πΉ Attractive design with theme colors
Wallet Integration:
- πΉ Detect connected wallet
- πΉ Get user address
- πΉ Execute
ClaimPrize transaction on click
- πΉ Show wallet confirmation modal
- πΉ Wait for transaction confirmation
- πΉ Automatically update UI after confirming
Notifications and UX:
- πΉ Success toast with block explorer link
- πΉ Error toast with descriptive message
- πΉ Loading spinner in button during transaction
- πΉ Disable button after claiming
- πΉ Clear visual feedback at each step
- πΉ Contract error handling (translate Cairo errors)
Navigation:
- πΉ Add link in main menu
- πΉ Badge with number of available prizes (optional)
- πΉ Accessible route:
/claim-prizes or /profile/claim-prizes
π Suggested Solution / Feature Request
File Structure
packages/nextjs/
βββ app/
β βββ claim-prizes/
β βββ page.tsx # Main page
βββ components/
β βββ claim-prizes/
β βββ ClaimPrizeCard.tsx # Individual card
β βββ ClaimPrizesList.tsx # Card list
β βββ EmptyClaimState.tsx # Empty state
βββ hooks/
βββ scaffold-stark/
βββ useClaimablePrizes.ts # Hook to get prizes
βββ useClaimPrize.ts # Hook to claim
Implementation
[Same code examples as Spanish version above]
π Additional Notes
Issue Dependencies:
- SL-CU06-001: Contract's
ClaimPrize function must be implemented
- Deployed Contract: Must be in
deployedContracts.ts
- Wallet: User must have connected wallet (Argent/Braavos)
UX Considerations:
- Loading States: Show skeletons while loading
- Error Handling: Translate technical errors to friendly messages
- Visual Feedback: Clear success/error confirmations
- Responsiveness: Functional on mobile, tablet and desktop
- Accessibility: Use semantic HTML and ARIA labels
Internationalization:
- Consider adding translations (i18n)
- Support Spanish and English
- Format numbers according to locale
Performance:
- Paginate prize list if many
- Lazy loading of heavy components
- Optimize re-renders with React.memo
Testing (Manual):
- β
Connect wallet and verify prizes load
- β
Click "Claim" and sign transaction
- β
Verify success notification
- β
Verify button disables after claiming
- β
Verify responsive on mobile
- β
Test with wallet without prizes (empty state)
- β
Test errors (no funds, already claimed, etc.)
β οΈ Before Applying
Please read this guide: Contributor Guidelines
Definition of Done:
ISSUE-CU06-003: Implement UI-Contract for Claiming Prizes
β¨ Issue Request
Implement the complete user interface for the prize claiming functionality (CU-06), allowing players to visualize their tickets with assigned prizes and execute the claim transaction from the frontend in an intuitive and secure manner.
π Description
This issue focuses exclusively on the frontend implementation for use case CU-06 "Claim Prize". The smart contract functionality must be implemented previously (see SL-CU06-001).
We need to implement:
Prize Claiming Page (
/claim-prizes)prize_assigned = trueandclaimed = falseUI Components
Starknet Integration
ClaimPrizetransactionCustom Hooks
π οΈ Steps to Reproduce (if applicable)
Current context:
ClaimPrizefunctionπΌοΈ Screenshots (if applicable)
Not applicable - new functionality to implement.
Suggested design references:
π― Expected Behavior
The implementation must meet the following requirements:
Main Page (
/claim-prizes):distribution_done = trueClaimPrizeCard Component:
Wallet Integration:
ClaimPrizetransaction on clickNotifications and UX:
Navigation:
/claim-prizesor/profile/claim-prizesπ Suggested Solution / Feature Request
File Structure
Implementation
[Same code examples as Spanish version above]
π Additional Notes
Issue Dependencies:
ClaimPrizefunction must be implementeddeployedContracts.tsUX Considerations:
Internationalization:
Performance:
Testing (Manual):
Please read this guide: Contributor Guidelines
Definition of Done:
/claim-prizescreated and functionalClaimPrizeCard,ClaimPrizesList,EmptyClaimStateimplementeduseClaimablePrizesworking correctlyClaimPrizeexecuting correctlyyarn formatyarn build