[KnackSteem] - Beneficiaries, redirection and bugs

@luschn · 2018-08-07 10:52 · utopian-io

This PR adds 15% beneficiaries for @knacksteem.org , a http to https redirection and some general improvements listed below. A few tiny bugs have been fixed too, but they are way too small for an extra contribution :)

Repository & Pull Requests

https://github.com/knacksteem/knacksteem.org https://github.com/knacksteem/knacksteem.org/pull/15 https://github.com/knacksteem/knacksteem.org/pull/16 https://github.com/knacksteem/knacksteem.org/pull/18 https://github.com/knacksteem/knacksteem.org/pull/20 https://github.com/knacksteem/knacksteem.org/pull/23

About knacksteem.org

"Do you have any talent? If yes! then KnackSteem is for you." "Rewards people with talents, it can be any talent, anything you know how to do best is highly welcome on the platform."

Technology Stack

  • JavaScript ES6+ with Babel
  • React + Redux
  • Ant Design

Main Changes / New Features

  • Beneficiaries to post/edit actions - 15% for @knacksteem.org.
  • http > https redirection for the express server.
  • New "Reserved" route in addition to the "Pending" articles. "Reserved" means "Supvervisors will take a look later". Both are using the same "Review" route.
  • Cover image sizing bugfix - it was not contained in the article list item.
  • POST requests did not work anymore (Approve, Reject, New Contribution, ...) because of a missing dollar sign in the template string of the POST url.
  • The scroll issue with articles/users happens because of 404 server error code if there are no more entries. The issue needs to be solved server side, so i removed the temporary workaround.
  • The API call to get information about the currently logged in user includes the Access Token now.
  • Double Scrollbars were visible on longer pages. The last PR includes a bugfix for that, setting a minimum height for the content and removing unneccessary Ant Design overrides in CSS.
  • The filter routing in the Frontend code has been removed and searching only happens server side now - for all routes.

Screenshots

Before the cover image fix

image_bugfix_1.jpg

After the cover image fix

image_bugfix_2.jpg

New pending/reserved routes

pending.jpg

Details

Most changes should be self explanatory, here are additional details about some specific tasks:

Beneficiaries

15% of the author reward goes to @knacksteem.org, the code to post new articles is a bit more complex now. The extensions array includes the settings for beneficiaries:

//post with beneficiaries
const operations = [
  ['comment',
   {
     parent_author: '',
     parent_permlink: tags[0],
     author: store.user.username,
     permlink: newPermLink,
     title: title,
     body: body,
     json_metadata: JSON.stringify({
       tags: tags
     })
   }
  ],
  ['comment_options', {
    author: store.user.username,
    permlink: newPermLink,
    max_accepted_payout: '100000.000 SBD',
    percent_steem_dollars: 50,
    allow_votes: true,
    allow_curation_rewards: true,
    extensions: [
      [0, {
        beneficiaries: [{account: 'knacksteem.org', weight: 1500}]
      }]
    ]
  }]
];

await SteemConnect.broadcast(operations);

(actions/articles.js)

Side Note: In order to post articles with beneficiaries, you need to add the comment_options scope to your SteemConnect login.

http > https redirection

Automatic redirection is done with the express middleware express-http-to-https, excluding redirection on localhost:

app.use(redirectToHTTPS([/localhost:(\d{4})/], [], 301));

(server.js)

nginx would be a better solution for this (and for static resources) - So if someone wants to contribute...or i may just do it by myself later.

Cover image

The inline styles have been moved to CSS files, and the bug that leads to larger cover images is gone - see screenshots.

coverImage {
  width: 280px;
  float: left;
  margin-right: 20px;
}

.coverImage img {
  width: 100%;
  height: auto;
}

(components/ArticleListItem/index.css)

Roadmap

  • The possibility to upload images in the editor needs to be implemented.
  • There are some minor bugs, feel free to contact the @knacksteem.org team to help out with those.

How to contribute?

Talk to @knowledges (or me) :)


My GitHub Account: https://github.com/ateufel

#utopian-io #development #knacksteem #steemdev #steemapps
Payout: 0.000 HBD
Votes: 159
More interactions (upvote, reblog, reply) coming soon.