diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a59be319..76cf109e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -101,6 +101,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Bug fixes +- [#985](https://github.com/alleslabs/celatone-frontend/pull/985) Fix proposal details lite version bugs - [#987](https://github.com/alleslabs/celatone-frontend/pull/987) Fix bug bash (query redirection, module button color, modal open/close, migration contract radio button, txs count in account detail) - [#989](https://github.com/alleslabs/celatone-frontend/pull/989) Change tomcat endpoints - [#984](https://github.com/alleslabs/celatone-frontend/pull/984) Exclude non block number from searching block in lite diff --git a/src/lib/pages/proposal-details/components/VoteQuorumCircle.tsx b/src/lib/pages/proposal-details/components/VoteQuorumCircle.tsx index fcf778f39..1cee413ec 100644 --- a/src/lib/pages/proposal-details/components/VoteQuorumCircle.tsx +++ b/src/lib/pages/proposal-details/components/VoteQuorumCircle.tsx @@ -1,4 +1,5 @@ import { Circle, Heading, Text } from "@chakra-ui/react"; +import { isNull } from "lodash"; import type { Nullable, Ratio } from "lib/types"; import { formatPrettyPercent } from "lib/utils"; @@ -64,7 +65,7 @@ export const VoteQuorumCircle = ({ fontWeight={600} color={totalRatio ? "text.main" : "text.dark"} > - {totalRatio ? formatPrettyPercent(totalRatio, 1) : "N/A"} + {!isNull(totalRatio) ? formatPrettyPercent(totalRatio, 1) : "N/A"} diff --git a/src/lib/pages/proposal-details/components/proposal-overview/ProposalMessages.tsx b/src/lib/pages/proposal-details/components/proposal-overview/ProposalMessages.tsx index b7dd4c5df..5a2999f77 100644 --- a/src/lib/pages/proposal-details/components/proposal-overview/ProposalMessages.tsx +++ b/src/lib/pages/proposal-details/components/proposal-overview/ProposalMessages.tsx @@ -69,7 +69,7 @@ export const ProposalMessages = ({ messages }: ProposalMessagesProps) => { > {messages.map((item, i) => ( diff --git a/src/lib/pages/proposal-details/components/proposal-overview/status-summary/SummaryStatusTime.tsx b/src/lib/pages/proposal-details/components/proposal-overview/status-summary/SummaryStatusTime.tsx index 9290cf78b..0fd9a43aa 100644 --- a/src/lib/pages/proposal-details/components/proposal-overview/status-summary/SummaryStatusTime.tsx +++ b/src/lib/pages/proposal-details/components/proposal-overview/status-summary/SummaryStatusTime.tsx @@ -22,6 +22,8 @@ const getResolvedPrefix = (status: ProposalStatus) => { }; export const SummaryStatusTime = ({ proposalData }: StatusTimeProps) => { + const endTime = proposalData.resolvedTimestamp ?? proposalData.votingEndTime; + if (proposalData.status === ProposalStatus.DEPOSIT_PERIOD) return ( @@ -46,9 +48,7 @@ export const SummaryStatusTime = ({ proposalData }: StatusTimeProps) => { {getResolvedPrefix(proposalData.status)} {" at "} - {proposalData.resolvedTimestamp - ? formatUTC(proposalData.resolvedTimestamp) - : "N/A"} + {endTime ? formatUTC(endTime) : "N/A"} ); }; diff --git a/src/lib/pages/proposal-details/components/proposal-top/index.tsx b/src/lib/pages/proposal-details/components/proposal-top/index.tsx index cb9546b26..3755e61a1 100644 --- a/src/lib/pages/proposal-details/components/proposal-top/index.tsx +++ b/src/lib/pages/proposal-details/components/proposal-top/index.tsx @@ -71,7 +71,7 @@ export const ProposalTop = ({ proposalData }: ProposalTopProps) => { { fontWeight={500} whiteSpace="nowrap" lineHeight="24px" + mt="1px" > Proposal Messages: @@ -110,7 +111,7 @@ export const ProposalTop = ({ proposalData }: ProposalTopProps) => { ))} ) : ( - + (No Message) )} diff --git a/src/lib/pages/proposal-details/components/vote-details/deposit-period/DepositPeriodSection.tsx b/src/lib/pages/proposal-details/components/vote-details/deposit-period/DepositPeriodSection.tsx index 72fdc48a8..3abaefa5d 100644 --- a/src/lib/pages/proposal-details/components/vote-details/deposit-period/DepositPeriodSection.tsx +++ b/src/lib/pages/proposal-details/components/vote-details/deposit-period/DepositPeriodSection.tsx @@ -89,6 +89,7 @@ export const DepositPeriodSection = ({ diff --git a/src/lib/pages/proposal-details/components/vote-details/deposit-period/depositors-table/DepositorsTableHeader.tsx b/src/lib/pages/proposal-details/components/vote-details/deposit-period/depositors-table/DepositorsTableHeader.tsx index e184ad635..d64b9065c 100644 --- a/src/lib/pages/proposal-details/components/vote-details/deposit-period/depositors-table/DepositorsTableHeader.tsx +++ b/src/lib/pages/proposal-details/components/vote-details/deposit-period/depositors-table/DepositorsTableHeader.tsx @@ -5,15 +5,21 @@ import { TableHeader } from "lib/components/table"; interface DepositorsTableHeaderProps { templateColumns: GridProps["templateColumns"]; + showTransaction: boolean; } export const DepositorsTableHeader = ({ templateColumns, + showTransaction, }: DepositorsTableHeaderProps) => ( Depositor - Transaction Hash - Timestamp - Deposited Amount + {showTransaction && ( + <> + Transaction Hash + Timestamp + + )} + Deposited Amount ); diff --git a/src/lib/pages/proposal-details/components/vote-details/deposit-period/depositors-table/DepositorsTableRow.tsx b/src/lib/pages/proposal-details/components/vote-details/deposit-period/depositors-table/DepositorsTableRow.tsx index f77f16a5f..cf06c08fe 100644 --- a/src/lib/pages/proposal-details/components/vote-details/deposit-period/depositors-table/DepositorsTableRow.tsx +++ b/src/lib/pages/proposal-details/components/vote-details/deposit-period/depositors-table/DepositorsTableRow.tsx @@ -9,11 +9,13 @@ import { dateFromNow, formatUTC } from "lib/utils"; interface DepositorsTableRowProps { proposalDeposit: ProposalDeposit; templateColumns: string; + showTransaction: boolean; } export const DepositorsTableRow = ({ proposalDeposit, templateColumns, + showTransaction, }: DepositorsTableRowProps) => ( + {showTransaction && ( + <> + + {proposalDeposit.txHash ? ( + + ) : ( + + N/A + + )} + + + {proposalDeposit.timestamp ? ( + + + {formatUTC(proposalDeposit.timestamp)} + + + ({dateFromNow(proposalDeposit.timestamp)}) + + + ) : ( + + N/A + + )} + + + )} - {proposalDeposit.txHash ? ( - - ) : ( - - N/A - - )} - - - {proposalDeposit.timestamp ? ( - - {formatUTC(proposalDeposit.timestamp)} - - ({dateFromNow(proposalDeposit.timestamp)}) - - - ) : ( - - N/A - - )} - - diff --git a/src/lib/pages/proposal-details/components/vote-details/deposit-period/depositors-table/index.tsx b/src/lib/pages/proposal-details/components/vote-details/deposit-period/depositors-table/index.tsx index f4599a6ad..0d78bd768 100644 --- a/src/lib/pages/proposal-details/components/vote-details/deposit-period/depositors-table/index.tsx +++ b/src/lib/pages/proposal-details/components/vote-details/deposit-period/depositors-table/index.tsx @@ -10,16 +10,18 @@ import { DepositorsTableRow } from "./DepositorsTableRow"; interface DepositorsTableProps { depositors: ProposalDeposit[]; isDepositsLoading: boolean; + showTransaction: boolean; isPruned: boolean; } -const templateColumns = `1.5fr 1.5fr 2fr 1fr`; - export const DepositorsTable = ({ depositors, isDepositsLoading, + showTransaction, isPruned, }: DepositorsTableProps) => { + const templateColumns = showTransaction ? "1.5fr 1.5fr 2fr 1fr" : "240px 1fr"; + if (isDepositsLoading) return ; if (isPruned) @@ -32,12 +34,16 @@ export const DepositorsTable = ({ return ( - + {depositors.map((each) => ( ))} diff --git a/src/lib/services/proposal/lcd.ts b/src/lib/services/proposal/lcd.ts index d06be8e36..d355f979b 100644 --- a/src/lib/services/proposal/lcd.ts +++ b/src/lib/services/proposal/lcd.ts @@ -89,4 +89,6 @@ export const getProposalVotesInfoLcd = async ( `${endpoint}/cosmos/gov/v1/proposals/${encodeURIComponent(id)}/tally` ), axios.get(`${endpoint}/cosmos/staking/v1beta1/pool`), - ]).then((data) => parseWithError(zProposalVotesInfoResponseLcd, data)); + ]).then(([tallyRes, poolRes]) => + parseWithError(zProposalVotesInfoResponseLcd, [tallyRes.data, poolRes.data]) + ); diff --git a/src/lib/services/types/proposal.ts b/src/lib/services/types/proposal.ts index d4959ca4d..82d8890dd 100644 --- a/src/lib/services/types/proposal.ts +++ b/src/lib/services/types/proposal.ts @@ -147,10 +147,12 @@ export const zProposalVotesInfoResponse = z export const zProposalVotesInfoResponseLcd = z .tuple([ z.object({ - yes_count: zBig, - abstain_count: zBig, - no_count: zBig, - no_with_veto_count: zBig, + tally: z.object({ + yes_count: zBig, + abstain_count: zBig, + no_count: zBig, + no_with_veto_count: zBig, + }), }), z.object({ pool: z.object({ @@ -160,10 +162,10 @@ export const zProposalVotesInfoResponseLcd = z }), ]) .transform(([tally, pool]) => ({ - yes: tally.yes_count, - abstain: tally.abstain_count, - no: tally.no_count, - noWithVeto: tally.no_with_veto_count, + yes: tally.tally.yes_count, + abstain: tally.tally.abstain_count, + no: tally.tally.no_count, + noWithVeto: tally.tally.no_with_veto_count, totalVotingPower: pool.pool.bonded_tokens, })); @@ -232,8 +234,8 @@ export const zProposalDataResponseLcd = z submit_time: zUtcDate, deposit_end_time: zUtcDate, total_deposit: zCoin.array(), - voting_start_time: zUtcDate, - voting_end_time: zUtcDate, + voting_start_time: zUtcDate.nullable(), + voting_end_time: zUtcDate.nullable(), metadata: z.string(), title: z.string(), summary: z.string(),