Contest Hero Development Update (Create contests with comment entries, Feed Sorting, FAQ, Comment Component)

in #utopian-io6 years ago

Repository

https://github.com/tobias-g1/contest-hero

Contest Hero is a new app built on top of the Steem Blockchain that allows you to easily create, manage, find and enter great contests on the Steem blockchain. The following is an update surrounding the development of Contest Hero. If you want to take a look at the site, you can use the link below:

https://contesthero.io

Here's an overview of the changes in this update:

New Features

  1. Ability to create contests with different entry methods (comments or posts)
  2. Additional parameters in GET contests request to allow sorting
  3. Ability to sort feed by newest/oldest contests
  4. An indication of success or failure via a toast notification
  5. Frequently asked question area

Improvements

  1. Adjustments to feed layout in line with the ability to sort feed
  2. Added tooltips create a contest and edit contest page
  3. Move comments into own component
  4. Minor CSS improvements throughout
  5. Remove Dist from Repo & add to .gitignore

Bug Fixes

  1. Resolved issue with <pre> not wrapping in the parent container
  2. Resolved issue with image styling

The changes mentioned above relate to the following pull request:

https://github.com/tobias-g1/contest-hero/pull/84

Ability to create contests with different entry methods (comments or posts)

The most important feature in this was release was the addition of the ability to create contests with differing entry methods. Previously the only way for a user to enter a contest was to make a full post on the blockchain. I have now added the ability to make entries via comments. In order to access this feature, a contest creator is able to select their entry method on the contest create and edit pages. Based on the contest creators selection a contestant will see an indication of the entry method on the enter contest button shown underneath the contest post. This can be seen in the image below:

screely-1540648500888.png

This feature was so important because a lot of giveway style contest don't require a full post and a comment is enough, with the addition of the feature I believe it will aid the creation of 'casual' contests.

The following shows how this is configured in the create contest page:

screely-1540648566899.png

In order to implement this feature there were two main changes, firstly I needed to adjust the create contest page with the ability to create both comments and normal post. This was a simple change by pinning the user's selection against the following code:

let parentAuthor

let parentPermlink

let entryMethod

switch (this.contestData.entry_method) {

case 'post':

parentAuthor = ''

parentPermlink = this.finalTags[0]

break

case 'comment':

parentAuthor = this.contestAuthor

parentPermlink = this.contestPermlink

break

}

As a comment is dictated based on whether or not a parent author and permalink is provided all I needed to do was take the value of the user's selected entry method and based on whether or not it was a comment or post, set the parentAuthor and parentPermlink as the contestAuthor & contestPermlink. Based on the users selection I also set the contest entry method in the DB to allow other pages to read this.

Following this, I needed to make an adjustment to the view entry page to load the comments in the same way it would a standard post. In order to this, I created a new method within my dsteem.js mixin as follows:

