From 7cf9adc6f109831339a0309f6d54648d1dd82f57 Mon Sep 17 00:00:00 2001 From: QSchlegel Date: Sat, 13 Jun 2026 13:08:50 +0200 Subject: [PATCH] =?UTF-8?q?feat(governance):=20clearer=20ballot=20voting?= =?UTF-8?q?=20UX=20=E2=80=94=20segmented=20vote=20+=20one=20entry=20per=20?= =?UTF-8?q?action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The per-proposal voting controls were confusing: a raw OS with a shadcn segmented Yes/No/Abstain control (color-coded selected state, icons). Guard `(v) => v && setVoteKind(v)` so a re-click can't blank the vote read into the tx. - One clear primary: the Vote button now states the choice ("Vote Yes", "Vote Yes (Proxy)") and uses the themed primary style. - One ballot entry: the icon-only ballot button becomes a labeled "Add to ballot" / "In N ballots" secondary, with a tooltip distinguishing the two flows (vote on-chain now vs collect for co-signers). - Remove the now-duplicate green "Add to Ballot" buttons (mobile + desktop) in proposals.tsx; keep the View links. vote()/voteProxy() bodies, proxy path, keepRelevant, metadata label 674, the closed-vote Lock state, and all toasts are unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../governance/proposal/voteButtton.tsx | 119 +++++++++--------- .../pages/wallet/governance/proposals.tsx | 26 +--- 2 files changed, 62 insertions(+), 83 deletions(-) diff --git a/src/components/pages/wallet/governance/proposal/voteButtton.tsx b/src/components/pages/wallet/governance/proposal/voteButtton.tsx index d2895043..717a7182 100644 --- a/src/components/pages/wallet/governance/proposal/voteButtton.tsx +++ b/src/components/pages/wallet/governance/proposal/voteButtton.tsx @@ -7,14 +7,7 @@ import { keepRelevant, Quantity, Unit, UTxO } from "@meshsdk/core"; import { Wallet } from "@/types/wallet"; import { useWalletsStore } from "@/lib/zustand/wallets"; import { useToast } from "@/hooks/use-toast"; -import { - Select, - SelectContent, - SelectGroup, - SelectItem, - SelectTrigger, - SelectValue, -} from "@/components/ui/select"; +import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group"; import { ToastAction } from "@/components/ui/toast"; import useMultisigWallet from "@/hooks/useMultisigWallet"; import { api } from "@/utils/api"; @@ -32,7 +25,7 @@ import { } from "@/components/ui/dialog"; import type { BallotType } from "../ballot/ballot"; import { useBallotModal } from "@/hooks/useBallotModal"; -import { Plus, Info, Lock, FileText, CheckCircle2, Vote } from "lucide-react"; +import { Plus, Info, Lock, FileText, CheckCircle2, XCircle, MinusCircle, Vote } from "lucide-react"; import { ProposalDetails } from "@/types/governance"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"; import { getProposalStatus, parseProposalId } from "@/lib/governance"; @@ -375,23 +368,38 @@ export default function VoteButton({ ) : ( // Active proposal state <> - + + Yes + + + No + + + Abstain + + {isProxyEnabled && proxies && proxies.length > 0 && !selectedProxyId && (
@@ -412,50 +420,43 @@ export default function VoteButton({ )} -
- - - - - - -

{isOnAnyBallot ? `Manage in ${ballotCount} ballot${ballotCount !== 1 ? 's' : ''}` : "Add to Ballot"}

-
-
-
-
+ + + + + + +

+ Vote casts your DRep vote on-chain now. Add to ballot collects + this proposal so co-signers can vote together. +

+
+
+
); } diff --git a/src/components/pages/wallet/governance/proposals.tsx b/src/components/pages/wallet/governance/proposals.tsx index 5a1631df..81604ff4 100644 --- a/src/components/pages/wallet/governance/proposals.tsx +++ b/src/components/pages/wallet/governance/proposals.tsx @@ -31,7 +31,7 @@ import VoteButton from "./proposal/voteButtton"; import { UTxO } from "@meshsdk/core"; import useMultisigWallet from "@/hooks/useMultisigWallet"; import { Badge } from "@/components/ui/badge"; -import { CheckCircle2, XCircle, MinusCircle, ChevronDown, ChevronUp, Clock, Calendar, Coins, Hash, FileText, Plus } from "lucide-react"; +import { CheckCircle2, XCircle, MinusCircle, ChevronDown, ChevronUp, Clock, Calendar, Coins, Hash, FileText } from "lucide-react"; import { useProxy } from "@/hooks/useProxy"; import { useProxyData } from "@/lib/zustand/proxy"; import { useBallotModal } from "@/hooks/useBallotModal"; @@ -844,17 +844,6 @@ export default function AllProposals({ appWallet, utxos, selectedBallotId, onSel View Full Details - )}
- -