-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add nym-node page api WIP * nym-node page api WIP * Add rewards card * Add account balances * fix build * Add USD price to tokenomics card * fix build * fix build * fix build * Refactor ProgressBar * Add profile card * fix build * replace hardcoded id * Add build version and node roles * fix build * rename id param to address * add node table to explorer page * get node details from unstable endpoint + layout updates * allow node select from table * stop propogation on favorite/unfavorite * update self bond data * card refactors * revert node engine requirement * use node v20 --------- Co-authored-by: Yana <yanok87@users.noreply.github.com> Co-authored-by: fmtabbara <fmtabbara@hotmail.co.uk>
- Loading branch information
1 parent
80e5867
commit 920c1f8
Showing
35 changed files
with
1,244 additions
and
7,792 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
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,103 @@ | ||
import type { CurrencyRates, IAccountBalancesInfo } from "@/app/api/types"; | ||
import type NodeData from "@/app/api/types"; | ||
import { NYM_ACCOUNT_ADDRESS, NYM_NODES, NYM_PRICES_API } from "@/app/api/urls"; | ||
import { AccountBalancesCard } from "@/components/accountPageComponents/AccountBalancesCard"; | ||
import { AccountInfoCard } from "@/components/accountPageComponents/AccountInfoCard"; | ||
import { ContentLayout } from "@/components/contentLayout/ContentLayout"; | ||
import SectionHeading from "@/components/headings/SectionHeading"; | ||
import ExplorerButtonGroup from "@/components/toggleButton/ToggleButton"; | ||
import { Box, Grid2, Typography } from "@mui/material"; | ||
|
||
export default async function Account({ | ||
params, | ||
}: { | ||
params: Promise<{ address: string }>; | ||
}) { | ||
try { | ||
const { address } = await params; | ||
|
||
const accountData = await fetch(`${NYM_ACCOUNT_ADDRESS}${address}`, { | ||
headers: { | ||
Accept: "application/json", | ||
"Content-Type": "application/json; charset=utf-8", | ||
}, | ||
next: { revalidate: 60 }, | ||
// refresh event list cache at given interval | ||
}); | ||
|
||
const response = await fetch(NYM_NODES, { | ||
headers: { | ||
Accept: "application/json", | ||
"Content-Type": "application/json; charset=utf-8", | ||
}, | ||
next: { revalidate: 60 }, | ||
// refresh event list cache at given interval | ||
}); | ||
|
||
const nymNodes: NodeData[] = await response.json(); | ||
|
||
const nymNode = nymNodes.find( | ||
(node) => node.bond_information.owner === address, | ||
); | ||
|
||
const nymAccountBalancesData: IAccountBalancesInfo = | ||
await accountData.json(); | ||
|
||
if (!nymAccountBalancesData) { | ||
return <Typography>Account not found</Typography>; | ||
} | ||
|
||
const nymPrice = await fetch(NYM_PRICES_API, { | ||
headers: { | ||
Accept: "application/json", | ||
"Content-Type": "application/json; charset=utf-8", | ||
}, | ||
next: { revalidate: 60 }, | ||
// refresh event list cache at given interval | ||
}); | ||
|
||
const nymPriceData: CurrencyRates = await nymPrice.json(); | ||
|
||
return ( | ||
<ContentLayout> | ||
<Grid2 container columnSpacing={5} rowSpacing={5}> | ||
<Grid2 size={6}> | ||
<SectionHeading title="Account Details" /> | ||
</Grid2> | ||
<Grid2 size={6} justifyContent="flex-end"> | ||
<Box sx={{ display: "flex", justifyContent: "end" }}> | ||
<ExplorerButtonGroup | ||
options={[ | ||
{ | ||
label: "Nym Node", | ||
isSelected: false, | ||
link: nymNode | ||
? `/nym-node/${nymNode.node_id}` | ||
: "/nym-node/not-found", | ||
}, | ||
{ | ||
label: "Account", | ||
isSelected: true, | ||
link: "/account/1", | ||
}, | ||
]} | ||
/> | ||
</Box> | ||
</Grid2> | ||
<Grid2 size={4}> | ||
<AccountInfoCard accountInfo={nymAccountBalancesData} /> | ||
</Grid2> | ||
<Grid2 size={8}> | ||
<AccountBalancesCard | ||
accountInfo={nymAccountBalancesData} | ||
nymPrice={nymPriceData.usd} | ||
/> | ||
</Grid2> | ||
</Grid2> | ||
</ContentLayout> | ||
); | ||
} catch (error) { | ||
console.error("error :>> ", error); | ||
return <Typography>Error loading account data</Typography>; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.