Skip to content
This repository was archived by the owner on Jun 28, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
7ae9c6f
Initialize project using Create React App
AdedejiAdelanwa Sep 29, 2021
4f33adb
chore: Delete files not needed
AdedejiAdelanwa Sep 29, 2021
f62fb4b
chore: Delete files not needed
AdedejiAdelanwa Sep 29, 2021
ce7318e
feature: Set up actions and reducers for users and
AdedejiAdelanwa Sep 29, 2021
9bd6b25
feat: Authenticate user
AdedejiAdelanwa Oct 3, 2021
38d40c2
fix: Git issues
AdedejiAdelanwa Oct 3, 2021
b969cbe
feat: Create the navbar component
AdedejiAdelanwa Oct 3, 2021
7b62702
fix: Move assets folder into the public directory
AdedejiAdelanwa Oct 4, 2021
5567c5b
fix: Complete navbar component
AdedejiAdelanwa Oct 4, 2021
f245784
fix: Add padding to navlink to fix the janky transition on active link
AdedejiAdelanwa Oct 4, 2021
46da457
feat: Add persistence to redux store
AdedejiAdelanwa Oct 4, 2021
320d469
feat: Complete question component
AdedejiAdelanwa Oct 4, 2021
3b32d83
feat: Separate questions to appropriate tabs
AdedejiAdelanwa Oct 4, 2021
5f2f99e
feat: Sort questions based on how recent
AdedejiAdelanwa Oct 5, 2021
80e81d6
feat: Link a question to its details page
AdedejiAdelanwa Oct 5, 2021
06e6d31
feat: Add answered question details
AdedejiAdelanwa Oct 5, 2021
b927eb1
refactor: Change storage from local to session
AdedejiAdelanwa Oct 5, 2021
1e97331
feat: Add button to unanswered question
AdedejiAdelanwa Oct 5, 2021
5396570
refactor: Change the structure of question details
AdedejiAdelanwa Oct 7, 2021
c90a24e
feature: Make request to vote to db
AdedejiAdelanwa Oct 8, 2021
b6fb94f
fix: Pass proper arguments to saveQuestionAnswer function
AdedejiAdelanwa Oct 8, 2021
77cec1b
fix: Round up/down of percentage of voters in question details
AdedejiAdelanwa Oct 9, 2021
7702f9c
refactor: Route app to signin page on load
AdedejiAdelanwa Oct 9, 2021
c90b16b
feat: Voting mechanism completed
AdedejiAdelanwa Oct 9, 2021
8e7f211
refactor: Declare a question variable and set to question.questionId
AdedejiAdelanwa Oct 9, 2021
a17ab5c
refactor: Remove link component from sign in page
AdedejiAdelanwa Oct 13, 2021
11a34d2
fix: Wrap math.round around all values in unanswered question
AdedejiAdelanwa Oct 13, 2021
1d01e95
fix: Fix typo error in option two in answered component
AdedejiAdelanwa Oct 13, 2021
bc96758
feat: Add leaderboard functionality
AdedejiAdelanwa Oct 15, 2021
ae0d01a
feat: Add font awesome for carets
AdedejiAdelanwa Oct 15, 2021
5ceea5a
feat: Create a new poll
AdedejiAdelanwa Oct 15, 2021
e91a940
feat: Implement create new poll feature
AdedejiAdelanwa Oct 16, 2021
fc9c378
feat: Implement create new poll feature with litle button radius
AdedejiAdelanwa Oct 16, 2021
66c5dcc
fix: Add exact to home link to
AdedejiAdelanwa Oct 16, 2021
4175e9b
fix: Apply cosmetics to form
AdedejiAdelanwa Oct 16, 2021
65c7aed
feat: Implement protected routes
AdedejiAdelanwa Oct 16, 2021
cb10c97
feat: Implement logout functionality
AdedejiAdelanwa Oct 16, 2021
29ebb5c
fix: Redirect automatically on authentication
AdedejiAdelanwa Oct 16, 2021
6edfbab
chore: Update the README file
AdedejiAdelanwa Oct 16, 2021
6a64bb2
chore: Update the README with images
AdedejiAdelanwa Oct 16, 2021
efac635
feat: Add error component for totally non-existent route
AdedejiAdelanwa Oct 21, 2021
45abe62
fix: Make unavailable resources show error component
AdedejiAdelanwa Oct 22, 2021
9b847ac
fix: Make unavailable resources show error component
AdedejiAdelanwa Oct 22, 2021
350e4cd
fix: Request user to log in before showing error page when url is broken
AdedejiAdelanwa Oct 24, 2021
d825440
fix: Request user to log in before showing requested route when the u…
AdedejiAdelanwa Oct 24, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,26 @@
<<<<<<< HEAD
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage



# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
=======
.DS_Store
>>>>>>> 9375bb04f6e3ec94c87619f85a2995001fe2a578
113 changes: 25 additions & 88 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,100 +1,37 @@
# Would You Rather Project
# Would You Rather

This is the starter code for the final assessment project for Udacity's React & Redux course.
Would You Rather is a web application that allows users to be able to vote preferred option for a question. The app allows the user the following:

The `_DATA.js` file represents a fake database and methods that let you access the data. The only thing you need to edit in the ` _DATA.js` file is the value of `avatarURL`. Each user should have an avatar, so you’ll need to add the path to each user’s avatar.
- Sign in
- View all polls
- Select a particular poll and view its details
- Vote for a particular option in a poll
- Create a poll
- View the leaderboard

Using the provided starter code, you'll build a React/Redux front end for the application. We recommend using the [Create React App](https://github.com/facebook/create-react-app) to bootstrap the project.
![Home page polls](./sample_images/home.png)
![Leaderboard page](./sample_images/leaderboard.png)
![New Poll page](./sample_images/new-poll.png)
![Answered Poll](./sample_images/answered.png)
![Vote page](./sample_images/vote.png)

## Data
## Installation

There are two types of objects stored in our database:
- install all project dependencies with `npm install`

* Users
* Questions
- start the development server with `npm start`

### Users
```
npm install
npm start
```

Users include:
## Resources Used

| Attribute | Type | Description |
|-----------------|------------------|------------------- |
| id | String | The user’s unique identifier |
| name | String | The user’s first name and last name |
| avatarURL | String | The path to the image file |
| questions | Array | A list of ids of the polling questions this user created|
| answers | Object | The object's keys are the ids of each question this user answered. The value of each key is the answer the user selected. It can be either `'optionOne'` or `'optionTwo'` since each question has two options.
I learnt how to use create protected routes from [ Implementing Protected Route and Authentication in React-JS](https://dev.to/olumidesamuel_/implementing-protected-route-and-authentication-in-react-js-3cl4) by [Olumide Samuel](https://dev.to/olumidesamuel_)

### Questions
I also benefitted from the guidance of a friend [Qasim-Yusuf](https://github.com/Qausim) who tried as much as possible to make sure I stop doubting myself and just write code. Plus also making fun of me as us.

Questions include:
## Comments & Collaboration

| Attribute | Type | Description |
|-----------------|------------------|-------------------|
| id | String | The question’s unique identifier |
| author | String | The author’s unique identifier |
| timestamp | String | The time when the question was created|
| optionOne | Object | The first voting option|
| optionTwo | Object | The second voting option|

### Voting Options

Voting options are attached to questions. They include:

| Attribute | Type | Description |
|-----------------|------------------|-------------------|
| votes | Array | A list that contains the id of each user who voted for that option|
| text | String | The text of the option |

Your code will talk to the database via 4 methods:

* `_getUsers()`
* `_getQuestions()`
* `_saveQuestion(question)`
* `_saveQuestionAnswer(object)`

1) `_getUsers()` Method

*Description*: Get all of the existing users from the database.
*Return Value*: Object where the key is the user’s id and the value is the user object.

2) `_getQuestions()` Method

*Description*: Get all of the existing questions from the database.
*Return Value*: Object where the key is the question’s id and the value is the question object.

3) `_saveQuestion(question)` Method

*Description*: Save the polling question in the database.
*Parameters*: Object that includes the following properties: `author`, `optionOneText`, and `optionTwoText`. More details about these properties:

| Attribute | Type | Description |
|-----------------|------------------|-------------------|
| author | String | The id of the user who posted the question|
| optionOneText| String | The text of the first option |
| optionTwoText | String | The text of the second option |

*Return Value*: An object that has the following properties: `id`, `author`, `optionOne`, `optionTwo`, `timestamp`. More details about these properties:

