From ce1437a81b69d2419c58a14d46bacad587ac2598 Mon Sep 17 00:00:00 2001 From: Maria Rushkova <66270386+mrushkova@users.noreply.github.com> Date: Thu, 24 Jun 2021 17:40:09 +0200 Subject: [PATCH] Add initial proposing amount (#59) * Add initial proposing amount * Update packages/DApp/src/components/card/VoteModal.tsx Co-authored-by: Szymon Szlachtowicz <38212223+Szymx95@users.noreply.github.com> Co-authored-by: Szymon Szlachtowicz <38212223+Szymx95@users.noreply.github.com> --- packages/DApp/src/components/card/VoteModal.tsx | 4 +++- packages/DApp/src/components/votes/VotePropose.tsx | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/DApp/src/components/card/VoteModal.tsx b/packages/DApp/src/components/card/VoteModal.tsx index 3f69d04..75a678b 100644 --- a/packages/DApp/src/components/card/VoteModal.tsx +++ b/packages/DApp/src/components/card/VoteModal.tsx @@ -18,7 +18,9 @@ export interface VoteModalProps { } export function VoteModal({ vote, selectedVote, availableAmount, setShowConfirmModal }: VoteModalProps) { - const [proposingAmount, setProposingAmount] = useState(availableAmount) + const initialProposing = vote?.type === 'Remove' && availableAmount > 2000000 ? 2000000 : 0 + + const [proposingAmount, setProposingAmount] = useState(initialProposing) const disabled = proposingAmount === 0 return ( diff --git a/packages/DApp/src/components/votes/VotePropose.tsx b/packages/DApp/src/components/votes/VotePropose.tsx index bdff9c5..4a4f40a 100644 --- a/packages/DApp/src/components/votes/VotePropose.tsx +++ b/packages/DApp/src/components/votes/VotePropose.tsx @@ -26,7 +26,7 @@ export function VotePropose({ disabled, setProposingAmount, }: VoteProposingProps) { - const [displayAmount, setDisplayAmount] = useState(`${addCommas(availableAmount)} SNT`) + const [displayAmount, setDisplayAmount] = useState(addCommas(proposingAmount) + ' SNT') let step = 10 ** (Math.floor(Math.log10(availableAmount)) - 2) if (availableAmount < 100) {