RadicalxChange / rxc-voice

An app for decentralized democratic governance.
https://voice.radicalxchange.org/
Other
42 stars 14 forks source link

Prevent proposals from shuffling when a new one is added #94

Closed alexrandaccio closed 2 years ago

alexrandaccio commented 2 years ago

Welcome!

Hi, this is a first-timers-only issue. This means we've worked to make it more legible to folks who either haven't contributed to our codebase before, or even folks who haven't contributed to open source before.

If that's you, we're interested in helping you take the first step and can answer questions and help you out as you do. Note that we're especially interested in contributions from people from groups underrepresented in free and open source software!

We know that the process of creating a pull request is the biggest barrier for new contributors. This issue is for you πŸ˜„

If you have contributed before, consider leaving this one for someone new, and looking through our general help wanted issues. Thanks!

πŸ€” What you will need to know.

Nothing. This issue is meant to welcome you to Open Source :) We are happy to walk you through the process.

Step by Step Guide

πŸ“‹ Solving the problem

Below is a "diff" showing in red (and a -) which lines to remove, and in green (and a +) which lines to add:

- 88      setProposals(data.proposals);
+ 88      const sortedProposals = data.proposals.sort((a: Proposal, b: Proposal) => {
+ 89        return a.id - b.id;
+ 90       });
+ 91      setProposals(sortedProposals);
  1. If you are familiar with the terminal or would like to learn to use it, here is a great tutorial on how to send a pull request using the terminal.

  2. You can also edit files directly in your browser and open a pull request from there.

Please keep us updated

πŸ’¬β° - We encourage contributors to be respectful to the community and provide an update within a week of claiming a first-timers-only issue. We're happy to keep it assigned to you as long as you need if you update us with a request for more time or help, but if we don't see any activity a week after you claim it we may reassign it to give someone else a chance. Thank you in advance!

If this happens to you, don't sweat it! Grab another open issue.

Is someone else already working on this?

πŸ”—- We encourage contributors to link to the original issue in their pull request so all users can easily see if someone's already started on it.

πŸ‘₯- If someone seems stuck, offer them some help! Otherwise, take a look at some other issues you can help with. Thanks!

What This Code Does

Context

In the RxC Voice web app, users can create "Events", where a group of people can make decisions by deliberating and voting. The person who created the event adds proposals for the group to vote on using a page called the "Event Manager".

The Problem

Currently, the order of the existing proposals shuffles every time the user adds a new proposal. The order should stay the same so as not to confuse the user. See the original post in issue #90

The Solution

In the solution provided above, we are sorting the proposals by their ID number each time they are loaded. This ensures that they stay in the order in which they were added.

πŸ€”β“ Questions?

Leave a comment below!

ChrisCoastal commented 2 years ago

Hello @alexrandaccio, would you assign me to this issue? Really appreciate you making an accessible first-timers issue for those of us learning. Thanks!

alexrandaccio commented 2 years ago

Done! Let me know if you have any questions @ChrisCoastal πŸ˜€

ChrisCoastal commented 2 years ago

Thanks @alexrandaccio. I've created a pull request for the changes. If there are any best practices or things I have missed your feedback is appreciated!

alexrandaccio commented 2 years ago

Congratulations on your first contribution @ChrisCoastal !! 🍾 πŸŽ†

If you're interested in learning more about this project and/or taking on more challenges, I hope you'll join us on Discord: https://discord.gg/ ZsKAFmgjYp

I'm always available to answer any questions you might have, help you get the project running locally on your computer, etc

ChrisCoastal commented 2 years ago

Thanks @alexrandaccio! I'd love to contribute and stay active with the project. I'll take a look through the other issues and see if there is something within my skill range. πŸ™

alexrandaccio commented 2 years ago

@ChrisCoastal FYI our next RxC Voice project open call is on Wednesday the 16th at 3pm EST. would love to meet you there if you can make it!

If you're interested, either join the Discord and DM me or just send me your email address and i'll invite you