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

Added a table view of wants #41

Merged
merged 6 commits into from
Mar 30, 2020
Merged

Added a table view of wants #41

merged 6 commits into from
Mar 30, 2020

Conversation

gregwhitworth
Copy link
Contributor

@gregwhitworth gregwhitworth commented Mar 30, 2020

Ok, so this is an initial implementation of a table view for the /dashboard that will allow us to view more metadata. Currently it is pretty simple as it solely shows the title, votes and tags. That said I have begun refactoring the "querying" to allow us to add more columns. Once I land this PR I'll open individual issues to discuss those a bit further to ensure that they align with the goal/charter of WWW. Here is a quick rundown of the changes and justifications.

  • New /dashboard: I added a new directory under pages that begins to put dashboard sections into one sub directory. The index is the current dashboard that is already live with the addition of dashboard-table.
  • Dashboard/index breaking change: The current dashboard currently shows the top 3 wants per tag by both vote and whether they won at an event or not. This makes an assumption that anyone looking at this weighs the wins as more important than that of the individual votes through social media sharing, especially since it selects only the top 3.
  • Refactor of want queries: Much of what I wanted to do is actually somewhat redundant to the main page but I didn't want to limit it to the top 3 of each tag. As such I began to break apart common queries that returned specific collections that can be consumed by other queries that simply want to build off of rather than duplicating them directly.
    • addCollection('wantsObject': There is currently a collection wants but for some reason it returns the following bool item.inputPath.indexOf("wants/") > -1. I didn't investigate why this is but I desired to deal directly with the wants themselves. As such I created this query that is similar but returns the want objects themselves in a collection to be worked with later.
    • addCollection('wantsSortedByVotes': As noted above, there is a query called topWants but this combined both votes and winning at an event. I desired to have the wants sorted by votes and as such pulled out the sorting and voting from that query into a general collection. Within that query I also add the count of votes to <want>.data.votes so it can be leveraged later without having to do the lookup in webmentions or creation of ID from url, etc.
    • addCollection('topWantsPerTag': This was previously named topWants. As noted above I removed the winners from being included and then leverage the collection from wantsSortedByVotes.
    • [IN PROGRESS] addCollection('getWinners': I pulled out the winning logic from the original query but we do still want to show this. For some reason that I can't explain yet uncommenting that collection throws a template error (it has to do with the .push() method on the winners array. If you place this same code within the topWantsPerTag it works fine, so I'm completely confused as to what's happening but I'm tired and hoping a second pair of eyes can help.

Open Questions

  1. Once the table page is up and I've added the column of winners I think it should replace the current dashboard as it will provide all of the information for people to leverage and use their own weight for winning or not.

Like normal, any feedback is welcome, sorry for the long write up but I wanted to let you all understand that there was thought behind the query refactoring. I considered going further and just building a wants object that had all of the metadata of each want whether it was a winner and its votes but didn't want to do that without discussing it first.

@netlify
Copy link

netlify bot commented Mar 30, 2020

Deploy request for webwewant accepted.

Accepted with commit e5300e0

https://app.netlify.com/sites/webwewant/deploys/5e818af703e6380008788644

Copy link
Member

@aarongustafson aarongustafson left a comment

Choose a reason for hiding this comment

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

I’m not sure I follow every change you made, but I think it’s good and nothing looks broken to me, so I will go ahead and approve.

@aarongustafson aarongustafson merged commit 48d206f into WebWeWant:master Mar 30, 2020
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.

2 participants