From 6e818909f569f2ee17c528baffc08d91f8281e10 Mon Sep 17 00:00:00 2001 From: Harman-singh-waraich Date: Fri, 27 Dec 2024 16:17:58 +0530 Subject: [PATCH 1/2] feat(web): stake-popup-notification-info --- .../Simulator/QuantityToSimulate.tsx | 4 +- .../StakePanel/StakeWithdrawPopup/Header.tsx | 40 +++++++++++++++---- .../StakePanel/StakeWithdrawPopup/index.tsx | 31 +++++--------- 3 files changed, 45 insertions(+), 30 deletions(-) diff --git a/web/src/pages/Courts/CourtDetails/StakePanel/Simulator/QuantityToSimulate.tsx b/web/src/pages/Courts/CourtDetails/StakePanel/Simulator/QuantityToSimulate.tsx index d18b96ddf..2b953841c 100644 --- a/web/src/pages/Courts/CourtDetails/StakePanel/Simulator/QuantityToSimulate.tsx +++ b/web/src/pages/Courts/CourtDetails/StakePanel/Simulator/QuantityToSimulate.tsx @@ -17,7 +17,7 @@ const Container = styled.div` justify-content: center; `; -const TextWithTooltipContainer = styled.div` +export const TextWithTooltipContainer = styled.div` color: ${({ theme }) => theme.secondaryPurple}; font-size: 14px; @@ -29,7 +29,7 @@ const TextWithTooltipContainer = styled.div` } `; -const Quantity = styled.p` +export const Quantity = styled.p` font-size: 14px; color: ${({ theme }) => theme.primaryText}; margin: 0; diff --git a/web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawPopup/Header.tsx b/web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawPopup/Header.tsx index d21fa5f95..9ec9f24b5 100644 --- a/web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawPopup/Header.tsx +++ b/web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawPopup/Header.tsx @@ -1,6 +1,7 @@ import React, { useMemo } from "react"; import styled from "styled-components"; +import Skeleton from "react-loading-skeleton"; import { useParams } from "react-router-dom"; import { formatEther } from "viem"; import { useAccount } from "wagmi"; @@ -8,11 +9,15 @@ import { useAccount } from "wagmi"; import Check from "svgs/icons/check-circle-outline.svg"; import { useCourtDetails } from "hooks/queries/useCourtDetails"; -import { uncommify } from "utils/commify"; +import { commify, uncommify } from "utils/commify"; import { useJurorStakeDetailsQuery } from "queries/useJurorStakeDetailsQuery"; -import QuantityToSimulate from "../Simulator/QuantityToSimulate"; +import { isUndefined } from "src/utils"; + +import WithHelpTooltip from "components/WithHelpTooltip"; + +import QuantityToSimulate, { Quantity, TextWithTooltipContainer } from "../Simulator/QuantityToSimulate"; import { ActionType } from "../StakeWithdrawButton"; const StakingMsgContainer = styled.div` @@ -43,11 +48,17 @@ const CheckIcon = styled(Check)` height: 80px; `; -const CourtName = styled.label``; +const CourtName = styled.label` + margin-bottom: 15px; +`; -const StyledQuantityToSimulate = styled(QuantityToSimulate)` - margin-top: 15px; +const QuantityContainer = styled.div` + display: flex; + align-items: center; + justify-content: center; + gap: 8px; `; + interface IHeader { action: ActionType; amount: string; @@ -63,6 +74,12 @@ const Header: React.FC = ({ action, amount, isSuccess }) => { const jurorCurrentEffectiveStake = address && jurorStakeData ? Number(formatEther(jurorStakeData.effectiveStake)) : 0; const jurorCurrentSpecificStake = address && jurorStakeData ? Number(formatEther(jurorStakeData.staked)) : 0; + const effectiveStakeDisplay = !isUndefined(jurorCurrentEffectiveStake) ? ( + `${commify(jurorCurrentEffectiveStake)} PNK` + ) : ( + + ); + const isWithdraw = action === ActionType.withdraw; const preStakeText = useMemo(() => (isWithdraw ? "withdrawing" : "staking"), [isWithdraw]); const postStakeText = useMemo(() => (isWithdraw ? "withdrew" : "staked"), [isWithdraw]); @@ -73,8 +90,17 @@ const Header: React.FC = ({ action, amount, isSuccess }) => { {isSuccess ? `You successfully ${postStakeText}` : `You are ${preStakeText}`} {amount} PNK {courtDetails?.court?.name ? on {courtDetails.court.name} : null} - {isSuccess ? null : ( - + {effectiveStakeDisplay} + + + Current Stake + + {" "} + + ) : ( + = ({ amount, closePopup, steps, isSuccess, action }) => { - const { data: phase, isLoading } = useSortitionModulePhase(); - return ( e.stopPropagation()}> @@ -121,13 +109,14 @@ const StakeWithdrawPopup: React.FC = ({ amount, closePopup,
{steps && } - {phase !== Phases.staking && !isLoading ? ( - - - + - + ) : null} From abb897cab35f637ae28db828a672937076ddd874 Mon Sep 17 00:00:00 2001 From: Harman-singh-waraich Date: Mon, 30 Dec 2024 16:00:40 +0530 Subject: [PATCH 2/2] refactor(web): post-stake-notification-info --- .../Courts/CourtDetails/StakePanel/StakeWithdrawPopup/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawPopup/index.tsx b/web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawPopup/index.tsx index 9dbce08f7..3f0995fff 100644 --- a/web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawPopup/index.tsx +++ b/web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawPopup/index.tsx @@ -113,7 +113,7 @@ const StakeWithdrawPopup: React.FC = ({ amount, closePopup,