Skip to content

Commit

Permalink
[#1413] remove balance check on redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
j-dyczka committed Jul 16, 2024
1 parent d29b93e commit 351ba08
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 27 deletions.
5 changes: 0 additions & 5 deletions govtool/frontend/src/components/organisms/DashboardCards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@ import {
useGetAdaHolderCurrentDelegationQuery,
useGetVoterInfo,
} from "@hooks";
import { PROTOCOL_PARAMS_KEY, getItemFromLocalStorage } from "@utils";
import { DelegateDashboardCard } from "./DashboardCards/DelegateDashboardCard";
import { DRepDashboardCard } from "./DashboardCards/DRepDashboardCard";
import { DirectVoterDashboardCard } from "./DashboardCards/DirectVoterDashboardCard";
import { ListGovActionsDashboardCards } from "./DashboardCards/ListGovActionsDashboardCard";
import { ProposeGovActionDashboardCard } from "./DashboardCards/ProposeGovActionDashboardCard";

const protocolParams = getItemFromLocalStorage(PROTOCOL_PARAMS_KEY);

export const DashboardCards = () => {
const { dRepID, dRepIDBech32, pendingTransaction, stakeKey } = useCardano();
const { screenWidth } = useScreenDimension();
Expand Down Expand Up @@ -86,8 +83,6 @@ export const DashboardCards = () => {

<ProposeGovActionDashboardCard
createGovActionTx={pendingTransaction.createGovAction}
deposit={protocolParams?.gov_action_deposit}
votingPower={votingPower}
/>
</Box>
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,29 @@ import { useNavigate } from "react-router-dom";

import { IMAGES, PATHS, PDF_PATHS } from "@consts";
import { PendingTransaction, useFeatureFlag } from "@context";
import { useTranslation, useWalletErrorModal } from "@hooks";
import { useTranslation } from "@hooks";
import { DashboardActionCard } from "@molecules";
import { correctAdaFormat, openInNewTab } from "@utils";
import { openInNewTab } from "@utils";
import { useCallback } from "react";

type ProposeGovActionDashboardCardProps = {
createGovActionTx: PendingTransaction["createGovAction"];
deposit: number;
votingPower: number;
};

export const ProposeGovActionDashboardCard = ({
createGovActionTx,
deposit,
votingPower,
}: ProposeGovActionDashboardCardProps) => {
const { isProposalDiscussionForumEnabled } = useFeatureFlag();
const navigate = useNavigate();
const { t } = useTranslation();
const openWalletErrorModal = useWalletErrorModal();

const onClickPropose = useCallback(() => {
if (votingPower <= deposit) {
openWalletErrorModal({
error: t("errors.insufficientBalanceDescription", {
ada: correctAdaFormat(deposit),
}),
title: t("errors.insufficientBalanceTitle"),
dataTestId: "insufficient-balance-error-modal",
});
return;
}

navigate(
isProposalDiscussionForumEnabled
? PDF_PATHS.proposalDiscussionPropose
: PATHS.createGovernanceAction,
);
}, [deposit, votingPower, isProposalDiscussionForumEnabled]);
}, [isProposalDiscussionForumEnabled]);

return (
<DashboardActionCard
Expand Down
3 changes: 0 additions & 3 deletions govtool/frontend/src/i18n/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,6 @@ export const en = {
appCannotGetVkeys: "Application can not get vkey",
checkIsWalletConnected: "Check if the wallet is connected.",
dRepIdNotFound: "DrepId not found",
insufficientBalanceDescription:
"To submit a Governance Action, you will be required to post a refundable balance of ₳{{ada}}. You do not currently have enough ADA in your wallet to continue.",
insufficientBalanceTitle: "Insufficient Balance",
invalidGovernanceActionType: "Invalid Governance Action Type",
invalidTreasuryGovernanceActionType: "Invalid Treasury Governance Action",
noAddressesFound: "No addresses found",
Expand Down

0 comments on commit 351ba08

Please sign in to comment.