Skip to content

Commit

Permalink
Merge pull request #2565 from IntersectMBO/feat/split-new-constitutio…
Browse files Browse the repository at this point in the history
…n-details-into-tabs

feat: split new constitution on-chain details into tabs
  • Loading branch information
MSzalowski authored Dec 23, 2024
2 parents 88908ec + 1830056 commit 7879174
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 28 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ changes.

### Changed

-
- Split New constitution on-chain details into tabs

### Removed

Expand Down
4 changes: 2 additions & 2 deletions govtool/frontend/package-lock.json

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { Box } from "@mui/material";

import { NewConstitutionAnchor, ProposalData } from "@/models";
import { useScreenDimension } from "@/hooks";

import { GovernanceActionCardElement } from "./GovernanceActionCardElement";

export const GovernanceActionNewConstitutionDetailsTabContent = ({
details,
}: Pick<ProposalData, "details">) => {
const { screenWidth } = useScreenDimension();
return (
<Box>
<GovernanceActionCardElement
isCopyButton
label="Data Hash"
text={(details?.anchor as NewConstitutionAnchor)?.dataHash as string}
dataTestId="new-constitution-data-hash"
textVariant={screenWidth > 1600 ? "longText" : "oneLine"}
/>
<GovernanceActionCardElement
isCopyButton
label="New Constitution Link"
text={(details?.anchor as NewConstitutionAnchor)?.url as string}
dataTestId="new-constitution-url"
textVariant={screenWidth > 1600 ? "longText" : "oneLine"}
/>
</Box>
);
};
1 change: 1 addition & 0 deletions govtool/frontend/src/components/molecules/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export * from "./GovernanceActionDetailsCardLinks";
export * from "./GovernanceActionDetailsCardOnChainData";
export * from "./GovernanceActionDetailsCardVotes";
export * from "./GovernanceActionDetailsDiffView";
export * from "./GovernanceActionNewConstitutionDetailsTabContent";
export * from "./GovernanceActionNewCommitteeDetailsTabContent";
export * from "./GovernanceActionsDatesBox";
export * from "./GovernanceVotedOnCard";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
GovernanceActionDetailsDiffView,
GovernanceActionNewCommitteeDetailsTabContent,
GovernanceActionCardTreasuryWithdrawalElement,
GovernanceActionNewConstitutionDetailsTabContent,
} from "@molecules";
import { useScreenDimension, useTranslation } from "@hooks";
import {
Expand All @@ -22,11 +23,7 @@ import {
mapArrayToObjectByKeys,
encodeCIP129Identifier,
} from "@utils";
import {
MetadataValidationStatus,
NewConstitutionAnchor,
ProposalData,
} from "@models";
import { MetadataValidationStatus, ProposalData } from "@models";
import { GovernanceActionType } from "@/types/governanceAction";
import { useAppContext } from "@/context";

Expand Down Expand Up @@ -200,6 +197,19 @@ export const GovernanceActionDetailsCardData = ({
),
visible: type === GovernanceActionType.NewCommittee && !!details,
},
{
label: "Details",
dataTestId: "parameters-tab",
content: (
<GovernanceActionNewConstitutionDetailsTabContent
details={details}
/>
),
visible:
type === GovernanceActionType.NewConstitution &&
!!details &&
!!details?.anchor,
},
].filter((tab) => tab.visible),
[
abstract,
Expand Down Expand Up @@ -307,26 +317,6 @@ export const GovernanceActionDetailsCardData = ({
amount={withdrawal.amount}
/>
))}
{details?.anchor && type === GovernanceActionType.NewConstitution && (
<>
<GovernanceActionCardElement
isCopyButton
label="Data Hash"
text={
(details?.anchor as NewConstitutionAnchor)?.dataHash as string
}
dataTestId="new-constitution-data-hash"
textVariant={screenWidth > 1600 ? "longText" : "oneLine"}
/>
<GovernanceActionCardElement
isCopyButton
label="URL"
text={(details?.anchor as NewConstitutionAnchor)?.url as string}
dataTestId="new-constitution-url"
textVariant={screenWidth > 1600 ? "longText" : "oneLine"}
/>
</>
)}
<GovernanceActionDetailsCardLinks links={references} />
</Box>
);
Expand Down

0 comments on commit 7879174

Please sign in to comment.