getSingleComment: function (author, permlink) {

return client.database.getDiscussions('comments', {

tag: author,

start: permlink,

start_author: author,

limit: 1

})

From here I would then call this method based on the entry method associated with the contest upon loading of an entry.

The above was completed in the following commit:

https://github.com/tobias-g1/contest-hero/pull/84/commits/4a3a413e9374a575680bec0c97abea946db12968

Frequently asked question area

screely-1540648627102.png

With the hope to create an easy to use and valuable experience, I created a quick frequently asked questions page that will allow a user to find some useful information about Contest Hero.

The above was completed in the following commit:

https://github.com/tobias-g1/contest-hero/pull/84/commits/c71ecbf9d356d881f488fb91588870ed350562f9

Indication of success or failure via toast notification

screely-1540648739250.png

Previously there was only limited feedback as to whether or not the action and user carried out was successful or not. In order to aid this experience, I did some work to handle the errors on the calls to the database in a more consistent way, as well as firing a notification upon success or failure. An example success message can be seen here:

this.$notify({ title:  'Success', message:  'Your contest has been created', type:  'success'  })

The above was completed in the following commit:

https://github.com/tobias-g1/contest-hero/pull/84/commits/367339d723196b8f1655635d067f189eadb33ba8

Move comments into own component

In previous commits I had created a duplication in relation the comments sections shown on both on the contest and entries page, in order to help improve the maintenance of the code going forward I moved this into a single component which can be found here:

https://github.com/tobias-g1/contest-hero/blob/master/client/src/components/comment-panel/comment-panel.vue

Now both the entries and the contest pages use the same component and simply passes in the parent post and the comments will be gathered within the component. The following shows an example of how this component is referenced in these pages:

<commentpanel  :post="post"/>

The above was completed in the following commit:

https://github.com/tobias-g1/contest-hero/pull/84/commits/d62538041ff93e36b379b61aeb96dac312bcce15

Ability to sort feed by newest/oldest contests

screely-1540648291114.png

Finally, another welcome addition to the site is the ability to sort the contest feed by newest/oldest contests. This will provide the basis for more detailed filtering in the coming months and will provide benefit to the users when more contests are created.

In order to complete this I needed to make a change to contests controller and routes to allow a sort method to be passed into the request, the following shows an example of the new contest route:

router.get('/all/:sortby', contest_controller.get_contests);

Based on the parameter passed into :sortby it will then sorted the results by either newest or oldest based on the _id key from the results. This can be seen here:

exports.get_contests  =  function  (req,  res)  {

  

let  sortmethod;

  

switch (req.params.sortby) {

case  'oldest':

sortmethod  =  {

_id:  1

}

break;

case  'newest':

sortmethod  =  {

_id:  -1

}

break;

}

  

console.log(sortmethod)

  

Contest.find({},  function  (error,  contests)  {

if (error) {

console.error(error);

}

res.send({

contests:  contests

})

}).sort(sortmethod)

}

The above was completed in the following commit:

https://github.com/tobias-g1/contest-hero/pull/84/commits/380c70f7547149b7334e8520d55fd6d8a8679585

What's next?

Although I previously planned to create these in this release, the next items I plan to work on is:

  1. User Profile with entries and contests
  2. Ability to edit entries

I plan to open Contest Hero up to the bug-hunting category in the coming days, so expect that a few bugs will need to be fixed based on the contributor's findings. With that said, I believe the site is nearly ready to use and plan to work on getting Contest creators involved with the site in the coming week.

GitHub Account

A link to my GitHub can be found here:

https://github.com/tobias-g1/

Sort:  

Thanks for the contribution, @tobias-g! Absolutely amazing contribution once again! The added feature are really cool, especially the ability to create a contest as a comment is very interesting.

I don't really have much feedback to give about the code itself, as that looks really great to me. Keep up the great work and I'll definitely be using it myself sometime in the future!


Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Thank you for your review, @amosbastian! Keep up the good work!

Congratulations! Your post has been selected as a daily Steemit truffle! It is listed on rank 19 of all contributions awarded today. You can find the TOP DAILY TRUFFLE PICKS HERE.

I upvoted your contribution because to my mind your post is at least 12 SBD worth and should receive 155 votes. It's now up to the lovely Steemit community to make this come true.

I am TrufflePig, an Artificial Intelligence Bot that helps minnows and content curators using Machine Learning. If you are curious how I select content, you can find an explanation here!

Have a nice day and sincerely yours,
trufflepig
TrufflePig

Congratulations! This post has been upvoted from the communal account, @minnowsupport, by tobias-g from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, someguy123, neoxian, followbtcnews, and netuoso. The goal is to help Steemit grow by supporting Minnows. Please find us at the Peace, Abundance, and Liberty Network (PALnet) Discord Channel. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.

If you would like to delegate to the Minnow Support Project you can do so by clicking on the following links: 50SP, 100SP, 250SP, 500SP, 1000SP, 5000SP.
Be sure to leave at least 50SP undelegated on your account.

Hi @tobias-g!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server

Hi, @tobias-g!

You just got a 5.81% upvote from SteemPlus!
To get higher upvotes, earn more SteemPlus Points (SPP). On your Steemit wallet, check your SPP balance and click on "How to earn SPP?" to find out all the ways to earn.
If you're not using SteemPlus yet, please check our last posts in here to see the many ways in which SteemPlus can improve your Steem experience on Steemit and Busy.

Hey, @tobias-g!

Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Coin Marketplace

STEEM 0.29
TRX 0.26
JST 0.039
BTC 94958.92
ETH 3396.60
USDT 1.00
SBD 3.40