Giter VIP home page Giter VIP logo

frontend's Introduction

SentiSocial Frontend

travis coverage license: MIT code style: standard

Originally created at The University of Toronto Scarborough's Hack the Valley 2017.

SentiSocial is a Twitter based trend analysis application. This repository contains the SentiSocial frontend, which queries the backend for information related to current trends, tweets, news and sentiment values related to each one.

The data is gathered by the SentiSocial backend, which can be found here.

Prerequisites

  • git
  • Node Boron

or

  • git
  • Docker

Production

git clone https://github.com/sentisocial/frontend
cd frontend
npm install
npm run build
npm start

Alternatively, with Docker

git clone https://github.com/sentisocial/frontend
cd frontend
docker-compose up

Development

Get SentiSocial locally for development

git clone https://github.com/sentisocial/frontend
cd frontend
npm test
npm run lint # auto lint
npm run dev # hot module replacement

It will be helpful if you are familiar with the following

Feel free to contribute, by testing, documentating, developing new features, or even changing how the site looks.

Don't forget to run the tests, lint, and build the project before committing

  • npm run build
  • npm test

frontend's People

Contributors

dennistismenko avatar gunshippenguin avatar omarchehab98 avatar suchahassle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

frontend's Issues

History

  • Handling browser back event.

  • We should also not delete the state of the AllTrends page so that users go back to where they were reading.

All Trends Page Layout

Small changes to the layout can improve the home page a lot.

Currently, content cards are chosen based on the trends from the bar graph. Starting from the left most, grabbing a couple of tweets and articles, progressing down the chart to the right most trend.

Before the start of an array of content specific to a trend, add:

  • div with style
display: flex;
text-align: center;
width: 100%;
float: left;

Wrap it around the h3 and a

  • Trend as an h3 with the style
display: inline-block;
flex-grow: 1;
font-size: 14px;
font-weight: bold;
margin-top: 20px;
margin-bottom: 10px;
  • a wrapped around an img arrow SVG pointing to the right

a has style

margin-top: 20px;
margin-bottom: 10px;

img has style

width: 16px;
  • h3 and a onClick changes the page to that trend's page.
  • a href should link to the trend https://senti.social/{trend}, do not worry about this now. We shouldn't care about links and URL rewriting while the backend is deleting trend data.

Overall the heading should look something like this

<div class="trend-heading" onClick={...}>
    <h3 class="trend-heading--text">Trend Name</h3>
    <a class="trend-heading--link">
        <img class="trend-heading--link-icon" src="more.svg"/>
    </a>
</div>

All Trends Page Layout
This is a mockup.

Helper Classes Testing

Write unit tests of the following tests

  • NetworkBus by dependency injection.
  • RequestChain set random timeouts for a chain of mocked requests. Expect oldest requests get released before newer requests.
  • InfiniteScroll
  • helper functions

Desktop Styling

  • TrendPage looks hideous on desktop

localhost_trend_chelsea

  • Add desktop specific navigation bar

  • Hide floating action button on desktop

image

About Page

What should it include? Let's discuss this here

Unit Testing

Unit test React components using enzyme

  • Card
  • ArticleCard
  • TweetCard
  • AllTrendsChart
  • TrendChart
  • GhostCard
  • CardLayout
  • Navigation
  • cutMerge

Bower

Bower has flat dependency tree making it supersede NPM for managing frontend web dependencies.
https://bower.io

  • Migrate frontend web dependencies from NPM to Bower
    npm install --save-dev bower

Website Metadata

  • title SentiSocial
  • link for favicon and apple touch icons
  • manifest.json for progressive web application
  • meta description
  • meta charset

Usabilty Enhancements

  • Site should return the user to where they were previously browsing upon clicking on a trend and then pressing the back button.

  • Chart scrolling (swiping on mobile)

Users with disabled tracking

Users who block tracking from within their browser will not be able to view tweets (cannot load embedded tweets).

FIX: User should see a card (or on all twitter cards) that their browser is blocking social media connections (therefore twitter embeds)

