11import React from "react" ;
2- import { Card , CardContent , Typography , Chip , Button } from "@mui/material" ;
3- import { Minipool } from "../../types/MinipoolStatus" ;
4- import { toEtherString } from "../../utils/Utils" ;
52import OpenInNewIcon from "@mui/icons-material/OpenInNew" ;
6- import "./minipool.css" ;
3+ import { Button , Card , CardContent , Chip , Tooltip , Typography } from "@mui/material" ;
4+ import CopyToClipboardButton from "../Buttons/CopyToClipboardButton" ;
5+ import { Minipool } from "../../types/MinipoolStatus" ;
6+ import { ethBalanceGreaterThanMinStake , shortenAddress , toEtherString } from "../../utils/Utils" ;
77import ImportToSignerDialog from "./ImportToSignerDialog" ;
8+ import "./minipool.css" ;
9+
810
911function MinipoolCard ( {
1012 data,
@@ -17,6 +19,7 @@ function MinipoolCard({
1719} ) : JSX . Element {
1820 const [ importToSignerDialogOpen , setImportToSignerDialogOpen ] =
1921 React . useState < boolean > ( false ) ;
22+ const [ showAddress , setShowAddress ] = React . useState < boolean > ( false ) ;
2023
2124 const backgroundColor =
2225 data . status . status === "Staking"
@@ -25,6 +28,22 @@ function MinipoolCard({
2528 ? "#E57373"
2629 : "#FFB74D" ;
2730
31+ const validatorStatus = data . finalised
32+ ? "Exited"
33+ : ( data . validator . active
34+ ? "Active"
35+ : ( data . status . status === "Staking" && ethBalanceGreaterThanMinStake ( data . balances . eth )
36+ ? "Ready to Close"
37+ : "Inactive"
38+ )
39+ ) ;
40+ const validatorStatusColor =
41+ data . finalised || data . validator . active
42+ ? "#81C784"
43+ : validatorStatus === "Ready to Close" || data . status . status === "Prelaunch"
44+ ? "#FFC107"
45+ : "#E57373" ;
46+
2847 return (
2948 < Card
3049 sx = { {
@@ -36,16 +55,28 @@ function MinipoolCard({
3655 >
3756 < CardContent >
3857 < div className = "chip-container" >
39- < Chip label = { `#${ data . validator . index } ` } />
58+ < div className = "chip-with-clipboard-container" >
59+ < Tooltip title = { showAddress ? "Minipool Address" : "Validator Index" } >
60+ < Chip
61+ label = { showAddress ? shortenAddress ( data . address ) : `#${ data . validator . index } ` }
62+ onClick = { ( ) => setShowAddress ( ! showAddress ) }
63+ sx = { { cursor : 'pointer' } }
64+ />
65+ </ Tooltip >
66+ < CopyToClipboardButton
67+ value = { showAddress ? data . address : data . validator . index . toString ( ) }
68+ fontSize = "small"
69+ />
70+ </ div >
4071 < Chip
4172 label = { data . finalised ? "Finalised" : data . status . status }
4273 sx = { { backgroundColor : data . finalised ? "#FFC107" : backgroundColor } }
4374 />
4475 </ div >
4576 < div className = "validator-status" >
4677 < Chip
47- label = { data . finalised ? "Exited" : ( data . validator . active ? "Active" : "Inactive" ) }
48- sx = { { backgroundColor : data . finalised || data . validator . active ? "#81C784" : "#E57373" } }
78+ label = { validatorStatus }
79+ sx = { { backgroundColor : validatorStatusColor } }
4980 />
5081 </ div >
5182
0 commit comments