-
Notifications
You must be signed in to change notification settings - Fork 0
more frontend stuff #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the frontend lottery application to improve code formatting, user experience, and adds network chain validation. The changes focus on enhancing the UI layout, error handling, and adding proper network switching functionality.
- Adds chain validation and network switching capabilities for HyperEVM
- Restructures the UI layout with improved status panels and action buttons
- Enhances error handling and user feedback with better validation messages
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| frontend/src/app/providers.tsx | Adds HyperEVM chain support to Privy provider configuration |
| frontend/src/app/app/page.tsx | Major refactoring of UI layout, adds network validation, improves error handling and user feedback |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| { round: currentRound - BigInt(2), winner: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", prize: BigInt("180000000000000000") }, | ||
| { round: currentRound - BigInt(3), winner: "0x66f820a414680B5bcda5eECA5dea238543F42054", prize: BigInt("120000000000000000") }, | ||
| ].filter(r => r.round > BigInt(0))); | ||
| const rows = [ |
Copilot
AI
Aug 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The RecentWinners component uses hardcoded static data instead of fetching actual winner data from the contract. This should use dynamic data based on the currentRound parameter or be clearly labeled as demo/placeholder data.
| const [addr] = await client.requestAddresses(); | ||
| setAddress(addr as Address); | ||
| try { | ||
| const hexId = await provider.request({ method: 'eth_chainId' } as any); |
Copilot
AI
Aug 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code uses 'as any' type assertion for the provider request. Consider defining a proper interface for the provider request method parameters to maintain type safety.
| const hexId = await provider.request({ method: 'eth_chainId' } as any); | |
| interface ProviderRequestPayload { | |
| method: string; | |
| params?: unknown[]; | |
| } | |
| const hexId = await provider.request({ method: 'eth_chainId' } as ProviderRequestPayload); |
| if (ticketUnit !== BigInt(0) && parsedAmount % ticketUnit !== BigInt(0)) return; | ||
| if (!address) { | ||
| setTxError("Please connect your wallet to deposit."); | ||
| try { if (typeof window !== 'undefined') window.alert('Please connect your wallet to deposit.'); } catch {} |
Copilot
AI
Aug 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using window.alert() for user notifications provides a poor user experience. Consider using a toast notification or modal component instead of browser alerts.
| } | ||
| if (parsedAmount === BigInt(0)) { | ||
| setTxError("Enter a valid amount to deposit."); | ||
| try { if (typeof window !== 'undefined') window.alert('Enter a valid amount to deposit.'); } catch {} |
Copilot
AI
Aug 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using window.alert() for user notifications provides a poor user experience. Consider using a toast notification or modal component instead of browser alerts.
| if (ticketUnit !== BigInt(0) && parsedAmount % ticketUnit !== BigInt(0)) { | ||
| const unitStr = formatToken(ticketUnit, decimals); | ||
| setTxError(`Amount must be a multiple of the ticket unit (${unitStr}).`); | ||
| try { if (typeof window !== 'undefined') window.alert(`Amount must be a multiple of the ticket unit (${unitStr}).`); } catch {} |
Copilot
AI
Aug 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using window.alert() for user notifications provides a poor user experience. Consider using a toast notification or modal component instead of browser alerts.
| } | ||
| if (!demoMode && !(roundState === 0 && !(devSimEnd || timeLeft <= 0))) { | ||
| setTxError("Deposits are disabled for the current round."); | ||
| try { if (typeof window !== 'undefined') window.alert('Deposits are disabled for the current round.'); } catch {} |
Copilot
AI
Aug 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using window.alert() for user notifications provides a poor user experience. Consider using a toast notification or modal component instead of browser alerts.
No description provided.