Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

first #32

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
starter/node_modules
starter/node_modules
starter/package-lock.json
109 changes: 70 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,64 @@
# MyReads Project

This is the starter template for the final assessment project for Udacity's React Fundamentals course. The goal of this template is to save you time by providing a static example of the CSS and HTML markup that may be used, but without any of the React code that is needed to complete the project. If you choose to start with this template, your job will be to add interactivity to the app by refactoring the static code in this template.

Of course, you are free to start this project from scratch if you wish! Just be sure to use [Create React App](https://reactjs.org/docs/create-a-new-react-app.html) to bootstrap the project.

## TL;DR

My project is a React application called "MyReads" that allows users to manage their book collection by organizing them into different shelves: "Currently Reading", "Want to Read", and "Read". The application uses a backend server provided by Udacity to fetch book data and update the book shelves.

# Features
- Users can sign up and login
- List of books which user has added to the bookshelf
- Users can search for books using the backend server's search functionality.
- Users can add books to their collection and organize them into different shelves.
- Users can update the shelf of a book in their collection.
- Users can remove books from their collection.
- Users can see the detail information of book

## Getting Started
To get started developing right away:

- navigate to the project directory: `cd starter`
- install all project dependencies with `npm install`
- start the development server with `npm start`

## What You're Getting
# Usage
1. After run command `npm start`, you should be able to see the application running in your browser at `http://localhost:3000`.
2. Click "Create a new account" to create a user to login
3. Login with your account you have created
4. Click the "Search" button to search for books using the backend server's search functionality.
5. Enter a book title or author in the search input field.
6. Select a book from the search results to add it to your bookshelf.
7. Click the "drop-down list" button to add the selected book to your bookshelf.
8. Click the "Currently Reading", "Want to Read", or "Read" buttons to organize the books in your bookshelf.
9. Click the "None" option to remove a book from your bookshelf.
10. Click the "I" icon at the book cover if you want to see the detail information of book.
11. Drag and drop the book to other bookshelf if you want to move books between shelves
11. Click the "Logout" button if you want to log out of the app.

## Folder Structure

```bash
├── CONTRIBUTING.md
├── README.md - This file.
├── SEARCH_TERMS.md # The whitelisted short collection of available search terms for you to use with your app.
├── package.json # npm package manager file. It's unlikely that you'll need to modify this.
├── public
│ ├── favicon.ico # React Icon, You may change if you wish.
│ └── index.html # DO NOT MODIFY
└── src
├── App.css # Styles for your app. Feel free to customize this as you desire.
├── App.js # This is the root of your app. Contains static HTML right now.
├── App.test.js # Used for testing. Provided with Create React App. Testing is encouraged, but not required.
├── BooksAPI.js # A JavaScript API for the provided Udacity backend. Instructions for the methods are below.
├── icons # Helpful images for your app. Use at your discretion.
│ ├── add.svg
│ ├── arrow-back.svg
│ └── arrow-drop-down.svg
├── index.css # Global styles. You probably won't need to change anything here.
└── index.js # You should not need to modify this file. It is used for DOM rendering only.
├── starter ──
├── package.json # npm package manager file. It's unlikely that you'll need to modify this.
├── public
│ ├── favicon.ico # React Icon, You may change if you wish.
│ └── index.html # DO NOT MODIFY
└── src
├── App.css # Styles for your app. Feel free to customize this as you desire.
├── App.js # This is the root of your app. Contains static HTML right now.
├── Book.js # component represents a single book and displays its information, including the cover image, title, authors, and shelf status
├── BookDetail.js # component represents details about the book
├── BookGrid.js # component represents a grid of books
├── BookShelf.js # component represents a bookshelf and displays a collection of books
├── Header.js # component show username and Logout function
├── Login.js # handle login function
├── Main.js # contain book collection
├── SearchBook.js # component allows users to search for books using the backend server's search method.
├── Signup.js # register user
├── BooksAPI.js # A JavaScript API for the provided Udacity backend. Instructions for the methods are below.
├── icons # Helpful images for your app. Use at your discretion.
│ ├── add.svg
│ ├── arrow-back.svg
│ └── arrow-drop-down.svg
│ └── information.svg
├── index.css # Global styles. You probably won't need to change anything here.
└── index.js # You should not need to modify this file. It is used for DOM rendering only.
```

Remember that good React design practice is to create new JS files for each component and use import/require statements to include them where they are needed.
Expand All @@ -40,18 +67,30 @@ Remember that good React design practice is to create new JS files for each comp

To simplify your development process, we've provided a backend server for you to develop against. The provided file [`BooksAPI.js`](src/BooksAPI.js) contains the methods you will need to perform necessary operations on the backend:

- [`get`](#get)
- [`getAll`](#getall)
- [`update`](#update)
- [`search`](#search)

### `getAll`
### `get`

Method Signature:

```js
getAll();
get(bookId);
```
- bookId: `<String>` id of book
- Returns a Promise which resolves to a JSON object containing a book.


### `getAll`

Method Signature:

```js
getAll(token);
```
- token: `<String>` token for specific user
- Returns a Promise which resolves to a JSON object containing a collection of book objects.
- This collection represents the books currently in the bookshelves in your app.

Expand All @@ -60,11 +99,12 @@ getAll();
Method Signature:

```js
update(book, shelf);
update(book, shelf,token);
```

- book: `<Object>` containing at minimum an `id` attribute
- shelf: `<String>` contains one of ["wantToRead", "currentlyReading", "read"]
- token: `<String>` token for specific user
- Returns a Promise which resolves to a JSON object containing the response data of the POST request

### `search`
Expand All @@ -80,15 +120,6 @@ search(query);
- These books do not know which shelf they are on. They are raw results only. You'll need to make sure that books have the correct state while on the search page.

## Important

The backend API uses a fixed set of cached search results and is limited to a particular set of search terms, which can be found in [SEARCH_TERMS.md](SEARCH_TERMS.md). That list of terms are the _only_ terms that will work with the backend, so don't be surprised if your searches for Basket Weaving or Bubble Wrap don't come back with any results.
https://github.com/udacity/reactnd-project-myreads-starter/blob/master/SEARCH_TERMS.md

## Create React App

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). You can find more information on how to perform common tasks [here](https://github.com/facebook/create-react-app/blob/main/packages/cra-template/template/README.md).

## 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](CONTRIBUTING.md).
109 changes: 70 additions & 39 deletions starter/README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,64 @@
# MyReads Project

This is the starter template for the final assessment project for Udacity's React Fundamentals course. The goal of this template is to save you time by providing a static example of the CSS and HTML markup that may be used, but without any of the React code that is needed to complete the project. If you choose to start with this template, your job will be to add interactivity to the app by refactoring the static code in this template.

Of course, you are free to start this project from scratch if you wish! Just be sure to use [Create React App](https://reactjs.org/docs/create-a-new-react-app.html) to bootstrap the project.

## TL;DR

My project is a React application called "MyReads" that allows users to manage their book collection by organizing them into different shelves: "Currently Reading", "Want to Read", and "Read". The application uses a backend server provided by Udacity to fetch book data and update the book shelves.

# Features
- Users can sign up and login
- List of books which user has added to the bookshelf
- Users can search for books using the backend server's search functionality.
- Users can add books to their collection and organize them into different shelves.
- Users can update the shelf of a book in their collection.
- Users can remove books from their collection.
- Users can see the detail information of book

## Getting Started
To get started developing right away:

- navigate to the project directory: `cd starter`
- install all project dependencies with `npm install`
- start the development server with `npm start`

## What You're Getting
# Usage
1. After run command `npm start`, you should be able to see the application running in your browser at `http://localhost:3000`.
2. Click "Create a new account" to create a user to login
3. Login with your account you have created
4. Click the "Search" button to search for books using the backend server's search functionality.
5. Enter a book title or author in the search input field.
6. Select a book from the search results to add it to your bookshelf.
7. Click the "drop-down list" button to add the selected book to your bookshelf.
8. Click the "Currently Reading", "Want to Read", or "Read" buttons to organize the books in your bookshelf.
9. Click the "None" option to remove a book from your bookshelf.
10. Click the "I" icon at the book cover if you want to see the detail information of book.
11. Drag and drop the book to other bookshelf if you want to move books between shelves
11. Click the "Logout" button if you want to log out of the app.

## Folder Structure

```bash
├── CONTRIBUTING.md
├── README.md - This file.
├── SEARCH_TERMS.md # The whitelisted short collection of available search terms for you to use with your app.
├── package.json # npm package manager file. It's unlikely that you'll need to modify this.
├── public
│ ├── favicon.ico # React Icon, You may change if you wish.
│ └── index.html # DO NOT MODIFY
└── src
├── App.css # Styles for your app. Feel free to customize this as you desire.
├── App.js # This is the root of your app. Contains static HTML right now.
├── App.test.js # Used for testing. Provided with Create React App. Testing is encouraged, but not required.
├── BooksAPI.js # A JavaScript API for the provided Udacity backend. Instructions for the methods are below.
├── icons # Helpful images for your app. Use at your discretion.
│ ├── add.svg
│ ├── arrow-back.svg
│ └── arrow-drop-down.svg
├── index.css # Global styles. You probably won't need to change anything here.
└── index.js # You should not need to modify this file. It is used for DOM rendering only.
├── starter ──
├── package.json # npm package manager file. It's unlikely that you'll need to modify this.
├── public
│ ├── favicon.ico # React Icon, You may change if you wish.
│ └── index.html # DO NOT MODIFY
└── src
├── App.css # Styles for your app. Feel free to customize this as you desire.
├── App.js # This is the root of your app. Contains static HTML right now.
├── Book.js # component represents a single book and displays its information, including the cover image, title, authors, and shelf status
├── BookDetail.js # component represents details about the book
├── BookGrid.js # component represents a grid of books
├── BookShelf.js # component represents a bookshelf and displays a collection of books
├── Header.js # component show username and Logout function
├── Login.js # handle login function
├── Main.js # contain book collection
├── SearchBook.js # component allows users to search for books using the backend server's search method.
├── Signup.js # register user
├── BooksAPI.js # A JavaScript API for the provided Udacity backend. Instructions for the methods are below.
├── icons # Helpful images for your app. Use at your discretion.
│ ├── add.svg
│ ├── arrow-back.svg
│ └── arrow-drop-down.svg
│ └── information.svg
├── index.css # Global styles. You probably won't need to change anything here.
└── index.js # You should not need to modify this file. It is used for DOM rendering only.
```

Remember that good React design practice is to create new JS files for each component and use import/require statements to include them where they are needed.
Expand All @@ -40,18 +67,30 @@ Remember that good React design practice is to create new JS files for each comp

To simplify your development process, we've provided a backend server for you to develop against. The provided file [`BooksAPI.js`](src/BooksAPI.js) contains the methods you will need to perform necessary operations on the backend:

- [`get`](#get)
- [`getAll`](#getall)
- [`update`](#update)
- [`search`](#search)

### `getAll`
### `get`

Method Signature:

```js
getAll();
get(bookId);
```
- bookId: `<String>` id of book
- Returns a Promise which resolves to a JSON object containing a book.


### `getAll`

Method Signature:

```js
getAll(token);
```
- token: `<String>` token for specific user
- Returns a Promise which resolves to a JSON object containing a collection of book objects.
- This collection represents the books currently in the bookshelves in your app.

Expand All @@ -60,11 +99,12 @@ getAll();
Method Signature:

```js
update(book, shelf);
update(book, shelf,token);
```

- book: `<Object>` containing at minimum an `id` attribute
- shelf: `<String>` contains one of ["wantToRead", "currentlyReading", "read"]
- token: `<String>` token for specific user
- Returns a Promise which resolves to a JSON object containing the response data of the POST request

### `search`
Expand All @@ -80,15 +120,6 @@ search(query);
- These books do not know which shelf they are on. They are raw results only. You'll need to make sure that books have the correct state while on the search page.

## Important

The backend API uses a fixed set of cached search results and is limited to a particular set of search terms, which can be found in [SEARCH_TERMS.md](SEARCH_TERMS.md). That list of terms are the _only_ terms that will work with the backend, so don't be surprised if your searches for Basket Weaving or Bubble Wrap don't come back with any results.
https://github.com/udacity/reactnd-project-myreads-starter/blob/master/SEARCH_TERMS.md

## Create React App

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). You can find more information on how to perform common tasks [here](https://github.com/facebook/create-react-app/blob/main/packages/cra-template/template/README.md).

## 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](CONTRIBUTING.md).
3 changes: 3 additions & 0 deletions starter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"react": "^17.0.2",
"react-beautiful-dnd": "^13.1.1",
"react-dom": "^17.0.2",
"react-router-dom": "^6.23.0",
"react-scripts": "4.0.3",
"sqlite3": "^5.1.7",
"web-vitals": "^1.0.1"
},
"scripts": {
Expand Down
Loading