Skip to content

Commit

Permalink
Merge pull request #1289 from IntersectMBO/feat/1284-replace-govtool-…
Browse files Browse the repository at this point in the history
…wrapper-governance-action-creation-in-favor-of-pdf-pillar

feat(#1284): replace govtool-wrapper GA creation in favor of PDF Pillar
  • Loading branch information
MSzalowski authored Jun 13, 2024
2 parents 27a9862 + 31e3731 commit 8a184d4
Show file tree
Hide file tree
Showing 4 changed files with 5,303 additions and 771 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ changes.
- Add eslint & prettier to frontend package [Issue 166](https://github.com/IntersectMBO/govtool/issues/166)
- Add DRep list pagination [Issue 740](https://github.com/IntersectMBO/govtool/issues/740)
- Add PDF pillar [Issue 1090](https://github.com/IntersectMBO/govtool/issues/1090)
- Replace govtool-wrapper governance action creation in favor of pdf-pillar [Issue 1284](https://github.com/IntersectMBO/govtool/issues/1284)

### Fixed

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useNavigate } from "react-router-dom";

import { IMAGES, PATHS } from "@consts";
import { PendingTransaction } from "@context";
import { IMAGES, PATHS, PDF_PATHS } from "@consts";
import { PendingTransaction, useFeatureFlag } from "@context";
import { useTranslation, useWalletErrorModal } from "@hooks";
import { DashboardActionCard } from "@molecules";
import { correctAdaFormat, openInNewTab } from "@utils";
Expand All @@ -18,6 +18,7 @@ export const ProposeGovActionDashboardCard = ({
deposit,
votingPower,
}: ProposeGovActionDashboardCardProps) => {
const { isProposalDiscussionForumEnabled } = useFeatureFlag();
const navigate = useNavigate();
const { t } = useTranslation();
const openWalletErrorModal = useWalletErrorModal();
Expand All @@ -34,8 +35,14 @@ export const ProposeGovActionDashboardCard = ({
return;
}

navigate(PATHS.createGovernanceAction);
}, [deposit, votingPower]);
navigate(
isProposalDiscussionForumEnabled
? `${PATHS.connectedProposalPillar.replace("/*", "")}${
PDF_PATHS.proposalDiscussion
}`
: PATHS.createGovernanceAction,
);
}, [deposit, votingPower, isProposalDiscussionForumEnabled]);

return (
<DashboardActionCard
Expand Down
11 changes: 9 additions & 2 deletions govtool/frontend/src/components/organisms/PDFWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ import { useCardano, useGovernanceActions } from "@/context";
const PDF = React.lazy(() => import("@intersect.mbo/pdf-ui/cjs"));

export const PDFWrapper = () => {
const walletAPI = useCardano();
const { walletApi, ...context } = useCardano();
const { createGovernanceActionJsonLD, createHash } = useGovernanceActions();

return (
<Box
sx={{
px: { xs: 2, sm: 5 },
py: 3,
display: "flex",
flex: 1,
}}
>
<Suspense
Expand All @@ -32,7 +34,12 @@ export const PDFWrapper = () => {
}
>
<PDF
walletAPI={{ ...walletAPI, createGovernanceActionJsonLD, createHash }}
walletAPI={{
...context,
...walletApi,
createGovernanceActionJsonLD,
createHash,
}}
pathname={window.location.pathname}
/>
</Suspense>
Expand Down
Loading

0 comments on commit 8a184d4

Please sign in to comment.