-
Notifications
You must be signed in to change notification settings - Fork 0
feat: update account page to display faucet, activity and iexec account #99
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
Conversation
…proved readability
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…ed error handling
b3e767a to
e94037d
Compare
e94037d to
7e86950
Compare
c4283ef to
572449e
Compare
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 account page to consolidate faucet, iExec account management, and wallet activity into a unified tabbed interface. The standalone faucet route has been removed and integrated as a tab within the account page.
Key Changes:
- Moved faucet functionality from a separate route to a tab within the account page
- Created reusable
AddressTabsContentcomponent to share address display logic between account and address pages - Refactored account management into separate module components (
Faucet,ManageIexecAccount)
Reviewed changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
src/routes/$chainSlug/_layout/faucet.tsx |
Deleted - faucet moved to account page module |
src/routes/$chainSlug/_layout/account.tsx |
Refactored to use tabbed interface with Faucet, Account, and Wallet Activity tabs |
src/routes/$chainSlug/_layout/address/$addressAddress.tsx |
Refactored to use shared AddressTabsContent component |
src/modules/addresses/address/AddressTabsContent.tsx |
New shared component extracting address tab rendering logic |
src/modules/account/ManageIexecAccount.tsx |
New component containing iExec account management (formerly in account.tsx) |
src/modules/account/Faucet.tsx |
New component for faucet functionality with updated UI |
src/components/navbar/NavBar.tsx |
Updated navigation to use dropdown menu and link to account page tabs |
src/components/ui/dropdown-menu.tsx |
New dropdown menu component for navbar user menu |
src/utils/truncateAddress.ts |
Extended type definition to accept any number for truncation lengths |
src/index.css |
Added Clerk themes import and updated card color variables |
package.json |
Added @clerk/themes and @radix-ui/react-dropdown-menu dependencies |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <div className="min-w-0 flex-1 overflow-x-auto"> | ||
| {tabs[currentTab].component | ||
| ? React.createElement(tabs[currentTab].component) | ||
| : null} |
Copilot
AI
Dec 4, 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 conditional rendering tabs[currentTab].component ? React.createElement(tabs[currentTab].component) : null assumes all tabs have a component property, but the "Log out" tab (index 3) has an action property instead. This means if somehow currentTab becomes 3, nothing will render. Consider adding defensive logic or ensuring action-only tabs can't become the active tab.
| : null} | |
| : ( | |
| <div className="text-muted-foreground p-4"> | |
| Please select a valid tab. | |
| </div> | |
| )} |
| import { | ||
| SignedIn, | ||
| SignedOut, | ||
| SignIn, |
Copilot
AI
Dec 4, 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 import uses SignIn from @clerk/clerk-react, but this component is typically named SignIn for the full component or you should use SignInButton for a button trigger. The usage on line 140 suggests a full SignIn component is intended, but verify this is the correct import name for the Clerk React library version being used.
| </ChainLink> | ||
| </DropdownMenuItem> | ||
| <DropdownMenuItem> | ||
| <ChainLink to="/account?accountTab=Manage+iExec+Account"> |
Copilot
AI
Dec 4, 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 URL parameter accountTab=Manage+iExec+Account doesn't match any tab titleText in the account page. The tabs array in account.tsx (line 132-156) defines tabs with titleText values: 'Faucet', 'Account', 'Wallet Activity', and 'Log out'. The value "Manage+iExec+Account" (or "Manage iExec Account") is not in this list, which means clicking this link will not navigate to the correct tab.
| <ChainLink to="/account?accountTab=Manage+iExec+Account"> | |
| <ChainLink to="/account?accountTab=Account"> |
| index === currentTab && 'bg-muted text-foreground' | ||
| )} |
Copilot
AI
Dec 4, 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 active tab highlighting logic checks index === currentTab, but when a user clicks on a tab with an action (index 3, the "Log out" tab), the visual state will highlight that tab. Since logout is an action that shouldn't be a selectable tab, this creates a poor UX where the logout button appears selected. Consider excluding action-only tabs from the active state logic.
| }, | ||
| enabled: !!userAddress, | ||
| const avatarVisualBg = getAvatarVisualNumber({ | ||
| address: userAddress, |
Copilot
AI
Dec 4, 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 getAvatarVisualNumber function is called with userAddress which might be undefined (as seen in line 31 where it's typed as potentially undefined). While this is safe because the avatar display is conditionally rendered only when userAddress exists (line 172), consider adding a null check or default value for clarity and safety.
| address: userAddress, | |
| address: userAddress ?? '', |
| )} | ||
| /> | ||
| <span className="text-sm"> | ||
| {truncateAddress(userAddress!, { startLen: 5, endLen: 3 })} |
Copilot
AI
Dec 4, 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 truncateAddress is called with explicit options { startLen: 5, endLen: 3 }, but these values aren't part of the predefined union type in the updated truncateAddress function signature. While the function now accepts number as a type (line 4-5 of truncateAddress.ts), this creates inconsistency. Consider using the predefined values or documenting why custom values are needed here.
| {truncateAddress(userAddress!, { startLen: 5, endLen: 3 })} | |
| {truncateAddress(userAddress!, { startLen: 4, endLen: 2 })} |
| if (!bridge && currentTab === 2) { | ||
| setCurrentTab(1); | ||
| } | ||
| }, [chainId]); |
Copilot
AI
Dec 4, 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 useEffect has a missing dependency setCurrentTab. The React Hook useEffect has a missing dependency warning will be triggered. Either add setCurrentTab to the dependency array or wrap it in a useCallback if it's coming from props/state.
| }, [chainId]); | |
| }, [chainId, setCurrentTab]); |
|
|
||
| return response.json(); |
Copilot
AI
Dec 4, 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 watchAsset call is missing after a successful response. In the original faucet route implementation (lines 83-90 of the deleted file), watchAsset was called immediately after a successful response. This call has been removed in the refactored version, which changes the user experience. The addTokenToWallet mutation now handles this separately, but it's only triggered manually by the user clicking a button.
| if (tab.action) { | ||
| tab.action(); | ||
| } else { | ||
| setCurrentTab(tabIndex); | ||
| } | ||
| }, [chainId]); | ||
|
|
||
| if (!userAddress) { | ||
| return ( | ||
| <div className="mt-20 flex flex-col items-center justify-center gap-6 text-center"> | ||
| <h1 className="text-2xl font-bold">You are not connected</h1> | ||
| <p className="text-muted-foreground max-w-sm"> | ||
| To access the iExec Wallet Manager, please connect your wallet. | ||
| </p> | ||
| <div className="flex gap-4"> | ||
| <Button variant="outline"> | ||
| <ChainLink to="/">Go back home</ChainLink> | ||
| </Button> | ||
| <Button onClick={login}>Connect wallet</Button> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
| }; |
Copilot
AI
Dec 4, 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 tab action execution logic allows clicking on tabs with actions (like "Log out"), but this will cause the tab index to be set to the logout tab index when tab.action exists but before the action runs. This could result in incorrect UI state if the action doesn't immediately remove the component (e.g., logout might have a delay). Consider not calling setCurrentTab when an action exists, or resetting the tab after action completes.
| {tabs[currentTab].steps[currentStep]?.content} | ||
| </> | ||
| )} | ||
| {tabs[currentTab]?.content && tabs[currentTab].content} |
Copilot
AI
Dec 4, 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.
Operands tabs[cu ... content and tabs[cu ... content are identical.
| {tabs[currentTab]?.content && tabs[currentTab].content} | |
| {tabs[currentTab]?.content} |
SeddikBellamine
left a comment
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.
LGTM! nicely done
No description provided.