Giter VIP home page Giter VIP logo

sfn-client's Introduction

Coverage Status Build Status

Main contributors

About this project

Sing for Needs is a donation platform, meant to be a positive means for giving, inspired by music performances from artists, unknown and famous. The Artists get to see and choose the various causes to support with their performances, while getting a view of all the funds generated.

The Sing for Needs project is currently under active developement by a team of volunteers at Agileventures, an official UK Charity (#1170963) dedicated to crowdsourced learning and project development. Under the umbrella of Championer projects, the Sing for Needs backend uses the Elixir/Phoenix framework, while the frontend uses React, mainly to facilitate mentorship for the volunteers to learn these modern technologies.

This is a guide, to help easily get set up and started with the frontend, for any voluteer who would like to contribute through code, PR reviews, mentorship, or in any other way.

Getting Started

This describes how to contribute to SFN-CLIENT: the tools we use to track and coordinate the work that is happening and that needs to happen. This also describes the workflow -- the processes and sequences for getting contributions merged into the project in an organized and coherent way.

We use Zenhub to manage our work on features, chores and bugfixes.

We keep our code on GitHub and use git for version control.

Recomended IDE linting

Most of our developers use vs code and we really recommend it as an IDE for this project. Once you have it installed, be sure to set es-lint as your linter and enable format on save so that your code can be formated as soon as you save. Please ensure that the eslint you install is the same one in the image below

Screenshot 2019-06-08 13 02 15

Search for and select eslint.autoFixOnSave in the settings (or add it as a true property in settings.json) as shown below

Screenshot 2019-06-08 12 56 45

Forking the repository

Each developer will usually work with a fork of the main repository on Agile Ventures. Before starting work on a new feature or bugfix, please ensure you have synced your fork to upstream/develop:

Node version management 🛠️

Please ensure you have nvm installed in your local machine. If you are using OSX you can run the command below

brew install nvm

Run the following command to install and switch to the current node version for the project:

nvm install v10.13.0

To ensure that the correct node version for the project is automatically selected when you cd into the sfn-client project's directory please install avn in your local machine and run the commands below in your terminal:

npm install -g avn avn-nvm avn-n

OR

yarn global add avn avn-nvm avn-n

Then run:

avn setup

Unfortunately, if you are using vs code's integrated terminal, you have to cd .. and cd back in cd sfn-client

In Mac's Terminal it works automatically.

If you are using fish shell please use this to install nvm and install avn for fish

Install yarn.

npm install -g yarn

Run yarn to install dependencies

yarn

Setting up with the backend

The backend is currently deployed on gigalixir to enable Front end developers ease of setup. To get set up with the deployed backend:

  • Create a .env.local file in the root of the app you just cloned
  • Add the following
REACT_APP_BASE_URL = 'http://localhost:4002'
REACT_APP_SFN_BACKEND = 'https://sing-for-needs.gigalixirapp.com/graphiql'
SKIP_PREFLIGHT_CHECK=true

Please note that the REACT_APP_BASE_URL variable is meant to be the base REST API endpoint for the application. Also you can choose to clone the backend and get setup locally.

Starting the development server

yarn start

Set up .env.local

  • You may need to set up .env.local with your backend server's base URL. This can be easily done by coppying the content of your .env.default file to .env.local as shown below

    cp .env.default .env.local

  • Update the value of the REACT_APP_BASE_URL to correspond to your server URL e.g. REACT_APP_BASE_URL = 'http://localhost:4000'

Running tests (jest)

  • This codebase uses Enzyme Javascript Testing Utility. To learn more about the Enzyme you can checkout their documentation.

  • start the test by running

    yarn test
    
  • then press a to run all test

Running eslint/standard autofix command

  • You can't commit or run the tests if you have lint errors, so run:

    yarn lint:fix
    

SetUp Project with Docker

Prerequisite

Instructions

  • Change to the project root directory. (.//sfn-client)

  • Create an image with the following command

    docker build -f docker/Dockerfile -t sfn_client:production .

  • Run the created image with

    docker run -p 80:80 sfn_client:production

  • Access the application on localhost port 80

    http://127.0.0.1:80

Using the debugger

  • If tests are failing, or you found a bug running the development server, you can debug using the inline debug tool.

Creating an Issue

  • You can create an issue by clicking on this link or by clicking on the new issue button on for github issues for the sfn-client project
  • Click on the Get Started button to open the issue creation template.
  • Fill in all the relevant sections provided in the template as you create your issue.
  • Submit your issue by clicking on "Submit issue" button.

Choosing Stories/tickets.

When deciding on an issue to work on, look for the Help Wanted or Good First Issue tags.

Request to be added as a collaborator in our AgileVentures.org Slack chat channel.

After you’re a collaborator, you can move the ticket to the In Progress column here, to indicate you’ve started work on it.

How to create a feature branch

git checkout develop
git pull upstream develop

After you pulled the latest develop branch, make sure you have also the dependencies installed each time, by running in the console:

yarn

Ensure you have setup AgileVentures/sfn-client's upstream develop. Otherwise you will not have the latest develop changes.

To confirm this, run git remote -v.

You should see a simillar output.

origin  https://github.com/yourgithubusername/sfn-client.git (fetch)
origin  https://github.com/yourgithubusername/sfn-client.git (push)
upstream    https://github.com/AgileVentures/sfn-client.git (fetch)
upstream    https://github.com/AgileVentures/sfn-client.git (push)

If not, you need to set the remote develop in order to get the latest copy once changes are merged.

In order to achieve that, run:

git remote add upstream https://github.com/AgileVentures/sfn-client
git pull upstream develop

This depends on the name of your origin (Counter check before running the above command).

You will now have the latest copy of develop in your local.

Once this is done, you can proceed with naming your branch following the below convention.

Branch Naming Conventions

git checkout -b 17-add-sfn-logo

Where 17 is the ticket number and add-sfn-logo is a short description of the purpose of your branch.

Commit Messages

Ensure your commit message clearly communicate the work you have done.

For example,

git commit -m "Implement user login"

Pull Requests

After feature branch work is complete, push up to the upstream repo, for example:

git push --set-upstream upstream 17-add-sfn-logo

For your Pull Requests, ensure you have a proper title describing your task. Make sure to add a link to the ticket you've worked on and add any screenshots if necessary.

In your pull request description please include a sensible description of your code and a tag fixes #<issue-id> e.g. :

This PR adds a CONTRIBUTING.md file and a docs directory

fixes #799

which will associate the pull request with the issue in the Zenhub board.

Your pull request needs to be reviewed by at least two people in the team for it to be merged in develop branch.

Instructions on how to review a pull request can be found here.

Design

Designing new features

The Sing for Needs project follows user-centered design principles, accordingly the platform is built with the different key personas (artists, donors and the people behind causes) in mind. Imagine as these personas are the key stakeholders of the project.

If you want to introduce a new feature, then your responsibility is to consult each of the personas mentioned above, and empathize with their jobs-to-do, major pains and major gains to properly use this knowledge to shape the new feature. The personas documentation gives additional guidance how you can immerse yourself in the topic.

Designing components

We try to make designing components easier with setting up some base grounds of colors, typography and layouts. Before start designing a component for the page, please consult these materials. You can find them in the src/components/styles directory.

The layout of the pages is following Bootstrap's 12 column grid system, but with using CSS Grid and Flexbox together. We recommend to have a look at the documentation, or just give a shot to grid garden game.

The structure of the components and spacing is suggested to follow an 8px grid system, what does that mean? It means every spacing, padding and size (width, height) of a component is following a multiple of 8. To give you a head start related to this rule, we set up the margins and paddings already to use in the styles/utilities.scss file as SASS variables.

How do we name things in CSS/SCSS?

We use BEM (stands for Block-Element-Modifier) which is a naming convention standard for CSS class names. It has fairly wide adoption and is immensely useful in writing CSS that is easier to read, understand, and scale.

A BEM class name includes up to three parts:

  • Block: The outermost parent element of the component is defined as the block.
  • Element: Inside of the component may be one or more children called elements.
  • Modifier: Either a block or element may have a variation signified by a modifier.
  • If all three are used in a name it would look something like this:

[block]__[element]--[modifier]

For full reference with examples, please consult this amazing article. If you see something different in our codebase than the best practises mentioned in the article, please open a new issue!

Design reference 🎨

In 2019 we've created a simple branding document to establish the basis for the design in terms of colors, typography and photographic direction. The values for typography and colors will be reflected in the .scss variables ($variable) as well.

Before delivering a final UI for screens, please consult this little guidance and the stylesheets (src/styles) if all the aspects are right in the designs. It's worth checking back because the branding document will evolve in time, so changes will occur.

Branding_basic_document_SFN

As moving towards with the project the individual screens that are in-progress and assets will be documented here. Wireframes which have been implemented already are under the documentation/wireframes/finished folder.

Design inspiration

Editing Artist Page mockup & flow

Artist Profile (edit)

For more mockups that have been used in this project, please follow this link

sfn-client's People

Contributors

aonomike avatar arku avatar azure-may avatar chrisdesilva avatar daumie avatar dependabot[bot] avatar dhemmingson avatar faithngetich avatar federicoesparza avatar harshdeepkanhai avatar javpet avatar jmpainter avatar mattwr18 avatar mhobesong avatar okothkongo avatar pablopap avatar rachitkansal avatar rachitkansal-ntnx avatar shahmahdi avatar vardyb avatar yakryder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sfn-client's Issues

Create Containers directory

Create Containers directory

Containers are many times your parent class components that hold state.

Many times these are whole pages, like the causes page.

They should be separated into a direct subdirectory of src, and a sibling to the components directory.

We will want to refactor every container separately, as there are many moving parts, so this is the first step.

Now that we have an expanded test suite, we can do this properly.

You will probably need to create a blank .keep file inside the src/containers/ directory.

Otherwise you won't be able to commit the change.

Adding main container to content

Adding a container for the content will help us eliminate questions like "How wide the content should flow on different screens?", "What are our breakpoints?". As part of the implementation I'm planning to use the well-tested bootstrap 12 columns, but using CSS grid, and also in combination with flexbox.

Add `ArtistBio` styling

Add ArtistBio styling

Call it ArtistBio.scss

You can add headline and paragraph elements, along with Lorem ipsum to the <ArtistBio> component to help you out.

Expand the test suite

We need to start expanding the test suite, now that we have a good folder structure, to ensure we don't break anything as we add more moving parts.

Let's start simple, however.

Let's create the files, and write tests that just make sure that the components are in the right files and folders and can be instantiated.

You can achieve this by just copying our sole test, and modifying it for all our containers.
Located here:src/components/Artist/Artist.test.js

import React from "react";
import Artist from "./ArtistContainer";

//Need at least 1 test to pass Travis CI
it ("creates component without crashing", () => {
  const artist = <Artist/>;
});

Once we have this in place, we'll bring in Enzyme, to really build the test suite.

Adding simple branding using existing color scheme

It would be great to have a branding (logo-only at first) which nicely compliment to the colors and typography that has been already settled. I feel if we have a designer who would like to contribute it's a good & important one to pick up. Otherwise I can create myself later once, some React basis is created. This can give additional benefits to the project like: creating the PR kit, having social media presence, etc.

Adding foundations of styling

As this is a new project, and as far as I see not that complex yet to import a whole library I'm thinking of building some foundations.

As I read in the create-react-app they don't recommend to add CSS class inheritance between components which will take into consideration, and I'm thinking mostly in utility classes for spacings (margins and paddings) and adding styles to individual components separately.

Adding additional routes

From the mockup as I see the following routes might be beneficial:

  • home "/"
  • about "/about" // rendering about page
  • causes "/causes" // rendering list of causes
  • artists "/artists" // rendering list of artists
  • artist "/artists/:id" ✔️
  • artist edit "/artistst/:id/edit" // editing existing artist (update, delete)
  • artist create "/artists/new" // creating new artist
  • performances "/performances" // rendering performances list
  • contact "/contact" // rendering a contact page

Is this fine @FedericoEsparza to start with?

Upgrade react-scripts

Upgrade react-scripts

Use yarn upgrade --latest

Will need later version of node, like v10.14.2

Add trending artist component

Add trending artist component

screenshot 2019-02-16 11 59 11

Let's call these TrendingArtist. They're the individual components inside the list.

Refactor Performances Container

Refactor Performances Container

After #83 has been merged in, refactor, move, and rename src/components/Performances/PerformancesContainer.js.

It's new home and name will be src/components/Performances/Performances.js

Move the test along with it: src/components/Performances/Performances.test.js
will now be at src/containers/Performances/Performances.test.js

You'll need to refactor the reference to ./PerformancesContainer and change it to ./Performances
in the test file.

You'll also need to refactor the class name and the export default to Performances

In src/components/App.js you'll have to refactor the import statement to

import Performances from "../containers/Performances/Performances";

And you'll also have to refactor the reference to the container in that file from {PerformancesContainer} to {Performances}

Leave an empty .keep file in src/components/Performances/

Add Waffle banner-link to README

Add Waffle banner-link to README

Just add the following code to the top of the README file:

[![Waffle.io - Columns and their card count](https://badge.waffle.io/AgileVentures/sfn-client.svg?columns=all)](https://waffle.io/AgileVentures/sfn-client)

It's a convenient link to the Waffle board, from the github repo.

Add node-version

Add .node-version file for nvm automatic switching when cd-ing into project directory.

Unfortunately, in vs code's integrated terminal, you have to cd .. and cd back in.

In Mac's Terminal it works automatically.

File just needs:

v10.13.0

Need to run these commands on local computer:

yarn global add  avn avn-nvm avn-n
avn setup

Please add these commands to environment setup section.

https://github.com/wbyoung/avn

Add how to review a PR documentation

Add how to review a PR documentation

I want to empower the team to review and merge each other's tickets, so that in a weekend, you're not waiting on me to review an merge a ticket that is blocking other PRs.

This will also keep more of the team aware of a wider breadth of the codebase.

Except for documentation PRs, it's important to run the app locally, because many times, you'll find inadvertent behavior that the CI tests won't catch.

As a huge head start you can copy much of this document, written largely by @mattwr18, in one of his greatest PRs ever. 😁 https://github.com/championer-org/championer_one/blob/develop/devdocs/HOW-TO-REVIEW-A-DEVELOP-PR.md

That is obviously a Phoenix app that uses npm, so a lot of it will need to be altered, but here are the tl;dr commands for us:

git fetch upstream
git checkout 57-artist-performance-component //for example
yarn
yarn test
// Press a to run all tests
// Press q to quit watch mode.
yarn start
// Review and inspect the app and its elements for expected and unexpected behavior

Also add instructions that you always want to review the Files changed.

You can navigate there by clicking on the tab in the PR page:

screenshot 2019-02-17 08 33 03

...or adding /files to the end of the PR url, for example https://github.com/AgileVentures/sfn-client/pull/71/files

I prefer to view the diffs in Unified form, rather than the default Split.

screenshot 2019-02-17 08 37 59

You can also add comments to a particular line of code, by clicking on the plus icon when you hover over a line:

screenshot 2019-02-17 08 43 51

You can then either just provide the single comment or start a review, if you haven't, yet:

screenshot 2019-02-17 08 44 40

Update README with yarn test command

Update README with yarn test command

yarn test

I know this is a simple step. But it's a good first issue to get someone contributing, and it's an art to find the right spot to place it, and the right words to surround it, explaining what it does and what it's for.

Add Enzyme adapter setup

Add Enzyme adapter setup

So that we don't have to add enzyme adapter configuration to every test file, we need to create a common test setup file:

src/setupTests.js

You'll add the following code into that file:

import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';

configure({ adapter: new Adapter() });

See https://airbnb.io/enzyme/docs/installation/ for more guidance

Add codeclimate

Add codeclimate to the repo so code improvements are highlighted before merge for refactoring.

Refactor Causes Container

Refactor Causes Container

After #83 has been merged in, refactor, move, and rename src/components/Causes/CausesContainer.js.

It's new home and name will be src/components/Causes/Causes.js

Move the test along with it: src/components/Causes/Causes.test.js
will now be at src/containers/Causes/Causes.test.js

You'll need to refactor the reference to ./CausesContainer and change it to ./Causes
in the test file.

You'll also need to refactor the class name and the export default to Causes

In src/components/App.js you'll have to refactor the import statement to

import Causes from "../containers/Causes/Causes";

And you'll also have to refactor the reference to the container in that file from {CausesContainer} to {Causes}

Leave an empty .keep file in src/components/Causes/

Remove broken link part from intro in README

Remove this part of the README since it's a bit misleading with the broken link until we have complete setup: "First be sure that you've set up your development environment following all the steps in **Setting Up for Development on WebSiteOne (Project Set Up) 🚧"

Adding typography fundamentals

As following the Tachyons library structure, I would like to add a clear hierarchical typography scale to the project that will help developers and designers working together in the system.

Add routing

Add routing

yarn add react-router-dom

Import react-router-dom into index.js

Routes for /artists and root are ok at first.

Add yarn instruction on install

Add yarn instruction on install

After we ask people to install yarn, we need to tell them to run yarn, so that their node modules can be installed.

Otherwise, yarn start won't work.
screenshot 2019-02-16 11 05 35

Add trending artists component list

Add trending artists component list

We need another list component.

screenshot 2019-02-16 11 59 11

The magenta colored outer component.

It will be imported intosrc/components/Artists/ArtistsContainer.js

Let's call it TrendingArtistsList

Setting Up README

Gives instructions on how to set up development environment for the project

describe its

describe its

Let's add describe blocks to our tests.

In our it functions, the it is what we are testing.

And a top level describe is referring to our component, typically.

So let's make that clear.

Wrap our tests (or it functions) in describe functions and have the first argument be a string representation of the component.

It can just be "App" for example, but I like this format: "<App />"

The second argument is an arrow function where the tests will be executed.

You should see a difference when you run the tests, too.

Add more routes

Add more routes. We need a few more.

If you look at src/components/App.js

    <div>
      <BrowserRouter>
        <div>
          <Route path="/" exact component={HomeContainer} />
          <Route path="/about" component={AboutContainer} />
          <Route path="/causes" component={CausesContainer} />
          <Route path="/artists/:id" component={ArtistContainer} />
          <Route path="/performances" component={PerformancesContainer} />
          <Route path="/contact" component={ContactContainer} />
        </div>
      </BrowserRouter>
    </div>

We have routes for the "index" of causes and the "index" of performances, but not the individual ones, like we have for artists (e.g./artists/5).

Conversely, we don't have a route for the "index" of artists, like we do in /performances and /causes

Please create the corresponding container components too. Be careful in terms of plural and singular, when naming them.

          <Route path="/causes" component={CausesContainer} />
          <Route path="/artists/:id" component={ArtistContainer} />
          <Route path="/performances" component={PerformancesContainer} />

These are correct. Just follow the same structure (e.g. Cause for the individual causes).

Remove mile-long README

Remove mile-long README

Add simple instructions for updating the dependencies (i.e. run yarn), starting, and testing the app.

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.