Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: always show voting type selection in Editor #512

Merged
merged 17 commits into from
Jul 30, 2024

Conversation

wa0x6e
Copy link
Contributor

@wa0x6e wa0x6e commented Jul 20, 2024

Summary

Closes: #509 #516

Summary:

  • feat(ui): always show voting type selection in proposal editor.
  • bug: voting type settings set at space being ignored

This PR will resolves #509 by:

  • Always showing the voting type selection on the proposal creation page, even if there's only one choice (in which case, the voting type selection form will be disabled)

This PR wil resolves #516 by:

  • Add a new voting_types (VoteType[]) property to Space, which will hold the whitelist of voting type for the given space. Offchain will get the list from the graphql results, whereas onchains's one will be set from a constant
  • Edit the Editor to use the dynamic list of votingTypes from the space => Most of the changed files are from this update, as creating a draft is now an async task, since it has to load the vote type from the space settings

How to test

  1. Go to a proposal creation page on onchain space
  2. It should show the voting type selector on the right sidebar, locked to Basic Choice.
  3. Go to http://localhost:8080/#/s:ens.eth/create
  4. You can choose from a list of voting type, with Single Choice being the default selection
  5. Go to http://localhost:8080/#/s:safe.eth/create
  6. The voting type selection should be locked to Single Choice, as it's the type set by the space
  7. Draft should be created only if there's a change in the form

@wa0x6e wa0x6e requested a review from bonustrack July 20, 2024 07:44
@bonustrack
Copy link
Member

On the space "fabien.eth" I've enforced voting type to be "basic" from the space settings but I still can select a different voting type in the UI. (Actually this issue is not specific to this PR).

@wa0x6e wa0x6e marked this pull request as draft July 21, 2024 12:46
@wa0x6e
Copy link
Contributor Author

wa0x6e commented Jul 21, 2024

Going back to draft, to include fix for #516

@wa0x6e wa0x6e marked this pull request as ready for review July 22, 2024 03:10
@wa0x6e
Copy link
Contributor Author

wa0x6e commented Jul 22, 2024

On the space "fabien.eth" I've enforced voting type to be "basic" from the space settings but I still can select a different voting type in the UI. (Actually this issue is not specific to this PR).

Also added in this PR

@wa0x6e wa0x6e requested a review from Sekhmet July 25, 2024 09:25
Copy link
Member

@Sekhmet Sekhmet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only small comments, most of which should be resolved by rebase.

After that it's good to go for me.

@@ -34,11 +44,17 @@ function handleVoteTypeSelected(type: VoteType) {
<h4 class="eyebrow mb-2.5">Voting type</h4>
<button
type="button"
class="border rounded-xl py-2.5 px-3 flex gap-3 text-left relative border-skin-content w-full"
@click="modalOpen = true"
class="border rounded-xl py-2.5 px-3 flex text-left relative border-skin-content w-full"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's disable this button this way it's not focusable and more accessible. Then we don't need to check hasMultipleVotingType on handler.

apps/ui/src/components/Modal/Drafts.vue Outdated Show resolved Hide resolved
apps/ui/src/components/Ui/Modal.vue Outdated Show resolved Hide resolved
Copy link
Member

@Sekhmet Sekhmet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK

@Sekhmet Sekhmet merged commit 5817843 into master Jul 30, 2024
3 checks passed
@Sekhmet Sekhmet deleted the fix-always-show-voting-type-in-editor branch July 30, 2024 11:54
@wa0x6e wa0x6e restored the fix-always-show-voting-type-in-editor branch July 31, 2024 09:41
@wa0x6e wa0x6e deleted the fix-always-show-voting-type-in-editor branch July 31, 2024 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: proposal voting type whitelist not enforced for offchain spaces feat(editor): show voting type for SX
3 participants