Skip to content
Merged

v2.0.36 #4099

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
27 changes: 12 additions & 15 deletions govtool/backend/sql/get-network-metrics.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,18 @@ CurrentEpoch AS (
SELECT MAX(no) AS no FROM epoch
),
CommitteeMembers AS (
SELECT DISTINCT ON (cm.committee_hash_id)
cr.id,
block.time,
encode(cold_key_hash.raw, 'hex') cold_key,
encode(hot_key_hash.raw, 'hex') hot_key
FROM committee_registration cr
JOIN tx ON tx.id = cr.tx_id
JOIN block ON block.id = tx.block_id
JOIN committee_hash cold_key_hash ON cr.cold_key_id = cold_key_hash.id
JOIN committee_hash hot_key_hash ON cr.hot_key_id = hot_key_hash.id
JOIN committee_member cm ON cm.committee_hash_id = cold_key_hash.id OR cm.committee_hash_id = hot_key_hash.id
LEFT JOIN committee_de_registration cdr ON cdr.cold_key_id = cold_key_hash.id
CROSS JOIN CurrentEpoch
WHERE
cdr.id IS NULL AND cm.expiration_epoch > CurrentEpoch.no
SELECT
DISTINCT cm.committee_hash_id AS committee_members
FROM committee_member cm
JOIN committee c ON c.id = cm.committee_id
LEFT JOIN gov_action_proposal gap ON gap.id = c.gov_action_proposal_id
CROSS JOIN CurrentEpoch ce
WHERE (
(c.gov_action_proposal_id IS NULL)
OR
(gap.enacted_epoch IS NOT NULL AND gap.enacted_epoch <= ce.no)
)
AND cm.expiration_epoch >= ce.no
),
NoOfCommitteeMembers AS (
SELECT COUNT(*) total FROM CommitteeMembers
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.5.9",
"@intersect.mbo/intersectmbo.org-icons-set": "^1.0.8",
"@intersect.mbo/pdf-ui": "1.0.14-beta",
"@intersect.mbo/pdf-ui": "1.0.15-beta",
"@mui/icons-material": "^5.14.3",
"@mui/material": "^5.14.4",
"@noble/ed25519": "^2.3.0",
Expand Down
17 changes: 10 additions & 7 deletions govtool/frontend/src/components/molecules/DataActionsBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,16 @@ export const DataActionsBar: FC<DataActionsBarProps> = ({
setChosenFilters?.((prev) => (prev ?? []).filter((k) => k !== key));

return (
<Box display="flex" flexDirection="column" gap={1.5}>
<Box display="flex" flexDirection="column" gap={1.5} sx={{ width: "100%" }}>
<Box
display="grid"
gridTemplateColumns={{
xs: "minmax(0,1fr) max-content",
sm: "minmax(0,1fr) max-content",
}}
columnGap={{ xs: 1, sm: 1.5 }}
alignItems="center"
display="flex"
justifyContent="space-between"
gap={{ xs: 0.75, sm: 1.5 }}
flexWrap={{ xs: "wrap", sm: "nowrap" }}
width="100%"
sx={{ width: "100%" }}
>
<InputBase
inputProps={{ "data-testid": "search-input" }}
Expand Down Expand Up @@ -115,7 +117,7 @@ export const DataActionsBar: FC<DataActionsBarProps> = ({
borderColor: "#6E87D9",
borderRadius: 50,
boxShadow: "2px 2px 20px 0 rgba(0,0,0,0.05)",
fontSize: 11,
fontSize: { xs: 16, sm: 11 },
fontWeight: 500,
height: 48,
padding: "16px 24px",
Expand All @@ -133,6 +135,7 @@ export const DataActionsBar: FC<DataActionsBarProps> = ({
flex: "0 0 auto",
flexShrink: 0,
mt: { xs: 1, sm: 0 },
mr: { xs: 2, sm: 0 },
}}
>
<OrderActionsChip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,20 @@ export const MaintenanceEndingBanner = () => {
color="common.white"
mb={0.5}
>
{t("system.maintenanceEnding.description2")}
<Trans
i18nKey="system.maintenanceEnding.description2"
components={[
<Link
variant="caption"
fontWeight={600}
color="common.white"
href="https://gov.tools/governance_actions/d2db60c5307cb517c735e2d0138d2b6f10fc5b221d610fa187719bdc82af9a03#0"
data-testid="govtool-info-link"
target="_blank"
rel="noopener noreferrer"
/>,
]}
/>
</Typography>
</Box>
</Box>
Expand Down
4 changes: 2 additions & 2 deletions govtool/frontend/src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -796,9 +796,9 @@
"title": "This tool is connected to {{networkName}}",
"bootstrappingWarning": "Govtool is in the Bootstrapping phase. Some features are not available. <docs>Learn more</docs>",
"maintenanceEnding": {
"title": "\uD83D\uDCA1 Next Step: Treasury Withdrawal based on your feedback is coming soon",
"title": "\uD83D\uDCA1 Next Step: Treasury Withdrawal based on your feedback has been submitted",
"description1": "<0>The Info Action</0> has passed — thank you for your support!",
"description2": "We’re now preparing a Treasury Withdrawal proposal that reflects the feedback gathered during the voting phase to ensure continued development and maintenance of GovTool as a community-owned governance interface on Cardano."
"description2": "We have now submitted a <0>Treasury Withdrawal</0> that reflects the feedback gathered during the voting phase to ensure continued development and maintenance of GovTool as a community-owned governance interface on Cardano."
}
},
"tooltips": {
Expand Down
125 changes: 83 additions & 42 deletions govtool/frontend/src/pages/DRepDirectoryContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ export const DRepDirectoryContent: FC<DRepDirectoryContentProps> = ({
const [inProgressDelegationDRepData, setInProgressDelegationDRepData] =
useState<DRepData | undefined>(undefined);

// Set initial filters and sort
useEffect(() => {
if (!lastPath.includes("drep_directory")) {
setChosenFilters([DRepStatus.Active]);
Expand Down Expand Up @@ -104,7 +103,7 @@ export const DRepDirectoryContent: FC<DRepDirectoryContentProps> = ({
baselineTotalForStatus,
} = useGetDRepListPaginatedQuery(
{
page: page - 1, // convert 1-based UI -> 0-based API
page: page - 1,
pageSize,
searchPhrase: debouncedSearchText,
sorting: chosenSorting as DRepListSort,
Expand Down Expand Up @@ -151,9 +150,28 @@ export const DRepDirectoryContent: FC<DRepDirectoryContentProps> = ({
currentDelegation?.dRepView ===
AutomatedVotingOptionCurrentDelegation.drep_always_no_confidence);

const scaleWrapSx = isConnected
? ({
width: "100%",
transform: { xs: "scale(0.9)", sm: "scale(0.9)", md: "none" },
transformOrigin: { xs: "top center", sm: "top center", md: "initial" },
ml: { xs: 0.25, sm: 0.25, md: 0 },
} as const)
: ({
width: "100%",
transform: { xs: "scale(0.9)", sm: "scale(0.9)", md: "none" },
transformOrigin: { xs: "top left", sm: "top left", md: "initial" },
ml: { xs: 0.25, sm: 0.25, md: 0 },
} as const);

return (
<Box display="flex" flex={1} flexDirection="column" gap={4}>
{/* My delegation */}
<Box
display="flex"
flex={1}
flexDirection="column"
gap={4}
sx={{ width: "100%", maxWidth: "100vw" }}
>
{myDrep &&
!inProgressDelegation &&
currentDelegation &&
Expand All @@ -162,26 +180,34 @@ export const DRepDirectoryContent: FC<DRepDirectoryContentProps> = ({
<Typography variant="title2" sx={{ mb: 2 }}>
<Trans i18nKey="dRepDirectory.myDelegation" values={{ ada }} />
</Typography>
<DRepCard
dRep={myDrep}
isConnected={!!isConnected}
isInProgress={isSameDRep(myDrep, inProgressDelegation)}
isMe={isSameDRep(myDrep, myDRepId)}
/>
<Box>
<Box sx={scaleWrapSx}>
<DRepCard
dRep={myDrep}
isConnected={!!isConnected}
isInProgress={isSameDRep(myDrep, inProgressDelegation)}
isMe={isSameDRep(myDrep, myDRepId)}
/>
</Box>
</Box>
</div>
)}

{inProgressDelegation &&
inProgressDelegation !== myDRepId &&
inProgressDelegationDRepData && (
<DRepCard
dRep={inProgressDelegationDRepData}
isConnected={!!isConnected}
isMe={isSameDRep(inProgressDelegationDRepData, myDRepId)}
isInProgress
/>
<Box>
<Box sx={scaleWrapSx}>
<DRepCard
dRep={inProgressDelegationDRepData}
isConnected={!!isConnected}
isMe={isSameDRep(inProgressDelegationDRepData, myDRepId)}
isInProgress
/>
</Box>
</Box>
)}

{/* Automated voting options */}
{isConnected && (
<div>
<Typography variant="title2" sx={{ mb: 2 }}>
Expand Down Expand Up @@ -216,7 +242,6 @@ export const DRepDirectoryContent: FC<DRepDirectoryContentProps> = ({
</div>
)}

{/* DRep list */}
<>
<Typography fontSize={18} fontWeight={500} sx={{ mb: 3 }}>
{t("dRepDirectory.listTitle")}
Expand Down Expand Up @@ -263,41 +288,57 @@ export const DRepDirectoryContent: FC<DRepDirectoryContentProps> = ({
mt={showSearchSummary ? 0 : 4}
p={0}
sx={{
opacity: isPrev ? 0.5 : 1,
transition: "opacity 0.2s",
flex: 1,
width: "100%",
maxWidth: "100%",
}}
>
{filteredDoNotListDReps?.length === 0 && <EmptyStateDrepDirectory />}
{filteredDoNotListDReps?.map((dRep) => (
<Box key={dRep.view} component="li" sx={{ listStyle: "none" }}>
<DRepCard
dRep={dRep}
isConnected={!!isConnected}
isDelegationLoading={
isDelegating === dRep.view || isDelegating === dRep.drepId
}
isMe={isSameDRep(dRep, myDRepId)}
isMyDrep={isSameDRep(dRep, currentDelegation?.dRepView)}
onDelegate={() => {
setInProgressDelegationDRepData(dRep);
delegate(dRep.drepId);
}}
/>
<Box>
<Box sx={scaleWrapSx}>
<DRepCard
dRep={dRep}
isConnected={!!isConnected}
isDelegationLoading={
isDelegating === dRep.view || isDelegating === dRep.drepId
}
isMe={isSameDRep(dRep, myDRepId)}
isMyDrep={isSameDRep(dRep, currentDelegation?.dRepView)}
onDelegate={() => {
setInProgressDelegationDRepData(dRep);
delegate(dRep.drepId);
}}
/>
</Box>
</Box>
</Box>
))}
</Box>

<PaginationFooter
page={page}
total={total || 0}
pageSize={pageSize}
onPageChange={setPage}
onPageSizeChange={(n) => {
setPageSize(n);
setPage(1);
<Box
sx={{
width: "100%",
transform: { xs: "scale(0.85)", sm: "scale(0.85)", md: "none" },
transformOrigin: {
xs: "top rigth",
sm: "top rigth",
md: "initial",
},
}}
/>
>
<PaginationFooter
page={page}
total={total || 0}
pageSize={pageSize}
onPageChange={setPage}
onPageSizeChange={(n) => {
setPageSize(n);
setPage(1);
}}
/>
</Box>
</>
</Box>
);
Expand Down
4 changes: 2 additions & 2 deletions govtool/frontend/src/utils/validateSignature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ export const validateSignature = async ({
switch (algorithm) {
case "ed25519":
case "Ed25519": {
return verifyEd25519Signature(signature, messageHash, publicKey);
return await verifyEd25519Signature(signature, messageHash, publicKey);
}
case "CIP-8":
case "CIP-0008": {
return verifyCIP8Signature(signature, messageHash, publicKey);
return await verifyCIP8Signature(signature, messageHash, publicKey);
}
default:
console.error("Unsupported algorithm:", algorithm);
Expand Down
Loading