| Attribute | Type | Description |
|-----------------|------------------|-------------------|
| id | String | The id of the question that was posted|
| author | String | The id of the user who posted the question|
| optionOne | Object | The object has a text property and a votes property, which stores an array of the ids of the users who voted for that option|
| optionTwo | Object | The object has a text property and a votes property, which stores an array of the ids of the users who voted for that option|
|timestamp|String | The time when the question was created|

4) `_saveQuestionAnswer(object)` Method

*Description*: Save the answer to a particular polling question in the database.
*Parameters*: Object that contains the following properties: `authedUser`, `qid`, and `answer`. More details about these properties:

| Attribute | Type | Description |
|-----------------|------------------|-------------------|
| authedUser | String | The id of the user who answered the question|
| qid | String | The id of the question that was answered|
| answer | String | The option the user selected. The value should be either `"optionOne"` or `"optionTwo"`|

## Contributing

This repository is the starter code for *all* Udacity students. Therefore, we most likely will not accept pull requests. For details, check out [CONTRIBUTING.md](https://github.com/udacity/reactnd-project-would-you-rather-starter/blob/master/CONTRIBUTING.md).
For comments, suggestions and collaboration all you can reach me on LinkedIn [Adedeji-Adelanwa](https://www.linkedin.com/in/adelanwaadedeji/)
202 changes: 0 additions & 202 deletions _DATA.js

This file was deleted.

23 changes: 23 additions & 0 deletions build/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"files": {
"main.css": "/static/css/main.ff576dba.chunk.css",
"main.js": "/static/js/main.0be6fe67.chunk.js",
"main.js.map": "/static/js/main.0be6fe67.chunk.js.map",
"runtime-main.js": "/static/js/runtime-main.e451e4ca.js",
"runtime-main.js.map": "/static/js/runtime-main.e451e4ca.js.map",
"static/css/2.27175f2b.chunk.css": "/static/css/2.27175f2b.chunk.css",
"static/js/2.727437a6.chunk.js": "/static/js/2.727437a6.chunk.js",
"static/js/2.727437a6.chunk.js.map": "/static/js/2.727437a6.chunk.js.map",
"index.html": "/index.html",
"static/css/2.27175f2b.chunk.css.map": "/static/css/2.27175f2b.chunk.css.map",
"static/css/main.ff576dba.chunk.css.map": "/static/css/main.ff576dba.chunk.css.map",
"static/js/2.727437a6.chunk.js.LICENSE.txt": "/static/js/2.727437a6.chunk.js.LICENSE.txt"
},
"entrypoints": [
"static/js/runtime-main.e451e4ca.js",
"static/css/2.27175f2b.chunk.css",
"static/js/2.727437a6.chunk.js",
"static/css/main.ff576dba.chunk.css",
"static/js/main.0be6fe67.chunk.js"
]
}
Binary file added build/assets/danabramov.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/assets/saraedo.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/assets/tylermcginis.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/favicon.ico
Binary file not shown.
1 change: 1 addition & 0 deletions build/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>React App</title><link href="/static/css/2.27175f2b.chunk.css" rel="stylesheet"><link href="/static/css/main.ff576dba.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function r(r){for(var n,l,a=r[0],f=r[1],i=r[2],c=0,s=[];c<a.length;c++)l=a[c],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in f)Object.prototype.hasOwnProperty.call(f,n)&&(e[n]=f[n]);for(p&&p(r);s.length;)s.shift()();return u.push.apply(u,i||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,a=1;a<t.length;a++){var f=t[a];0!==o[f]&&(n=!1)}n&&(u.splice(r--,1),e=l(l.s=t[0]))}return e}var n={},o={1:0},u=[];function l(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,l),t.l=!0,t.exports}l.m=e,l.c=n,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,r){if(1&r&&(e=l(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(l.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)l.d(t,n,function(r){return e[r]}.bind(null,n));return t},l.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(r,"a",r),r},l.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},l.p="/";var a=this["webpackJsonpwould-you-rather"]=this["webpackJsonpwould-you-rather"]||[],f=a.push.bind(a);a.push=r,a=a.slice();for(var i=0;i<a.length;i++)r(a[i]);var p=f;t()}([])</script><script src="/static/js/2.727437a6.chunk.js"></script><script src="/static/js/main.0be6fe67.chunk.js"></script></body></html>
Binary file added build/logo192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/logo512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading