11import React , { useMemo } from "react" ;
22import styled from "styled-components" ;
33
4+ import Skeleton from "react-loading-skeleton" ;
45import { useParams } from "react-router-dom" ;
56import { formatEther } from "viem" ;
67import { useAccount } from "wagmi" ;
78
89import Check from "svgs/icons/check-circle-outline.svg" ;
910
1011import { useCourtDetails } from "hooks/queries/useCourtDetails" ;
11- import { uncommify } from "utils/commify" ;
12+ import { commify , uncommify } from "utils/commify" ;
1213
1314import { useJurorStakeDetailsQuery } from "queries/useJurorStakeDetailsQuery" ;
1415
15- import QuantityToSimulate from "../Simulator/QuantityToSimulate" ;
16+ import { isUndefined } from "src/utils" ;
17+
18+ import WithHelpTooltip from "components/WithHelpTooltip" ;
19+
20+ import QuantityToSimulate , { Quantity , TextWithTooltipContainer } from "../Simulator/QuantityToSimulate" ;
1621import { ActionType } from "../StakeWithdrawButton" ;
1722
1823const StakingMsgContainer = styled . div `
@@ -43,11 +48,17 @@ const CheckIcon = styled(Check)`
4348 height: 80px;
4449` ;
4550
46- const CourtName = styled . label `` ;
51+ const CourtName = styled . label `
52+ margin-bottom: 15px;
53+ ` ;
4754
48- const StyledQuantityToSimulate = styled ( QuantityToSimulate ) `
49- margin-top: 15px;
55+ const QuantityContainer = styled . div `
56+ display: flex;
57+ align-items: center;
58+ justify-content: center;
59+ gap: 8px;
5060` ;
61+
5162interface IHeader {
5263 action : ActionType ;
5364 amount : string ;
@@ -63,6 +74,12 @@ const Header: React.FC<IHeader> = ({ action, amount, isSuccess }) => {
6374 const jurorCurrentEffectiveStake = address && jurorStakeData ? Number ( formatEther ( jurorStakeData . effectiveStake ) ) : 0 ;
6475 const jurorCurrentSpecificStake = address && jurorStakeData ? Number ( formatEther ( jurorStakeData . staked ) ) : 0 ;
6576
77+ const effectiveStakeDisplay = ! isUndefined ( jurorCurrentEffectiveStake ) ? (
78+ `${ commify ( jurorCurrentEffectiveStake ) } PNK`
79+ ) : (
80+ < Skeleton width = { 50 } />
81+ ) ;
82+
6683 const isWithdraw = action === ActionType . withdraw ;
6784 const preStakeText = useMemo ( ( ) => ( isWithdraw ? "withdrawing" : "staking" ) , [ isWithdraw ] ) ;
6885 const postStakeText = useMemo ( ( ) => ( isWithdraw ? "withdrew" : "staked" ) , [ isWithdraw ] ) ;
@@ -73,8 +90,17 @@ const Header: React.FC<IHeader> = ({ action, amount, isSuccess }) => {
7390 < StakingMsg > { isSuccess ? `You successfully ${ postStakeText } ` : `You are ${ preStakeText } ` } </ StakingMsg >
7491 < StakingAmount > { amount } PNK</ StakingAmount >
7592 { courtDetails ?. court ?. name ? < CourtName > on { courtDetails . court . name } </ CourtName > : null }
76- { isSuccess ? null : (
77- < StyledQuantityToSimulate
93+ { isSuccess ? (
94+ < QuantityContainer >
95+ < Quantity > { effectiveStakeDisplay } </ Quantity >
96+ < TextWithTooltipContainer >
97+ < WithHelpTooltip tooltipMsg = "The stake is confirmed! It is standard procedure to delay the execution of a change in stakes if the phase of the arbitrator is not currently Staking. It'll be updated shortly." >
98+ Current Stake
99+ </ WithHelpTooltip >
100+ </ TextWithTooltipContainer > { " " }
101+ </ QuantityContainer >
102+ ) : (
103+ < QuantityToSimulate
78104 { ...{
79105 jurorCurrentEffectiveStake,
80106 jurorCurrentSpecificStake,
0 commit comments