Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ changes.
### Added

- Add Proposal discussion context that manages username [Issue 3341](https://github.com/IntersectMBO/govtool/issues/3341)
- Add epochParams and ada holder balance to Proposal Discussion Pillar [Issue 2243](https://github.com/IntersectMBO/govtool/issues/2243)

### Fixed

Expand Down
11 changes: 10 additions & 1 deletion govtool/frontend/src/pages/ProposalDiscussion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,34 @@ import React, { ComponentProps, Suspense } from "react";
import { Box, CircularProgress } from "@mui/material";
import "@intersect.mbo/pdf-ui/style";
import {
useAppContext,
useCardano,
useGovernanceActions,
useProposalDiscussion,
} from "@/context";
import { useValidateMutation } from "@/hooks/mutations";
import { useScreenDimension } from "@/hooks/useScreenDimension";
import { Footer, TopNav } from "@/components/organisms";
import { useGetDRepVotingPowerList, useGetVoterInfo } from "@/hooks";
import {
useGetAdaHolderVotingPowerQuery,
useGetDRepVotingPowerList,
useGetVoterInfo,
} from "@/hooks";

const ProposalDiscussion = React.lazy(
() => import("@intersect.mbo/pdf-ui/cjs"),
);

export const ProposalDiscussionPillar = () => {
const { epochParams } = useAppContext();
const { pagePadding } = useScreenDimension();
const { validateMetadata } = useValidateMutation();
const { walletApi, ...context } = useCardano();
const { voter } = useGetVoterInfo();
const { createGovernanceActionJsonLD, createHash } = useGovernanceActions();
const { fetchDRepVotingPowerList } = useGetDRepVotingPowerList();
const { username, setUsername } = useProposalDiscussion();
const { votingPower } = useGetAdaHolderVotingPowerQuery(context.stakeKey);

return (
<Box
Expand Down Expand Up @@ -74,6 +81,8 @@ export const ProposalDiscussionPillar = () => {
fetchDRepVotingPowerList={fetchDRepVotingPowerList}
username={username}
setUsername={setUsername}
epochParams={epochParams}
votingPower={votingPower}
/>
</Suspense>
</Box>
Expand Down
65 changes: 34 additions & 31 deletions govtool/frontend/src/types/@intersect.mbo.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,44 @@ enum MetadataValidationStatus {
INVALID_HASH = "INVALID_HASH",
INCORRECT_FORMAT = "INCORRECT_FORMAT",
}
declare module "@intersect.mbo/pdf-ui/cjs" {
import { EpochParams } from "@/models";

type ProposalDiscussionProps = {
pdfApiUrl: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
walletAPI: any;
pathname: string;
locale?: string;
validateMetadata: ({
url,
hash,
standard,
}: {
url: string;
hash: string;
standard: "CIP108";
}) => Promise<
type ProposalDiscussionProps = {
pdfApiUrl: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
| { status?: MetadataValidationStatus; metadata?: any; valid: boolean }
| undefined
>;
fetchDRepVotingPowerList: (
identifiers: string[],
) => Promise<DRepVotingPowerListResponse>;
username: string;
setUsername: (username: string) => void;
};
walletAPI: any;
pathname: string;
locale?: string;
validateMetadata: ({
url,
hash,
standard,
}: {
url: string;
hash: string;
standard: "CIP108";
}) => Promise<
// eslint-disable-next-line @typescript-eslint/no-explicit-any
| { status?: MetadataValidationStatus; metadata?: any; valid: boolean }
| undefined
>;
fetchDRepVotingPowerList: (
identifiers: string[],
) => Promise<DRepVotingPowerListResponse>;
epochParams?: EpochParams;
votingPower: number;
username: string;
setUsername: (username: string) => void;
};

type GovernanceActionsOutcomesProps = {
apiUrl?: string;
ipfsGateway?: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
walletAPI?: any;
};
type GovernanceActionsOutcomesProps = {
apiUrl?: string;
ipfsGateway?: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
walletAPI?: any;
};

declare module "@intersect.mbo/pdf-ui/cjs" {
export default function ProposalDiscussion(
props: ProposalDiscussionProps,
): JSX.Element;
Expand Down