Skip to content
Merged

v2.0.26 #3805

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
5c7d5c7
chore: update @intersect.mbo/pdf-ui to 1.0.0-beta
github-actions[bot] Jun 11, 2025
d1e4940
Merge pull request #3753 from IntersectMBO/chore/@intersect.mbo/pdf-u…
bosko-m Jun 11, 2025
4e6ceef
fix-storybook
Ciabas Jun 11, 2025
c5b9232
Merge pull request #3754 from IntersectMBO/3682-adjust-top-menu-layou…
Ciabas Jun 11, 2025
684e236
Update GOVERNANCE_ACTION_SUBMISSION.md
Ciabas Jun 12, 2025
5919c39
chore: update @intersect.mbo/pdf-ui to 1.0.1-alfa
github-actions[bot] Jun 12, 2025
e570d77
Merge pull request #3782 from IntersectMBO/docs-gov-action-build-hard…
bosko-m Jun 12, 2025
83e3956
Merge pull request #3786 from IntersectMBO/chore/@intersect.mbo/pdf-u…
bosko-m Jun 12, 2025
8188beb
(feat#3745): display authors for Live Voting Governance Actions
Ciabas Jun 12, 2025
34ebe49
Merge pull request #3787 from IntersectMBO/3745-display-authors-for-l…
bosko-m Jun 13, 2025
b7deafb
(fix#3745) authors case formatting for gov actions
Ciabas Jun 16, 2025
bdea53d
Merge pull request #3789 from IntersectMBO/3745-display-authors-for-l…
Ciabas Jun 16, 2025
63e29f5
chore: update @intersect.mbo/pdf-ui to 1.0.1-beta
github-actions[bot] Jun 18, 2025
af692e1
Merge pull request #3802 from IntersectMBO/chore/@intersect.mbo/pdf-u…
bosko-m Jun 18, 2025
6f90e38
chore: update @intersect.mbo/pdf-ui to 1.0.2-alfa
github-actions[bot] Jun 18, 2025
924ec88
Merge pull request #3803 from IntersectMBO/chore/@intersect.mbo/pdf-u…
bosko-m Jun 18, 2025
8e56a08
chore: update @intersect.mbo/pdf-ui to 1.0.2-beta
github-actions[bot] Jun 18, 2025
8ff3272
Merge pull request #3804 from IntersectMBO/chore/@intersect.mbo/pdf-u…
bosko-m Jun 18, 2025
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

- Preserve maintenance ending banner state on the wallet connection change [Issue 3681](https://github.com/IntersectMBO/govtool/issues/3681)
- Add authors for Live Voting Governance Actions [Issue 3745](https://github.com/IntersectMBO/govtool/issues/3745)

### Fixed

Expand Down
6 changes: 3 additions & 3 deletions docs/GOVERNANCE_ACTION_SUBMISSION.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ const buildProtocolParameterChangeGovernanceAction: (
protocolParameterChangeProps: ProtocolParameterChangeProps
) => Promise<VotingProposalBuilder | undefined>;

const buildHardForkInitiationGovernanceAction: (
const buildHardForkGovernanceAction: (
hardForkInitiationProps: HardForkInitiationProps
) => Promise<VotingProposalBuilder | undefined>;

Expand Down Expand Up @@ -210,7 +210,7 @@ const {
buildSignSubmitConwayCertTx,
buildNewInfoGovernanceAction,
buildProtocolParameterChangeGovernanceAction,
buildHardForkInitiationGovernanceAction,
buildHardForkGovernanceAction,
buildTreasuryGovernanceAction,
buildNewConstitutionGovernanceAction,
buildUpdateCommitteeGovernanceAction,
Expand Down Expand Up @@ -241,7 +241,7 @@ govActionBuilder = await buildProtocolParameterChangeGovernanceAction({
});

// hash of the previous Governance Action, index of the previous Governance Action, url of the metadata, hash of the metadata, and the major and minor numbers of the hard fork initiation
govActionBuilder = await buildHardForkInitiationGovernanceAction({
govActionBuilder = await buildHardForkGovernanceAction({
prevGovernanceActionHash,
prevGovernanceActionIndex,
url,
Expand Down
16 changes: 14 additions & 2 deletions govtool/backend/sql/list-proposals.sql
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,18 @@ SELECT
COALESCE(cv.ccNoVotes, 0) cc_no_votes,
COALESCE(cv.ccAbstainVotes, 0) cc_abstain_votes,
prev_gov_action.index as prev_gov_action_index,
encode(prev_gov_action_tx.hash, 'hex') as prev_gov_action_tx_hash
encode(prev_gov_action_tx.hash, 'hex') as prev_gov_action_tx_hash,
COALESCE(
json_agg(
json_build_object(
'name', off_chain_vote_author.name,
'witnessAlgorithm', off_chain_vote_author.witness_algorithm,
'publicKey', off_chain_vote_author.public_key,
'signature', off_chain_vote_author.signature
)
) FILTER (WHERE off_chain_vote_author.id IS NOT NULL),
'[]'
) authors
FROM
gov_action_proposal
JOIN ActiveProposals ON gov_action_proposal.id = ActiveProposals.id
Expand All @@ -314,6 +325,7 @@ FROM
LEFT JOIN block AS creator_block ON creator_block.id = creator_tx.block_id
LEFT JOIN voting_anchor ON voting_anchor.id = gov_action_proposal.voting_anchor_id
LEFT JOIN off_chain_vote_data ON off_chain_vote_data.voting_anchor_id = voting_anchor.id
lEFT JOIN off_chain_vote_author ON off_chain_vote_author.off_chain_vote_data_id = off_chain_vote_data.id
LEFT JOIN off_chain_vote_gov_action_data ON off_chain_vote_gov_action_data.off_chain_vote_data_id = off_chain_vote_data.id
LEFT JOIN param_proposal AS proposal_params ON gov_action_proposal.param_proposal = proposal_params.id
LEFT JOIN cost_model AS cost_model ON proposal_params.cost_model_id = cost_model.id
Expand Down Expand Up @@ -355,4 +367,4 @@ GROUP BY
off_chain_vote_gov_action_data.title,
off_chain_vote_gov_action_data.abstract,
off_chain_vote_gov_action_data.motivation,
off_chain_vote_gov_action_data.rationale;
off_chain_vote_gov_action_data.rationale;
3 changes: 2 additions & 1 deletion govtool/backend/src/VVA/API.hs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,8 @@ proposalToResponse timeZone Types.Proposal {..} =
proposalResponseCcNoVotes = proposalCcNoVotes,
proposalResponseCcAbstainVotes = proposalCcAbstainVotes,
proposalResponsePrevGovActionIndex = proposalPrevGovActionIndex,
proposalResponsePrevGovActionTxHash = HexText <$> proposalPrevGovActionTxHash
proposalResponsePrevGovActionTxHash = HexText <$> proposalPrevGovActionTxHash,
proposalResponseAuthors = ProposalAuthors <$> proposalAuthors
}

voteToResponse :: Types.Vote -> VoteParams
Expand Down
47 changes: 46 additions & 1 deletion govtool/backend/src/VVA/API/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -401,9 +401,52 @@ data ProposalResponse
, proposalResponseCcAbstainVotes :: Integer
, proposalResponsePrevGovActionIndex :: Maybe Integer
, proposalResponsePrevGovActionTxHash :: Maybe HexText
, proposalResponseAuthors :: Maybe ProposalAuthors
}
deriving (Generic, Show)

newtype ProposalAuthors = ProposalAuthors { getProposalAuthors :: Value }
deriving newtype (Show)

instance FromJSON ProposalAuthors where
parseJSON v@(Array _) = pure $ ProposalAuthors v
parseJSON _ = fail "ProposalAuthors must be a JSON array"

instance ToJSON ProposalAuthors where
toJSON (ProposalAuthors v) = v

instance ToSchema ProposalAuthors where
declareNamedSchema _ = pure $ NamedSchema (Just "ProposalAuthors") $ mempty
& type_ ?~ OpenApiArray
& description ?~ "A JSON array of proposal authors"
& example ?~ toJSON
[ object
[ "name" .= ("Alice" :: Text)
, "witnessAlgorithm" .= ("algo" :: Text)
, "publicKey" .= ("key" :: Text)
, "signature" .= ("sig" :: Text)
]
, object
[ "name" .= ("Bob" :: Text)
, "witnessAlgorithm" .= ("algo2" :: Text)
, "publicKey" .= ("key2" :: Text)
, "signature" .= ("sig2" :: Text)
]
]

exampleProposalAuthors :: Text
exampleProposalAuthors =
"[\
\ {\"name\": \"Alice\",\
\ \"witnessAlgorithm\": \"Ed25519\",\
\ \"publicKey\": \"abcdef123456\",\
\ \"signature\": \"deadbeef\"},\
\ {\"name\": \"Bob\",\
\ \"witnessAlgorithm\": \"Ed25519\",\
\ \"publicKey\": \"123456abcdef\",\
\ \"signature\": \"beefdead\"}\
\]"

deriveJSON (jsonOptions "proposalResponse") ''ProposalResponse

exampleProposalResponse :: Text
Expand Down Expand Up @@ -433,7 +476,9 @@ exampleProposalResponse = "{ \"id\": \"proposalId123\","
<> "\"cCNoVotes\": 0,"
<> "\"cCAbstainVotes\": 0,"
<> "\"prevGovActionIndex\": 0,"
<> "\"prevGovActionTxHash\": \"47c14a128cd024f1b990c839d67720825921ad87ed875def42641ddd2169b39c\"}"
<> "\"prevGovActionTxHash\": \"47c14a128cd024f1b990c839d67720825921ad87ed875def42641ddd2169b39c\","
<> "\"authors\": " <> exampleProposalAuthors
<> "}"

instance ToSchema Value where
declareNamedSchema _ = pure $ NamedSchema (Just "Value") $ mempty
Expand Down
2 changes: 2 additions & 0 deletions govtool/backend/src/VVA/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ data Proposal
, proposalCcAbstainVotes :: Integer
, proposalPrevGovActionIndex :: Maybe Integer
, proposalPrevGovActionTxHash :: Maybe Text
, proposalAuthors :: Maybe Value
}
deriving (Show)

Expand Down Expand Up @@ -241,6 +242,7 @@ instance FromRow Proposal where
<*> (floor @Scientific <$> field) -- proposalCcAbstainVotes
<*> field -- prevGovActionIndex
<*> field -- prevGovActionTxHash
<*> field -- proposalAuthors

data TransactionStatus = TransactionStatus
{ transactionConfirmed :: Bool
Expand Down
8 changes: 4 additions & 4 deletions govtool/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion govtool/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@hookform/resolvers": "^3.3.1",
"@intersect.mbo/govtool-outcomes-pillar-ui": "v1.4.3",
"@intersect.mbo/intersectmbo.org-icons-set": "^1.0.8",
"@intersect.mbo/pdf-ui": "0.7.0-beta-36",
"@intersect.mbo/pdf-ui": "1.0.2-beta",
"@mui/icons-material": "^5.14.3",
"@mui/material": "^5.14.4",
"@rollup/plugin-babel": "^6.0.4",
Expand Down
49 changes: 44 additions & 5 deletions govtool/frontend/src/components/atoms/Link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@ import { NavLink } from "react-router-dom";
import { Typography } from "@mui/material";
import { useCardano } from "@context";

const FONT_SIZE = {
small: 14,
big: 22,
};

type LinkProps = {
dataTestId?: string;
isConnectWallet?: boolean;
label: React.ReactNode;
navTo: string;
onClick?: (event: MouseEvent<HTMLAnchorElement>) => void;
onClick?: (event: MouseEvent<HTMLElement>) => void;
size?: "small" | "big";
};

Expand All @@ -24,10 +29,7 @@ export const Link = forwardRef<HTMLAnchorElement, LinkProps>(
} = props;
const { disconnectWallet } = useCardano();

const fontSize = {
small: 14,
big: 22,
}[size];
const fontSize = FONT_SIZE[size];

return (
<NavLink
Expand Down Expand Up @@ -57,3 +59,40 @@ export const Link = forwardRef<HTMLAnchorElement, LinkProps>(
);
},
);

// This component is used as a placeholder for links that do not navigate anywhere,
// but with the same styling as the Link component.
export const FakeLink = forwardRef<HTMLElement, Omit<LinkProps, "navTo">>(
(props, ref) => {
const {
dataTestId,
isConnectWallet,
label,
size = "small",
onClick,
} = props;
const { disconnectWallet } = useCardano();

const fontSize = FONT_SIZE[size];

return (
<Typography
data-testid={dataTestId}
onClick={(e) => {
e.preventDefault();
if (!isConnectWallet) disconnectWallet();
if (onClick) onClick(e);
}}
ref={ref}
sx={{
cursor: "pointer",
fontSize,
fontWeight: 500,
color: "textBlack",
}}
>
{label}
</Typography>
);
},
);
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { useModal } from "@/context";

type BaseProps = {
label: string;
text?: string | number;
text?: React.ReactNode;
dataTestId?: string;
isSliderCard?: boolean;
tooltipProps?: Omit<TooltipProps, "children">;
Expand Down Expand Up @@ -108,7 +108,7 @@ export const GovernanceActionCardElement = ({
...(isSemiTransparent && { opacity: 0.75 }),
}}
>
{isMarkdown ? removeMarkdown(text) : text}
{typeof text === "string" && isMarkdown ? removeMarkdown(text) : text}
</Typography>
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useMemo, useState } from "react";
import { useMemo, useState, Fragment } from "react";
import { Box, Tabs, Tab, styled, Skeleton } from "@mui/material";
import { useLocation } from "react-router-dom";

import { CopyButton, ExternalModalButton, Typography } from "@atoms";
import { CopyButton, ExternalModalButton, Tooltip, Typography } from "@atoms";
import {
GovernanceActionCardElement,
GovernanceActionDetailsCardLinks,
Expand Down Expand Up @@ -76,6 +76,7 @@ export const GovernanceActionDetailsCardData = ({
isValidating,
proposal: {
abstract,
authors,
createdDate,
createdEpochNo,
details,
Expand Down Expand Up @@ -365,6 +366,35 @@ export const GovernanceActionDetailsCardData = ({
/>
</>
)}
<GovernanceActionCardElement
label={t("govActions.authors.title")}
text={
(authors ?? []).length <= 0
? t("govActions.authors.noDataAvailable")
: (authors ?? []).map((author, idx, arr) => (
<Fragment key={author.publicKey}>
<Tooltip
heading={`${t("govActions.authors.witnessAlgorithm")}: ${
author.witnessAlgorithm
}`}
paragraphOne={`${t("govActions.authors.publicKey")}: ${
author.publicKey
}`}
paragraphTwo={`${t("govActions.authors.signature")}: ${
author.signature
}`}
placement="bottom-end"
arrow
>
<span>{author.name}</span>
</Tooltip>
{idx < arr.length - 1 && <span>,&nbsp;</span>}
</Fragment>
))
}
textVariant="longText"
dataTestId="authors"
/>

<GovernanceActionDetailsCardLinks links={references} />
</Box>
Expand Down
Loading
Loading