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
50 commits
Select commit Hold shift + click to select a range
a71df1e
design template
nahimanajz Mar 31, 2021
b6f765c
Add initial resources
nahimanajz Mar 31, 2021
dc1ca0e
refactor: Add result screen
nahimanajz Apr 1, 2021
d61f464
feature: Authenticate a user
nahimanajz Apr 6, 2021
13a1191
feature: Add questions on homepage
nahimanajz Apr 6, 2021
33b28e3
feature: Add answered questions
nahimanajz Apr 7, 2021
8723841
fix: stick questions title
nahimanajz Apr 7, 2021
eaacbf0
chore: Append new question on a user
nahimanajz Apr 8, 2021
5e81e0a
refactor: Remove comments from questions files
nahimanajz Apr 8, 2021
2a86c61
feature: Signout a loggedIn user
nahimanajz Apr 8, 2021
191385f
chore: Append question on users question
nahimanajz Apr 8, 2021
8daae60
fix: filter questions answered by loggedin user
nahimanajz Apr 9, 2021
388afcb
refactor: remove json stringify of unanswered questions
nahimanajz Apr 9, 2021
5b7a019
mend
nahimanajz Apr 9, 2021
86f2f46
chore: Add toggle between answered and unanswered question
nahimanajz Apr 9, 2021
6c60973
fix: Show and Hide answered questions
nahimanajz Apr 9, 2021
43e1aee
chore: Add icon on question user
nahimanajz Apr 9, 2021
54d594b
feature: Show selected question in order to chose your answer
nahimanajz Apr 10, 2021
6c7f303
refactor: Display user details of chosen question
nahimanajz Apr 10, 2021
7df6fc3
feature: Add question answer
nahimanajz Apr 12, 2021
0c760c0
refactor: Save users choice
nahimanajz Apr 12, 2021
93c5f9c
mend
nahimanajz Apr 12, 2021
642e016
mend
nahimanajz Apr 12, 2021
2d55ea1
chore: append question on users who responded
nahimanajz Apr 12, 2021
7e87fae
fix: Append new user answer
nahimanajz Apr 12, 2021
48500c2
refactor: Put save question reducer in user reducer
nahimanajz Apr 12, 2021
97b9331
fix: add new question to the question list
nahimanajz Apr 13, 2021
0b61f4f
feature: Add answered and unanswered questions
nahimanajz Apr 13, 2021
4b6dc14
feature: Specify quesion or answer page
nahimanajz Apr 15, 2021
739c3f7
feature: stash incorrect question route
nahimanajz Apr 15, 2021
bee8106
refactor: Show votes percentage
nahimanajz Apr 15, 2021
8e12a68
feature: Deploy application
nahimanajz Apr 19, 2021
3b69187
feature: test deploy
nahimanajz Apr 19, 2021
1403da9
refactor: display question detail
nickitaq Apr 21, 2021
cb70e8a
fix: Display newly added question on questions list
nahimanajz Apr 22, 2021
70278e5
refactor: remove save_question_reducer
nahimanajz Apr 22, 2021
38c1438
fix: resolve user response
nahimanajz Apr 22, 2021
444f71e
refactor: Show answer
nahimanajz Apr 23, 2021
ee5f9ad
fix: move answered question to another panel
nahimanajz Apr 23, 2021
4356758
fix: Add question sorting
nahimanajz Apr 23, 2021
a9b1a61
fix: Redirect to home for unauthorized users
nahimanajz Apr 23, 2021
ccb9c94
fix: Update answered asked questions
nahimanajz Apr 23, 2021
2851d83
fix: Sort leaderboard data
nahimanajz Apr 23, 2021
b820c00
refactor: remove comments
nahimanajz Apr 23, 2021
9f3e322
refactor: add icon for checked answer
nahimanajz Apr 23, 2021
f364f0c
docs: Add Read me
nahimanajz Apr 24, 2021
cc92bde
refactor: Remove unnecessary file
nahimanajz Apr 24, 2021
b960727
chore: Add test
nahimanajz Apr 25, 2021
0fe7628
Add test
nahimanajz Apr 26, 2021
e84a685
chore: Add test
nahimanajz Apr 26, 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
14 changes: 14 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

{
"env": {
"test": {
"presets": ["@babel/preset-env", "@babel/preset-react"],
"plugins": ["transform-export-extensions","@babel/plugin-proposal-class-properties"],
"only": [
"./**/*.js",
"node_modules/jest-runtime"
]

}
}
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
.DS_Store
./frontend/src/images
node_modules
111 changes: 15 additions & 96 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,100 +1,19 @@
# Would You Rather Project
# Would you Rather Game
As a result of this Game you can play it by chosing either option one or second
from question listed on __HomePage__
## Installation Guide
Clone [This repository](https://github.com/nahimanajz/reactnd-project-would-you-rather-starter.git)

This is the starter code for the final assessment project for Udacity's React & Redux course.

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.
```
npm install
npm start
```
## Features
- View all Questions on **homepage**
- Add question
- Vote a question
- View votes

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.
``Enjoy The Game``

## Data

There are two types of objects stored in our database:

* Users
* Questions

### Users

Users include:

| 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.

### Questions

Questions include:

| 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).
100 changes: 100 additions & 0 deletions README.md.bkp
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Would You Rather Project

This is the starter code for the final assessment project for Udacity's React & Redux course.

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.

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.

## Data

There are two types of objects stored in our database:

* Users
* Questions

### Users

Users include:

| 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.

### Questions

Questions include:

| 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).
Loading