diff --git a/apps/ui/src/components/ProposalVote.vue b/apps/ui/src/components/ProposalVote.vue
index 370652eb6..3792beb61 100644
--- a/apps/ui/src/components/ProposalVote.vue
+++ b/apps/ui/src/components/ProposalVote.vue
@@ -1,10 +1,19 @@
+
+
+
+
+
+ Encrypted choice
+
+
+
+
+
+
You have already voted for this proposal
-
-
- You have already voted for this proposal
-
Voting for this proposal hasn't started yet. Voting will start
{{ _t(start) }}.
diff --git a/apps/ui/src/components/ProposalVoteApproval.vue b/apps/ui/src/components/ProposalVoteApproval.vue
index c8bb54e3b..aebeebbcd 100644
--- a/apps/ui/src/components/ProposalVoteApproval.vue
+++ b/apps/ui/src/components/ProposalVoteApproval.vue
@@ -1,16 +1,21 @@
diff --git a/apps/ui/src/components/ProposalVoteSingleChoice.vue b/apps/ui/src/components/ProposalVoteSingleChoice.vue
index dc8f211ff..a6e10d93c 100644
--- a/apps/ui/src/components/ProposalVoteSingleChoice.vue
+++ b/apps/ui/src/components/ProposalVoteSingleChoice.vue
@@ -1,16 +1,19 @@
diff --git a/apps/ui/src/components/ProposalVoteWeighted.vue b/apps/ui/src/components/ProposalVoteWeighted.vue
index 066f68ff1..b418168c8 100644
--- a/apps/ui/src/components/ProposalVoteWeighted.vue
+++ b/apps/ui/src/components/ProposalVoteWeighted.vue
@@ -2,16 +2,21 @@
import { _p, getChoiceWeight } from '@/helpers/utils';
import { Choice, Proposal } from '@/types';
-defineProps<{
+type WeightedChoice = Record;
+
+const props = defineProps<{
sendingType: Choice | null;
proposal: Proposal;
+ defaultChoice?: Choice;
}>();
defineEmits<{
(e: 'vote', value: Choice);
}>();
-const selectedChoices = ref>({});
+const selectedChoices = ref(
+ (!props.proposal.privacy && (props.defaultChoice as WeightedChoice)) || {}
+);
function increaseChoice(index: number) {
selectedChoices.value[index] ||= 0;
diff --git a/apps/ui/src/helpers/utils.ts b/apps/ui/src/helpers/utils.ts
index 4f67dd979..dd5313eb6 100644
--- a/apps/ui/src/helpers/utils.ts
+++ b/apps/ui/src/helpers/utils.ts
@@ -484,7 +484,10 @@ export function getChoiceText(
}
if (Array.isArray(choice)) {
- return choice.map(index => availableChoices[index - 1]).join(', ');
+ return (
+ choice.map(index => availableChoices[index - 1]).join(', ') ||
+ 'Blank vote'
+ );
}
const total = Object.values(choice).reduce((acc, weight) => acc + weight, 0);
diff --git a/apps/ui/src/views/Proposal.vue b/apps/ui/src/views/Proposal.vue
index fa8f44507..baac6ccee 100644
--- a/apps/ui/src/views/Proposal.vue
+++ b/apps/ui/src/views/Proposal.vue
@@ -12,7 +12,7 @@ const { resolved, address: spaceAddress, networkId } = useResolve(param);
const { setTitle } = useTitle();
const proposalsStore = useProposalsStore();
const { web3 } = useWeb3();
-const { loadVotes } = useAccount();
+const { loadVotes, votes } = useAccount();
const { vote } = useActions();
const sendingType = ref(null);
@@ -20,6 +20,7 @@ const votingPowers = ref([] as VotingPower[]);
const votingPowerStatus = ref('loading');
const votingPowerDetailsError =
ref(null);
+const editMode = ref(false);
const network = computed(() =>
networkId.value ? getNetwork(networkId.value) : null
@@ -53,6 +54,12 @@ const votingPowerDecimals = computed(() => {
);
});
+const currentVote = computed(
+ () =>
+ proposal.value &&
+ votes.value[`${proposal.value.network}:${proposal.value.id}`]
+);
+
async function getVotingPower() {
if (!network.value) return;
@@ -104,9 +111,11 @@ async function handleVoteClick(choice: Choice) {
id.value,
networkId.value!
);
+ await loadVotes(proposal.value.network, [proposal.value.space.id]);
}
} finally {
sendingType.value = null;
+ editMode.value = false;
}
}
@@ -196,12 +205,22 @@ watchEffect(() => {
['pending', 'active'].includes(proposal.state)
"
>
-
-
- Cast your vote
+
+
+
+ Edit your vote
+
+
+
+ Your vote
+
+
+
+ Cast your vote
+
{
-
+
{
v-else-if="proposal.type === 'single-choice'"
:proposal="proposal"
:sending-type="sendingType"
+ :default-choice="currentVote?.choice"
@vote="handleVoteClick"
/>