-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for ranked choice voting for offchain spaces (#174)
* feat: add support for ranked choice voting for offchain spaces * chore: update changelog * fix(ui): UI update
- Loading branch information
Showing
9 changed files
with
78 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@snapshot-labs/sx": patch | ||
--- | ||
|
||
add ranked choice vote support for OffchainEthereumSig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<script setup lang="ts"> | ||
import Draggable from 'vuedraggable'; | ||
import { Choice, Proposal } from '@/types'; | ||
const props = defineProps<{ | ||
sendingType: Choice | null; | ||
proposal: Proposal; | ||
}>(); | ||
const emit = defineEmits<{ | ||
(e: 'vote', value: Choice); | ||
}>(); | ||
const selectedChoices = ref<number[]>(props.proposal.choices.map((_, i) => i + 1)); | ||
</script> | ||
|
||
<template> | ||
<div class="flex flex-col gap-3"> | ||
<Draggable | ||
v-model="selectedChoices" | ||
v-bind="{ animation: 200 }" | ||
handle=".handle" | ||
class="flex flex-col gap-2" | ||
item-key="id" | ||
> | ||
<template #item="{ element, index }"> | ||
<UiButton class="!h-[48px] text-left w-full flex items-center handle cursor-grab gap-2"> | ||
<IC-drag class="text-skin-text" /> | ||
|
||
<div class="grow truncate"> | ||
{{ proposal.choices[element - 1] }} | ||
</div> | ||
<div | ||
class="h-[18px] min-w-[18px] rounded-full leading-[18px] text-[13px] text-white bg-skin-border px-2 text-center inline-block" | ||
> | ||
#{{ index + 1 }} | ||
</div> | ||
</UiButton> | ||
</template> | ||
</Draggable> | ||
<UiButton | ||
primary | ||
class="!h-[48px] w-full" | ||
:loading="!!sendingType" | ||
@click="emit('vote', selectedChoices)" | ||
> | ||
Vote | ||
</UiButton> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters