diff --git a/frontend/src/app/(routes)/governance/AllProposals.tsx b/frontend/src/app/(routes)/governance/AllProposals.tsx
index 259551187..945923c90 100644
--- a/frontend/src/app/(routes)/governance/AllProposals.tsx
+++ b/frontend/src/app/(routes)/governance/AllProposals.tsx
@@ -26,6 +26,7 @@ const AllProposals = ({
currentOverviewId,
handleProposalSelected,
isSelected,
+ overviewPropChainID,
}: {
isRightBarOpen: boolean;
chainIDs: string[];
@@ -35,6 +36,7 @@ const AllProposals = ({
currentOverviewId: number;
handleProposalSelected: (value: boolean) => void;
isSelected: boolean;
+ overviewPropChainID: string;
}) => {
const dispatch = useAppDispatch();
const [selectedChainsProposals, setSelectedChainsProposals] =
@@ -193,7 +195,8 @@ const AllProposals = ({
proposal,
'proposal_id',
get(proposal, 'id', '')
- )
+ ) &&
+ overviewPropChainID === chainID
? 'proposal proposal-selected'
: 'proposal'
}
@@ -209,7 +212,8 @@ const AllProposals = ({
proposal,
'proposal_id',
get(proposal, 'id', '')
- )
+ ) &&
+ overviewPropChainID === chainID
? 'proposal-id'
: 'proposal-id proposal-id-static'
}
diff --git a/frontend/src/app/(routes)/governance/DepositPopup.tsx b/frontend/src/app/(routes)/governance/DepositPopup.tsx
index 0ab8be1a4..6b35a114c 100644
--- a/frontend/src/app/(routes)/governance/DepositPopup.tsx
+++ b/frontend/src/app/(routes)/governance/DepositPopup.tsx
@@ -64,7 +64,7 @@ const DepositPopup = ({
formState: { errors },
} = useForm({
defaultValues: {
- amount: 0,
+ amount: '',
},
});
@@ -72,7 +72,7 @@ const DepositPopup = ({
onClose();
};
- const handleDeposit = (data: { amount: number }) => {
+ const handleDeposit = (data: { amount: string }) => {
const {
aminoConfig,
prefix,
@@ -170,7 +170,7 @@ const DepositPopup = ({
height={26}
alt="logo"
/>
-
{proposalId}
+ #{proposalId}
{`Deposit period ends in ${votingEndsInDays} `}
@@ -185,6 +185,13 @@ const DepositPopup = ({
{
+ const amount = Number(value);
+ if (isNaN(amount) || amount <= 0)
+ return 'Invalid Amount';
+ },
+ }}
render={({ field }) => (
)}
/>
+
+
+ {errors.amount?.message}
+
+
-
-
-
-
-
{depositPercent}%
-
+ {!minDeposit ? null : (
+
-
-
+ )}
);
diff --git a/frontend/src/app/(routes)/governance/GovPage.tsx b/frontend/src/app/(routes)/governance/GovPage.tsx
index 00475fbed..0225ea294 100644
--- a/frontend/src/app/(routes)/governance/GovPage.tsx
+++ b/frontend/src/app/(routes)/governance/GovPage.tsx
@@ -73,6 +73,7 @@ const GovPage = ({ chainIDs }: { chainIDs: string[] }) => {
currentOverviewId={currentOverviewId}
handleProposalSelected={handleProposalSelected}
isSelected={isSelected}
+ overviewPropChainID={chainID}
/>
{(isOverviewOpen && (
diff --git a/frontend/src/app/(routes)/governance/RightOverview.tsx b/frontend/src/app/(routes)/governance/RightOverview.tsx
index 3ceeb1601..ec1db8e0f 100644
--- a/frontend/src/app/(routes)/governance/RightOverview.tsx
+++ b/frontend/src/app/(routes)/governance/RightOverview.tsx
@@ -9,6 +9,7 @@ import { CircularProgress, Tooltip } from '@mui/material';
import { RootState } from '@/store/store';
import { useAppDispatch, useAppSelector } from '@/custom-hooks/StateHooks';
import {
+ getDepositParams,
getGovTallyParams,
getProposal,
getProposalTally,
@@ -25,6 +26,7 @@ import { deepPurple } from '@mui/material/colors';
import DepositProposalInfo from './DepositProposalInfo';
import DepositProposalDetails from './DepositProposalDetails';
import { formatCoin } from '@/utils/util';
+import { parseBalance } from '@/utils/denom';
type handleCloseOverview = () => void;
@@ -42,12 +44,18 @@ const RightOverview = ({
handleProposalSelected: (value: boolean) => void;
}) => {
const dispatch = useAppDispatch();
+
+ const [depositRequired, setDepositRequired] = useState(0);
+
const proposalInfo = useAppSelector(
(state: RootState) => state.gov.proposalDetails
);
const networkLogo = useAppSelector(
(state: RootState) => state.wallet.networks[chainID]?.network.logos.menu
);
+ const depositParams = useAppSelector(
+ (state: RootState) => state.gov.chains[chainID]?.depositParams.params
+ );
const networks = useAppSelector((state: RootState) => state.wallet.networks);
const tallyResult = useAppSelector(
@@ -57,8 +65,7 @@ const RightOverview = ({
const isStatusVoting =
get(proposalInfo, 'status') === 'PROPOSAL_STATUS_VOTING_PERIOD';
- const { getChainInfo, isFeeAvailable } = useGetChainInfo();
- const isFeeEnough = isFeeAvailable(chainID);
+ const { getChainInfo } = useGetChainInfo();
const { chainName } = getChainInfo(chainID);
useEffect(() => {
@@ -92,13 +99,42 @@ const RightOverview = ({
baseURLs: chainInfo?.config.restURIs,
})
);
+
dispatch(
getPoolInfo({
baseURLs: chainInfo.config.restURIs,
chainID: chainID,
})
);
- }, [proposalId]);
+
+ dispatch(
+ getDepositParams({
+ baseURLs: chainInfo?.config.restURIs,
+ baseURL: chainInfo?.config.rest,
+ chainID: chainID,
+ })
+ );
+ }, [proposalId, chainID]);
+
+ useEffect(() => {
+ if (
+ depositParams?.min_deposit?.length &&
+ proposalInfo?.total_deposit?.length
+ ) {
+ const min_deposit = parseBalance(
+ depositParams.min_deposit,
+ currency.coinDecimals,
+ currency.coinMinimalDenom
+ );
+ const total_deposit = parseBalance(
+ proposalInfo.total_deposit,
+ currency.coinDecimals,
+ currency.coinMinimalDenom
+ );
+ const deposit_required = min_deposit - total_deposit;
+ setDepositRequired(deposit_required);
+ }
+ }, [depositParams, proposalInfo]);
const poolInfo = useAppSelector(
(state: RootState) => state.staking.chains[chainID]?.pool
@@ -182,7 +218,6 @@ const RightOverview = ({
const proposalSubmittedOn = getTimeDifference(
get(proposalInfo, 'submit_time')
);
- const [depositRequired] = useState(0);
const nameToChainIDs = useAppSelector(
(state: RootState) => state.wallet.nameToChainIDs
);
@@ -277,7 +312,7 @@ const RightOverview = ({
)}
-
+
{get(
proposalInfo,
'content.title',
@@ -291,20 +326,15 @@ const RightOverview = ({
-
-
+
+
{truncatedDescription}
{isDescriptionTruncated && '...'}