Skip to content
Merged

Total #556

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
16 changes: 15 additions & 1 deletion frontend/src/components/CreateProposalModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
getRequiredQuorumWeight,
getWeightCapPct,
} from "../lib/contract";
import { displayToStroops } from "../lib/soroban";
import { displayToStroops, formatWeightPercent } from "../lib/soroban";
import { VotingPowerPreview } from "./VotingPowerPreview";
import { StrKey } from "@stellar/stellar-sdk";
import type { ProposalKind } from "../types/accord";
Expand Down Expand Up @@ -976,6 +976,8 @@ export function CreateProposalModal({ walletAddress, onClose, onSubmitted, trigg

function renderPreview() {
const dl = formatDeadlineDate(deadline);
const quorumPercentage = totalWeight > 0 ? formatWeightPercent(quorumWeight, totalWeight) : "—";

return (
<>
<div className="space-y-3">
Expand Down Expand Up @@ -1047,6 +1049,18 @@ export function CreateProposalModal({ walletAddress, onClose, onSubmitted, trigg
<dt className="text-xs text-zinc-500">Deadline</dt>
<dd className="mt-1 text-sm text-zinc-200">{dl}</dd>
</div>
<div>
<dt className="text-xs text-zinc-500">Required Quorum</dt>
<dd className="mt-1 text-sm text-zinc-200">
{quorumWeight > 0 ? (
<>
<span className="font-mono">{quorumWeight}</span> weight ({quorumPercentage} of total voting power)
</>
) : (
<span className="text-zinc-400">Not available</span>
)}
</dd>
</div>
</dl>
</div>

Expand Down
5 changes: 5 additions & 0 deletions frontend/src/hooks/useContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ export function useContract(walletAddress: string | null): ContractState {
value: `${thresh} of ${totalWeight}`,
sub: "voting weight required",
},
{
label: "Total Voting Power",
value: String(totalWeight),
sub: `${ownerAddrs.length} ${ownerAddrs.length === 1 ? "owner" : "owners"}`,
},
{ label: "Active", value: String(active), sub: "proposals" },
{ label: "Total", value: String(total), sub: "proposals created" },
{ label: "Executed", value: String(executed), sub: "all time" },
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/pages/HistoryPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ export function HistoryPage({
const sections: string[] = [];

if (executed.length > 0) {
const headers = ["ID", "Amount", "Token", "Recipient", "Date"];
const headers = ["ID", "Amount", "Token", "Recipient", "Date", "Approval Weight", "Quorum Weight"];
const rows = executed.map(
(p) => `${p.id},"${p.amount}","${p.token}","${p.to}","${p.executedAt || p.deadline}"`
(p) => `${p.id},"${p.amount}","${p.token}","${p.to}","${p.executedAt || p.deadline}","${p.approvalWeight ?? 0}","${p.quorumWeight ?? 0}"`
);
sections.push([headers.join(","), ...rows].join("\n"));
}
Expand Down