Skip to content

more frontend stuff - #3

Open
Dhaiwat10 wants to merge 3 commits into
mainfrom
dp/frontend
Open

more frontend stuff#3
Dhaiwat10 wants to merge 3 commits into
mainfrom
dp/frontend

Conversation

@Dhaiwat10

Copy link
Copy Markdown
Member

No description provided.

@Dhaiwat10
Dhaiwat10 requested a review from CopilotAugust 20, 2025 12:36
@vercel

vercelBot commented Aug 20, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentPreviewCommentsUpdated (UTC)
poolzReadyReadyPreviewCommentAug 20, 2025 0:37am

CopilotAI left a comment

Copy link
Copy Markdown

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.

FileDescription
frontend/src/app/providers.tsxAdds HyperEVM chain support to Privy provider configuration
frontend/src/app/app/page.tsxMajor 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 = [

CopilotAIAug 20, 2025

Copy link

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.

Copilot uses AI. Check for mistakes.
const [addr] = await client.requestAddresses();
setAddress(addr as Address);
try {
const hexId = await provider.request({ method: 'eth_chainId' } as any);

CopilotAIAug 20, 2025

Copy link

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.

Suggested change
consthexId=awaitprovider.request({method: 'eth_chainId'}asany);
interfaceProviderRequestPayload{
method: string;
params?: unknown[];
}
consthexId=awaitprovider.request({method: 'eth_chainId'}asProviderRequestPayload);

Copilot uses AI. Check for mistakes.
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 {}

CopilotAIAug 20, 2025

Copy link

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.

Copilot uses AI. Check for mistakes.
}
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 {}

CopilotAIAug 20, 2025

Copy link

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.

Copilot uses AI. Check for mistakes.
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 {}

CopilotAIAug 20, 2025

Copy link

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.

Copilot uses AI. Check for mistakes.
}
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 {}

CopilotAIAug 20, 2025

Copy link

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.

Copilot uses AI. Check for mistakes.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@Dhaiwat10