diff --git a/explorer-nextjs/app/components/AccountStatsCard.tsx b/explorer-nextjs/app/components/AccountStatsCard.tsx new file mode 100644 index 0000000000..e376a61b86 --- /dev/null +++ b/explorer-nextjs/app/components/AccountStatsCard.tsx @@ -0,0 +1,205 @@ +import * as React from "react"; +import Box from "@mui/material/Box"; +import Collapse from "@mui/material/Collapse"; +import IconButton from "@mui/material/IconButton"; +import Table from "@mui/material/Table"; +import TableBody from "@mui/material/TableBody"; +import TableCell from "@mui/material/TableCell"; +import TableContainer from "@mui/material/TableContainer"; +import TableHead from "@mui/material/TableHead"; +import TableRow from "@mui/material/TableRow"; +import Typography from "@mui/material/Typography"; +import Paper from "@mui/material/Paper"; +import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown"; +import KeyboardArrowUpIcon from "@mui/icons-material/KeyboardArrowUp"; +import { Card, CardContent } from "@mui/material"; +import { ExplorerStaticProgressBar } from "./ExplorerStaticProgressBar"; + +export interface IAccontStatsRowProps { + type: string; + allocation: number; + amount: number; + value: number; + history?: { type: string; amount: number }[]; + isLastRow?: boolean; + progressBarColor: string; +} + +const progressBarColours = [ + "#BEF885", + "#7FB0FF", + "#00D17D", + "#004650", + "#FEECB3", +]; + +const Row = (props: IAccontStatsRowProps) => { + const { + type, + allocation, + amount, + value, + history, + isLastRow, + progressBarColor, + } = props; + const [open, setOpen] = React.useState(false); + + return ( + + {/* Main Row */} + + + + {type} + + + + {allocation}% + + + + + {amount} NYM + + + $ {value} + + + {history && ( + setOpen(!open)} + > + {open ? : } + + )} + + + + {/* History Rows */} + {history && + open && + history.map((historyRow, i) => ( + + + + {historyRow.type} + + + {/* Empty cell for alignment */} + + + {historyRow.amount} + + + {/* Empty cell for alignment */} + + + {/* Any additional content */} + + + ))} + + ); +}; + +export interface IAccountStatsCardProps { + rows: Array; +} + +export const AccountStatsCard = (props: IAccountStatsCardProps) => { + const { rows } = props; + return ( + + + + + + + Type + Allocation + Amount + Value + + + + + {rows.map((row, i) => ( + + ))} + +
+
+
+
+ ); +}; diff --git a/explorer-nextjs/app/components/ExplorerCard.tsx b/explorer-nextjs/app/components/ExplorerCard.tsx index 676f5fd8c3..0a8ce3697d 100644 --- a/explorer-nextjs/app/components/ExplorerCard.tsx +++ b/explorer-nextjs/app/components/ExplorerCard.tsx @@ -2,9 +2,9 @@ import { Card, CardContent, Typography, Box, Button } from "@mui/material"; import React, { FC, ReactElement, ReactEventHandler, useEffect } from "react"; import { ExplorerLineChart, IExplorerLineChartData } from "./ExplorerLineChart"; import { - ExplorerProgressBar, - IExplorerProgressBarProps, -} from "./ExplorerProgressBar"; + ExplorerDynamicProgressBar, + IExplorerDynamicProgressBarProps, +} from "./ExplorerDynamicProgressBar"; import ArrowDownwardIcon from "@mui/icons-material/ArrowDownward"; import ArrowUpwardIcon from "@mui/icons-material/ArrowUpward"; import { NymTokenSVG } from "../icons/NymTokenSVG"; @@ -311,7 +311,7 @@ export type ContentCardProps = { titlePrice?: ICardTitlePriceProps; dataRows?: ICardDataRowsProps; graph?: { data: Array; color: string; label: string }; - progressBar?: IExplorerProgressBarProps; + progressBar?: IExplorerDynamicProgressBarProps; paragraph?: string; onClick?: ReactEventHandler; nymAddress?: ICardCopyAddressProps; @@ -376,7 +376,7 @@ export const ExplorerCard: FC = ({ )} {progressBar && ( - + )} {paragraph && {paragraph}} diff --git a/explorer-nextjs/app/components/ExplorerProgressBar.tsx b/explorer-nextjs/app/components/ExplorerDynamicProgressBar.tsx similarity index 95% rename from explorer-nextjs/app/components/ExplorerProgressBar.tsx rename to explorer-nextjs/app/components/ExplorerDynamicProgressBar.tsx index 845c455a45..aa39eeea98 100644 --- a/explorer-nextjs/app/components/ExplorerProgressBar.tsx +++ b/explorer-nextjs/app/components/ExplorerDynamicProgressBar.tsx @@ -3,13 +3,15 @@ import Box from "@mui/material/Box"; import LinearProgress from "@mui/material/LinearProgress"; import { Typography } from "@mui/material"; -export interface IExplorerProgressBarProps { +export interface IExplorerDynamicProgressBarProps { title?: string; start: string; // Start timestamp as ISO 8601 string showEpoch: boolean; } -export const ExplorerProgressBar = (props: IExplorerProgressBarProps) => { +export const ExplorerDynamicProgressBar = ( + props: IExplorerDynamicProgressBarProps +) => { const { start, showEpoch, title } = props; const [progress, setProgress] = React.useState(0); diff --git a/explorer-nextjs/app/components/ExplorerStaticProgressBar.tsx b/explorer-nextjs/app/components/ExplorerStaticProgressBar.tsx new file mode 100644 index 0000000000..257d27185a --- /dev/null +++ b/explorer-nextjs/app/components/ExplorerStaticProgressBar.tsx @@ -0,0 +1,32 @@ +import * as React from "react"; +import Box from "@mui/material/Box"; +import LinearProgress from "@mui/material/LinearProgress"; +import { Typography } from "@mui/material"; + +export interface IExplorerStaticProgressBarProps { + color: string; + value: number; +} + +export const ExplorerStaticProgressBar = ( + props: IExplorerStaticProgressBarProps +) => { + const { color, value } = props; + + return ( + + + + ); +}; diff --git a/explorer-nextjs/app/page.tsx b/explorer-nextjs/app/page.tsx index 0ae1d9b4d3..1b42dde8b3 100644 --- a/explorer-nextjs/app/page.tsx +++ b/explorer-nextjs/app/page.tsx @@ -21,6 +21,10 @@ import { ContentCardProps, ExplorerCard } from "./components/ExplorerCard"; import type { GetStaticProps, InferGetStaticPropsType } from "next"; import { ExplorerData, getCacheExplorerData } from "./api/explorer"; import { IExplorerLineChartData } from "./components/ExplorerLineChart"; +import { + AccountStatsCard, + IAccountStatsCardProps, +} from "./components/AccountStatsCard"; // type ContentCardProps = { // overTitle?: string; @@ -253,6 +257,45 @@ export default function PageOverview() { graph: stakeLineGraphData, }; + const accountStatsCard: IAccountStatsCardProps = { + rows: [ + { type: "Spendable", allocation: 15.53, amount: 12800, value: 1200 }, + { + type: "Delegated", + allocation: 15.53, + amount: 12800, + value: 1200, + history: [ + { type: "Liquid", amount: 6900 }, + { type: "Locked", amount: 6900 }, + ], + }, + { + type: "Claimable", + allocation: 15.53, + amount: 12800, + value: 1200, + history: [ + { type: "Unlocked", amount: 6900 }, + { type: "Staking rewards", amount: 6900 }, + { type: "Operator comission", amount: 6900 }, + ], + }, + { + type: "Self bonded", + allocation: 15.53, + amount: 12800, + value: 1200, + }, + { + type: "Locked", + allocation: 15.53, + amount: 12800, + value: 1200, + }, + ], + }; + const { summaryOverview, gateways, @@ -271,6 +314,9 @@ export default function PageOverview() { {summaryOverview && ( <> + + + diff --git a/explorer-nextjs/remark42/var/remark42.db b/explorer-nextjs/remark42/var/remark42.db index 28d420e506..9fdd644cbc 100644 Binary files a/explorer-nextjs/remark42/var/remark42.db and b/explorer-nextjs/remark42/var/remark42.db differ