-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit includes changes to the home page and contact-us page of the Gateway, as well as it includes a new Dropdown menu based on the user name instead of its picture
- Loading branch information
Showing
3 changed files
with
83 additions
and
54 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
let { accountId, profile, availableStorage, withdrawTokens, logOut } = props; | ||
|
||
accountId = accountId ?? context.accountId; | ||
profile = profile ?? Social.get(`${accountId}/profile/**`, "final"); | ||
|
||
const profilePage = `/${REPL_ACCOUNT}/widget/ProfilePage?accountId=${accountId}`; | ||
|
||
const handleWithdraw = () => { | ||
if (withdrawTokens) { | ||
withdrawTokens(); | ||
} else { | ||
console.log("withdrawTokens function not provided"); | ||
} | ||
}; | ||
|
||
const handleLogOut = () => { | ||
if (logOut) { | ||
logOut(); | ||
} else { | ||
console.log("logOut function not provided"); | ||
} | ||
}; | ||
|
||
const menuItems = [ | ||
{ | ||
name: "Profile", | ||
iconLeft: "ph-duotone ph-user", | ||
href: profilePage, | ||
}, | ||
{ | ||
name: "Settings", | ||
iconLeft: "ph-duotone ph-gear", | ||
href: "/settings", | ||
}, | ||
{ | ||
name: `Withdraw ${availableStorage ?? 0}kb`, | ||
iconLeft: "ph-duotone ph-bank", | ||
onSelect: handleWithdraw, | ||
disabled: !availableStorage, | ||
}, | ||
{ | ||
name: "Log out", | ||
iconLeft: "ph-duotone ph-sign-out", | ||
onSelect: handleLogOut, | ||
}, | ||
]; | ||
|
||
return ( | ||
<Widget | ||
src="${REPL_ACCOUNT}/widget/DIG.DropdownMenu" | ||
props={{ | ||
trigger: ( | ||
profile.name | ||
), | ||
items: menuItems, | ||
}} | ||
/> | ||
); |