Giter Site home page Giter Site logo

rejection's Introduction

Rejection

A portfolio project for professional developers to highlight skills with modern tech stacks like React, Redux, Serverless, etc. EricElliottJS.com.

Want to work as a team?

You gotta lose to win.

Train yourself to:

  • Get a raise
  • Sell more
  • Develop more business
  • Negotiate better deals

The game has one rule:

You must be rejected by a human being at least once per day.

Ask for things outside your comfort zone, and you'll find yourself winning a lot more.

Win = 1 point. Rejection = 10 points.

How long can you make your rejection streak last?

Basic Level

Build a UI that lets you keep track of your score. Include a text input for the ask, who you asked, and two buttons: "Accepted" or "Rejected". For asynchronous requests such as emails or messages, record the score at the time you get the answer, not at the time you ask.

Use HTML+CSS and store a record of the data in localStorage.

Your data structure can be a simple array of ask objects:

interface Question {
  id: String,          // id of the question so you can get/edit/remove by id
  timestamp: Number,   // output from Date.now()
  question: String,    // the ask
  askee: String,       // person asked
  status: String       // 'Accepted', 'Rejected', 'Unanswered'
}

You can calculate everything else you need to know by reducing over the list of asks.

It may be useful to display a running tally of the user's current score. Just remember that the current day's subtotal needs to be recalculated each time an ask is accepted or rejected, so it will be useful to keep the list in an array that you can reduce with each new ask added by the user.

Mid level

Add an API to store data using a web service and database. Track multiple users (which means you'll need to add user authentication).

Try Firebase for data storage.

Extra credit

To Implement:

  1. Fork this repo
  2. Implement your solution.
  3. Open an issue with a link to your fork.

To get credit, you must open an issue with a link to your fork.

rejection's People

Contributors

ericelliott avatar pablopaul avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

rejection's Issues

Mid level completed.

Here is the link to the app.

https://github.com/janhesters/rejection-game

It's a private repo, but I invited you both as collaborators.

Also, if you happen to download the repo, you can search for NOTEs in the code. I used NOTE every time I wasn't sure / had a question ๐Ÿ˜Š

Things that could be improved (from the top of my head):

  • Design & UI (duh).
  • Offline experience. (If I hadn't used Redux Saga, but AWS Amplify, this would be just gifted to you for free by Amplify.)
  • E2E tests with Cypress.

Things I'm working on:

  • CI / CD + automatic production deploy.

Basic Level completed!

Finish basic level using Next.js + React + Redux with TDD.

Architecture

1. ducks pattern

Colocate constants, action creators, and selectors with reducer.

2. 10 Tips for Better Redux Architecture

Use TDD: Write Tests First
  • Direct reducer tests: Test that the reducer produces the expected default state.
  • Action creator tests: Test each action creator by applying the reducer to the action using some predetermined state as a starting point.
  • Selector tests: Tests the selectors to ensure that all expected properties are there, including computed properties with expected values.

3. Feature-based file structures

Questions

1. Constants naming principle

Duck pattern say that MUST have action types in the form npm-module-or-app/reducer/ACTION_TYPE

But I notice you use const ADD_CHAT = 'CHAT::ADD_CHAT'

Which pattern should I follow?

2. Where is the describe come from?

describe('chatReducer()', ({ test }) => {
  test('with no arguments', ({ same, end }) => {
    const msg = 'should return correct default state';

    const actual = reducer();
    const expected = createState();

    same(actual, expected, msg);
    end();
  });
});

3. Is this a correct way to load data from localStorage?

componentDidMount() {
  const { dispatch } = this.props;
  const serializedState = localStorage.getItem('rejection/state');
  const state = JSON.parse(serializedState) || {};
  if (state.asks) state.asks.map(ask => dispatch(addAsk(ask)));
}

Challenge completed level: basic

site: https://rejection.manos.now.sh/
repo: https://github.com/mfountoulakis/rejection

This was a great exercise! You left a trail of easter eggs leading right to some really nice tips about testing the redux store.

I could have submitted this exercise a lot earlier if I hadn't run into issues with testing. Specifically, unit testing connected components. The short answer is: I don't know what I'm doing.

mapStateToProps seems to be clashing with the simulated state that I'm attempting to pass to my components as props. I suspect that there's an easy solution that I'm missing here, but I will continue to write tests in other areas in the meantime, along with general refactoring.

As always, questions/comments are welcome!

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.