Development Update #5: Comments, Loading States and Refresh Feeds

View this thread on: d.buzz | hive.blog | peakd.com | ecency.com
·@jrawsthorne·
0.000 HBD
Development Update #5: Comments, Loading States and Refresh Feeds
![Banner.jpg](https://ipfs.busy.org/ipfs/QmQjVGa4WyPaVptfeoZaAXVCkyQv2AJee7BUcoNSM2RczY)

#### Repository 
https://github.com/jrawsthorne/review.app 

### New Features 

#### #1 [Comments (Main New Feature) ](https://github.com/jrawsthorne/review.app/commit/d9c26d92adaab9e3b2ca943bdc0088c08bb65bf9)

![image.png](https://ipfs.busy.org/ipfs/QmRLGAHtoZMQzPrxUZGT4cw5LVY58k8iNX2EHeL7jPCwc4)

The implementation of the comment system I decided to go with is quite different to steemit.com and busy.org. The blockchain API has some limitations when it comes to retrieving replies to a post. There is currently no way to just fetch all the replies to a post unless you use the ```get_state``` function which returns lots of unnecessary information like the current block, witness schedule and asset prices. In the future the aim is to take this function offchain with [Hivemind](https://github.com/steemit/hivemind) but it's currently in alpha.

While experimenting I found that the ```get_content_replies``` method only returns the direct children to a post. In order to fetch all the replies there would have to be a lot of recursive API calls so I decided to have a button that would load further replies like can be seen on YouTube.

<center>![image.png](https://ipfs.busy.org/ipfs/QmV8osQhWvLCuq4NjbgMbHDY5WcQkW8sR3MCE4dxK3Jayb)
<sub>YouTube implementation</sub>
</center>

<center>
![image.png](https://ipfs.busy.org/ipfs/QmQD6AVdeses5ZcpJga1kgqyFEZhPfDaqY7HRSXQqWJkz4)
<sub>My implementation</sub>
</center>

This way the extra comments only need to be loaded if the user wants to see them.

However I then found that for some reason ```get_content_replies``` doesn't return all the data for the post unlike ```get_content```, specifically the active votes. This is needed for the upvote system so the method that fetches the replies also fetches the votes for each reply.

![carbon (11).png](https://ipfs.busy.org/ipfs/QmVtTRxvFNcVLxVWnVScpB7WyuSbTcd2TVb8VHTotQzTwY)

When logged in a user can also reply to comments.

![image.png](https://ipfs.busy.org/ipfs/QmZgBaH5JMHsJiH9F6jmg19irq5T9uoagRHppeQzBDC59x)

### #2 [Loading states](https://github.com/jrawsthorne/review.app/commit/0b1620687ba44a104b5dd5b48623528eabcdf63f)

To improve the design (in my opinion) and prevent elements from moving around too much on the page I added loading states for most of the components. On the post page when the post and metadata is loading the general wireframe structure is displayed. This also informs the user that content is loading.

![image.png](https://ipfs.busy.org/ipfs/QmePg9cGrEYrqvBFrwRMFKX67gZroDQ4fS77a4VA8aVTnr)

### #3 [Refresh Feeds](https://github.com/jrawsthorne/review.app/commit/7f738328ca2ca993bf43d5c2d4d0ac4d3bffbeb4)

![image.png](https://ipfs.busy.org/ipfs/QmfE1ZiSm33zUmSENC1ziuqeWDU9UQysafsig8wFWTGBCV)


Currently, if a user wants to check a feed for new content they have to refresh the whole page. This feature adds a refresh button that checks if there are any new posts to show in that particular feed.

In the feed reducer I check if the reload property is present. If it is I reset the feed temporarily to a loading state again. This sets the post list to an empty array so that when new posts are fetched they are then displayed in the correct order.

![carbon (12).png](https://ipfs.busy.org/ipfs/QmUmtuz3Rmq5HjbX2BnV9skG5kxrExEQBH8pEtossRtwfQ)


### Roadmap 
- Add search to mobile view
- Follow users 
- Re-brand with dmtv name, logo and colours
👍 , , , , , , , , , , , , , , , , , ,