Chart Issues

  • Relative time is calculated incorrectly. Server sends unix timestamp in seconds.

  • Let's change the colors to match the logo. Green as #8DD97F and Red as #BC5757.

  • Set the range to have a minimum and maximum equal to absolute maximum value in the datasets.

  • Move all data processing outside the render function. We do not have to recompute most of the values we are computing every time we render. Handle processing in initialisation, or if the data is coming in through the network, process it after the response has been received.

  • Change .chart--title in the homepage from an h1 to and h2.

  • Add a description in a p tag which contains a brief introduction to what the chart is showing.

  • Add happy face svg onto the top left corner of the all trends chart.

  • Add sad face svg onto the bottom left corner of the all trends chart.
    OR

  • Add a legend with indicating what the graph means.

  • Time should not repeat itself on the specific trends chart.

I will provide you with the SVGs as soon as possible, just use an img tag without a src attribute, if you wanna work on it and I have yet to upload them.

Advertisements with Google Adsense

  • Finish the Google Adsense account signup when the site is pushed live.
  • Create an AdvertisementCard Class that displays an advertisement.
    Should look something like this
<div class="advertisement">
    <div class="advertisement--space">...</div>
    <hr class="advertisement--seperator">
    <p class="advertisement--indicator">Advertisement</p>
</div>

.advertisement--space style

text-align: center;

.advertisement--seperator style

margin: 10px 0;

.advertisement--indicator style

text-align: center;
color: #aaaaaa;
margin: 0;
  • Show an AdvertisementCard once every X number of content cards.

Advertisement Layout
This is a mockup.

README.md Update

  • Change Trend Gator to Senti Social
  • Write an Overview paragraph that gives a brief outline of the frontend structure.
  • Write Development section explaining how to jump into the codebase.
  • Mention production build scripts build
  • Mention development build scripts build-dev
  • Change npm run server to npm run start
  • Integrate Travis
  • Fix README broken link to backend repository

Designing new v1.0.0

On the next branch

  • Switched to preact for smaller application size
  • Started using redux for handling state
  • Network requests are going out according to our new API specification
  • Website design is complete according to plan

NewsAPI Attribution

Attribution

Unless otherwise authorised, you shall agree to display an attribution to News API alongside any implementation or display of the News API Data to indicate that News API technology is being used. The attribution should preferrably be a hyperlink to https://newsapi.org with the text "Powered by News API".

https://newsapi.org/terms

Emphasize First Article

In specific trends, the first article we get, should show up on a special card that displays it full width on desktop with it's description below it. When clicking on a trend, I would expect to know more about the trend, so this would solve this issue. Given that the top news sources are from credible sources, I think it will be very relevant to the trend.

Card Layout

In AllTrendsPage and TrendPage, we are making the same repeated computation when laying out cards.

  • Create new CardLayout class that extends React.Component with:
  • props:
    content which is an array of Cards passed in by AllTrendsPage and TrendPage

Migrate repeated logic to a new class.

  • Mobile has one column of content while other devices two.

  • Rerender when the browser gets resize past the two column threshold.

  • Re-render when the browser is resized past the one-two column threshold.

Emphasis on All Trends Chart

Trends that have remarkably positive or negative sentiment should display an emoji next to them. So for example an extremely negative sentiment we could show an angry or sad face.

Emphasis should be used on trends that exceed a certain threshold and are the highest value.

So there can possibly be no emphasis at a given time if trends don't obviously leen towards positive or negative.

Also, at a given time there can be emphasis placed on two trends, one negative and one positive if they exceed the threshold.

If there is for instance, two positive trends and two negative trends that surpass the threshold, the maximum of the positive and the maximum of the negative should be emphasized more.

Optionally, maybe we can have a second degree of emphasis? (slightly happy face or slightly sad face)

Accessibility

Screen reader friendly. Adding role and aria attributes.

Dealing with disconnectivity

When the device goes offline. Currently, the requests that fail, just fail. There is no UI indication of disconnectivity nor is there a retry when the device comes back online.

Webpack

Migrate bundling from Browserify to Webpack.

https://webpack.js.org

Preact

All it requires is aliasing 'react' and 'react-dom' with 'preact-compat'

It makes sense to be using Preact over React for our simplistic use case.
We will see a huge gain in page load.

3kb alternative to React
https://github.com/developit/preact

SW Precache

https://github.com/GoogleChrome/sw-precache

React-Router

https://github.com/ReactTraining/react-router

  • Scrap our manual management of History, let react-router manage it instead.

preact-router is too minimal. I would stay away from it for now.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.