c45492cdc8
* set up libs for connecting wallet * wallet - get address and balance * format wallet balance * start staking modal work * Yana/node page (#5276) * 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> * set up libs for connecting wallet * wallet - get address and balance * update typings + refactor favorite component * fix event propogation * fix multiple url declarations * move pages to pages directory * build staking page and base components * refactor wallet components and add useNymClient hook * enhance DesktopHeader to highlight active menu item with icon * remove StakeModal and getNymNodes components * refactor NodeTable and NodeTableWithAction components for improved staking functionality * refactor API configuration and theme styles for improved maintainability * refactor Loading component to implement LoadingModal with enhanced styling and functionality * add InfoModal component for displaying informational messages with customizable actions * fix type * fix linting * update CI workflow to use Node.js 20 * add explorer package to dependencies in package.json * fix mui grid2 build errors * fix full page reload * fix unstaking * fix delegation operation * fix up workspace packages * refactor staking and wallet components for improved functionality and readability * fix undelegation (again) * update ci to include new explorer * update wallet ci node version * remove logs --------- Co-authored-by: Yana Matrosova <42305364+yanok87@users.noreply.github.com> Co-authored-by: Yana <yanok87@users.noreply.github.com>
80 lines
2.3 KiB
TypeScript
80 lines
2.3 KiB
TypeScript
import type {
|
|
BondInformation,
|
|
NodeDescription,
|
|
RewardingDetails,
|
|
} from "@/app/api/types";
|
|
import { formatBigNum } from "@/utils/formatBigNumbers";
|
|
import { Stack, Typography } from "@mui/material";
|
|
import { format } from "date-fns";
|
|
import ExplorerCard from "../cards/ExplorerCard";
|
|
import CopyToClipboard from "../copyToClipboard/CopyToClipboard";
|
|
import ExplorerListItem from "../list/ListItem";
|
|
|
|
interface IBasicInfoCardProps {
|
|
bondInfo: BondInformation;
|
|
nodeDescription: NodeDescription;
|
|
rewardDetails: RewardingDetails;
|
|
}
|
|
|
|
export const BasicInfoCard = (props: IBasicInfoCardProps) => {
|
|
const { bondInfo, nodeDescription, rewardDetails } = props;
|
|
|
|
const timeBonded = nodeDescription
|
|
? format(
|
|
new Date(nodeDescription.build_information.build_timestamp),
|
|
"dd/MM/yyyy",
|
|
)
|
|
: "-";
|
|
|
|
const selfBond = formatBigNum(Number(rewardDetails.operator) / 1_000_000);
|
|
const selfBondFormated = `${selfBond} NYM`;
|
|
return (
|
|
<ExplorerCard label="Basic info">
|
|
<Stack gap={1}>
|
|
<ExplorerListItem
|
|
divider
|
|
label="NYM Address"
|
|
value={
|
|
<Stack
|
|
direction="row"
|
|
gap={0.1}
|
|
alignItems="center"
|
|
justifyContent="space-between"
|
|
width="100%"
|
|
>
|
|
<Typography variant="body4">{bondInfo.owner}</Typography>
|
|
<CopyToClipboard text={bondInfo.owner} />
|
|
</Stack>
|
|
}
|
|
/>
|
|
<ExplorerListItem
|
|
divider
|
|
label="Identity Key"
|
|
value={
|
|
<Stack
|
|
direction="row"
|
|
gap={0.1}
|
|
alignItems="center"
|
|
justifyContent="space-between"
|
|
width="100%"
|
|
>
|
|
<Typography variant="body4">
|
|
{bondInfo.node.identity_key}
|
|
</Typography>
|
|
<CopyToClipboard text={bondInfo.node.identity_key} />
|
|
</Stack>
|
|
}
|
|
/>
|
|
<ExplorerListItem row divider label="Node bonded" value={timeBonded} />
|
|
<ExplorerListItem
|
|
row
|
|
divider
|
|
label="Nr. of stakes"
|
|
value={rewardDetails.unique_delegations.toString()}
|
|
/>
|
|
<ExplorerListItem row label="Self bonded" value={selfBondFormated} />
|
|
</Stack>
|
|
</ExplorerCard>
|
|
);
|
|
};
|