-Repeating group to display the list of submissions
-Data Source: Search for Submissions (sorted by Votes)
-Icons (Up/Down Arrows)
-Text (Submission Title)
-Text, box checked to recognize link (Submission URL)
Last thing I need is the current vote score for each submission
This will be a text element with a simple calculation:
Current Cell's Submission's Upvotes:count - Current Cells' Submission's Downvoters:count
Now I'll be left with the vote count I'm looking for
To add new submissions I'll add a popup form
-New Submission (text element)
-Add a title (input element)
-Add URL (input element)
-X (icon)
-Submit (Button w/text + icon)
That should do it for UI elements
Time to build the workflows to make everything run
To start I'll just do a simple Show Popup workflow to get the submit screen to show
-When Group Button Add is clicked β Show Popup Submission
The workflow to add a new submission is simple
-When Group Button Add is clicked β Create a new Submission
Title = Input Add title value
URL = Input Add URL value
Then I'll reset inputs to clear the boxes
and hide the Popup box
To test it out I added one of my previous Sunday Projects
I put in a title and the URL for Landing Hype and it showed right up
With the submissions working I just need to add a way to vote
I'll focus on upvoting first
There are two conditions I need to account for:
-Current user hasn't upvoted yet
-Current user has upvoted
I can have it check using the Only when...
When the current user hasn't upvoted
-Make a change to a thing... Submission
-Thing to change... Current cell's Submission
-Upvoters add Current User
I can also calculate the total votes
This could be useful if I want the number without doing a calculation
Step 2
-make change to a thing... Submission
-Thing to change... Current cell's Submission
-Votes = The Submission's Upvotes: count - Submission's Downvoters: count
The second condition allows a user to remove their vote
When...contains Current User
-make a change to a thing... Current cell's Submission
-Upvotes remove Current User
Step 2 recalculate the vote
-Votes = The Submission's Upvotes: count - Submission's Downvoters: count
For downvote I'm just repeating the same steps
this time I'm changing the Downvoters field
For a better user experience I'm going to add some conditions to the icons
When a Current User adds Upvotes I'll make the icon orange
I'll also make it so the icon isn't clickable if it was already downvoted
Later I could add more workflows to allow instant switching of votes
Repeat it again for the downvote
That should do it for all the logic necessary
Now I'll try and upvote my post...
It worked!! ππ₯³πΎ
Now I have a fully functioning post vote page like Reddit
Hopefully you learned something new
-Please RT the first post and tag someone that might find this useful!
-Follow me if you want to see more updates and projects like this
If you liked this check out some of my other Sunday projects: