From 39c641e87c12e2f8d2c2a8c95127fc5a7e5ee34c Mon Sep 17 00:00:00 2001
From: Sudhir Kumar <2017ucp1296@mnit.ac.in>
Date: Thu, 4 Jun 2020 00:10:43 +0530
Subject: [PATCH 1/7] initial commit
---
package-lock.json | 41 ++++++++++++++++++++++++++++++-----------
1 file changed, 30 insertions(+), 11 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 91581f4c35..e8f9796953 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -5387,7 +5387,8 @@
},
"ansi-regex": {
"version": "2.1.1",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"aproba": {
"version": "1.2.0",
@@ -5405,11 +5406,13 @@
},
"balanced-match": {
"version": "1.0.0",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
+ "optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@@ -5422,15 +5425,18 @@
},
"code-point-at": {
"version": "1.1.0",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"concat-map": {
"version": "0.0.1",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"console-control-strings": {
"version": "1.1.0",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"core-util-is": {
"version": "1.0.2",
@@ -5533,7 +5539,8 @@
},
"inherits": {
"version": "2.0.3",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"ini": {
"version": "1.3.5",
@@ -5543,6 +5550,7 @@
"is-fullwidth-code-point": {
"version": "1.0.0",
"bundled": true,
+ "optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@@ -5555,17 +5563,20 @@
"minimatch": {
"version": "3.0.4",
"bundled": true,
+ "optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
},
"minimist": {
"version": "0.0.8",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"minipass": {
"version": "2.2.4",
"bundled": true,
+ "optional": true,
"requires": {
"safe-buffer": "^5.1.1",
"yallist": "^3.0.0"
@@ -5582,6 +5593,7 @@
"mkdirp": {
"version": "0.5.1",
"bundled": true,
+ "optional": true,
"requires": {
"minimist": "0.0.8"
}
@@ -5654,7 +5666,8 @@
},
"number-is-nan": {
"version": "1.0.1",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"object-assign": {
"version": "4.1.1",
@@ -5664,6 +5677,7 @@
"once": {
"version": "1.4.0",
"bundled": true,
+ "optional": true,
"requires": {
"wrappy": "1"
}
@@ -5739,7 +5753,8 @@
},
"safe-buffer": {
"version": "5.1.1",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"safer-buffer": {
"version": "2.1.2",
@@ -5769,6 +5784,7 @@
"string-width": {
"version": "1.0.2",
"bundled": true,
+ "optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@@ -5786,6 +5802,7 @@
"strip-ansi": {
"version": "3.0.1",
"bundled": true,
+ "optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@@ -5824,11 +5841,13 @@
},
"wrappy": {
"version": "1.0.2",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"yallist": {
"version": "3.0.2",
- "bundled": true
+ "bundled": true,
+ "optional": true
}
}
},
From 0aee38b73bb916a6164bbccfeba3d02677fe7c62 Mon Sep 17 00:00:00 2001
From: Sudhir Kumar <2017ucp1296@mnit.ac.in>
Date: Thu, 4 Jun 2020 00:32:40 +0530
Subject: [PATCH 2/7] url change updated
---
package-lock.json | 159 +++++++++++++++++++++++++++++++++++
package.json | 1 +
src/App.js | 209 ++++------------------------------------------
src/Main.js | 181 +++++++++++++++++++++++++++++++++++++++
src/Search.js | 33 ++++++++
5 files changed, 391 insertions(+), 192 deletions(-)
create mode 100644 src/Main.js
create mode 100644 src/Search.js
diff --git a/package-lock.json b/package-lock.json
index e8f9796953..01b3ae563d 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -6194,6 +6194,34 @@
"resolved": "https://registry.npmjs.org/hex-color-regex/-/hex-color-regex-1.1.0.tgz",
"integrity": "sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ=="
},
+ "history": {
+ "version": "4.10.1",
+ "resolved": "https://registry.npmjs.org/history/-/history-4.10.1.tgz",
+ "integrity": "sha512-36nwAD620w12kuzPAsyINPWJqlNbij+hpK1k9XRloDtym8mxzGYl2c17LnV6IAGB2Dmg4tEa7G7DlawS0+qjew==",
+ "requires": {
+ "@babel/runtime": "^7.1.2",
+ "loose-envify": "^1.2.0",
+ "resolve-pathname": "^3.0.0",
+ "tiny-invariant": "^1.0.2",
+ "tiny-warning": "^1.0.0",
+ "value-equal": "^1.0.1"
+ },
+ "dependencies": {
+ "@babel/runtime": {
+ "version": "7.10.2",
+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.10.2.tgz",
+ "integrity": "sha512-6sF3uQw2ivImfVIl62RZ7MXhO2tap69WeWK57vAaimT6AZbE4FbqjdEJIN1UqoD6wI6B+1n9UiagafH1sxjOtg==",
+ "requires": {
+ "regenerator-runtime": "^0.13.4"
+ }
+ },
+ "regenerator-runtime": {
+ "version": "0.13.5",
+ "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.5.tgz",
+ "integrity": "sha512-ZS5w8CpKFinUzOwW3c83oPeVXoNsrLsaCoLtJvAClH135j/R77RuymhiSErhm2lKcwSCIpmvIWSbDkIfAqKQlA=="
+ }
+ }
+ },
"hmac-drbg": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz",
@@ -6209,6 +6237,14 @@
"resolved": "http://registry.npmjs.org/hoek/-/hoek-4.2.1.tgz",
"integrity": "sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA=="
},
+ "hoist-non-react-statics": {
+ "version": "3.3.2",
+ "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz",
+ "integrity": "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==",
+ "requires": {
+ "react-is": "^16.7.0"
+ }
+ },
"home-or-tmp": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz",
@@ -8354,6 +8390,30 @@
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz",
"integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ=="
},
+ "mini-create-react-context": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/mini-create-react-context/-/mini-create-react-context-0.4.0.tgz",
+ "integrity": "sha512-b0TytUgFSbgFJGzJqXPKCFCBWigAjpjo+Fl7Vf7ZbKRDptszpppKxXH6DRXEABZ/gcEQczeb0iZ7JvL8e8jjCA==",
+ "requires": {
+ "@babel/runtime": "^7.5.5",
+ "tiny-warning": "^1.0.3"
+ },
+ "dependencies": {
+ "@babel/runtime": {
+ "version": "7.10.2",
+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.10.2.tgz",
+ "integrity": "sha512-6sF3uQw2ivImfVIl62RZ7MXhO2tap69WeWK57vAaimT6AZbE4FbqjdEJIN1UqoD6wI6B+1n9UiagafH1sxjOtg==",
+ "requires": {
+ "regenerator-runtime": "^0.13.4"
+ }
+ },
+ "regenerator-runtime": {
+ "version": "0.13.5",
+ "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.5.tgz",
+ "integrity": "sha512-ZS5w8CpKFinUzOwW3c83oPeVXoNsrLsaCoLtJvAClH135j/R77RuymhiSErhm2lKcwSCIpmvIWSbDkIfAqKQlA=="
+ }
+ }
+ },
"mini-css-extract-plugin": {
"version": "0.4.3",
"resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-0.4.3.tgz",
@@ -11241,6 +11301,85 @@
"resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-5.1.0.tgz",
"integrity": "sha512-akMy/BQT5m1J3iJIHkSb4qycq2wzllWsmmolaaFVnb+LPV9cIJ/nTud40ZsiiT0H3P+/wXIdbjx2fzF61OaeOQ=="
},
+ "react-is": {
+ "version": "16.13.1",
+ "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
+ "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
+ },
+ "react-router": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/react-router/-/react-router-5.2.0.tgz",
+ "integrity": "sha512-smz1DUuFHRKdcJC0jobGo8cVbhO3x50tCL4icacOlcwDOEQPq4TMqwx3sY1TP+DvtTgz4nm3thuo7A+BK2U0Dw==",
+ "requires": {
+ "@babel/runtime": "^7.1.2",
+ "history": "^4.9.0",
+ "hoist-non-react-statics": "^3.1.0",
+ "loose-envify": "^1.3.1",
+ "mini-create-react-context": "^0.4.0",
+ "path-to-regexp": "^1.7.0",
+ "prop-types": "^15.6.2",
+ "react-is": "^16.6.0",
+ "tiny-invariant": "^1.0.2",
+ "tiny-warning": "^1.0.0"
+ },
+ "dependencies": {
+ "@babel/runtime": {
+ "version": "7.10.2",
+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.10.2.tgz",
+ "integrity": "sha512-6sF3uQw2ivImfVIl62RZ7MXhO2tap69WeWK57vAaimT6AZbE4FbqjdEJIN1UqoD6wI6B+1n9UiagafH1sxjOtg==",
+ "requires": {
+ "regenerator-runtime": "^0.13.4"
+ }
+ },
+ "isarray": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
+ "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8="
+ },
+ "path-to-regexp": {
+ "version": "1.8.0",
+ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz",
+ "integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==",
+ "requires": {
+ "isarray": "0.0.1"
+ }
+ },
+ "regenerator-runtime": {
+ "version": "0.13.5",
+ "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.5.tgz",
+ "integrity": "sha512-ZS5w8CpKFinUzOwW3c83oPeVXoNsrLsaCoLtJvAClH135j/R77RuymhiSErhm2lKcwSCIpmvIWSbDkIfAqKQlA=="
+ }
+ }
+ },
+ "react-router-dom": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-5.2.0.tgz",
+ "integrity": "sha512-gxAmfylo2QUjcwxI63RhQ5G85Qqt4voZpUXSEqCwykV0baaOTQDR1f0PmY8AELqIyVc0NEZUj0Gov5lNGcXgsA==",
+ "requires": {
+ "@babel/runtime": "^7.1.2",
+ "history": "^4.9.0",
+ "loose-envify": "^1.3.1",
+ "prop-types": "^15.6.2",
+ "react-router": "5.2.0",
+ "tiny-invariant": "^1.0.2",
+ "tiny-warning": "^1.0.0"
+ },
+ "dependencies": {
+ "@babel/runtime": {
+ "version": "7.10.2",
+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.10.2.tgz",
+ "integrity": "sha512-6sF3uQw2ivImfVIl62RZ7MXhO2tap69WeWK57vAaimT6AZbE4FbqjdEJIN1UqoD6wI6B+1n9UiagafH1sxjOtg==",
+ "requires": {
+ "regenerator-runtime": "^0.13.4"
+ }
+ },
+ "regenerator-runtime": {
+ "version": "0.13.5",
+ "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.5.tgz",
+ "integrity": "sha512-ZS5w8CpKFinUzOwW3c83oPeVXoNsrLsaCoLtJvAClH135j/R77RuymhiSErhm2lKcwSCIpmvIWSbDkIfAqKQlA=="
+ }
+ }
+ },
"react-scripts": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/react-scripts/-/react-scripts-2.1.1.tgz",
@@ -11899,6 +12038,11 @@
"resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz",
"integrity": "sha1-six699nWiBvItuZTM17rywoYh0g="
},
+ "resolve-pathname": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/resolve-pathname/-/resolve-pathname-3.0.0.tgz",
+ "integrity": "sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng=="
+ },
"resolve-url": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz",
@@ -13361,6 +13505,16 @@
"resolved": "https://registry.npmjs.org/timsort/-/timsort-0.3.0.tgz",
"integrity": "sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q="
},
+ "tiny-invariant": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.1.0.tgz",
+ "integrity": "sha512-ytxQvrb1cPc9WBEI/HSeYYoGD0kWnGEOR8RY6KomWLBVhqz0RgTwVO9dLrGz7dC+nN9llyI7OKAgRq8Vq4ZBSw=="
+ },
+ "tiny-warning": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz",
+ "integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA=="
+ },
"tmp": {
"version": "0.0.33",
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
@@ -13876,6 +14030,11 @@
"spdx-expression-parse": "^3.0.0"
}
},
+ "value-equal": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/value-equal/-/value-equal-1.0.1.tgz",
+ "integrity": "sha512-NOJ6JZCAWr0zlxZt+xqCHNTEKOsrks2HQd4MqhP1qy4z1SkbEP467eNx6TgDKXMvUOb+OENfJCZwM+16n7fRfw=="
+ },
"vary": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
diff --git a/package.json b/package.json
index 579d515885..6baa09aea1 100644
--- a/package.json
+++ b/package.json
@@ -6,6 +6,7 @@
"prop-types": "^15.6.2",
"react": "^16.6.3",
"react-dom": "^16.6.3",
+ "react-router-dom": "^5.2.0",
"react-scripts": "2.1.1"
},
"scripts": {
diff --git a/src/App.js b/src/App.js
index 785820d5df..6d0d51ce38 100644
--- a/src/App.js
+++ b/src/App.js
@@ -1,205 +1,30 @@
import React from 'react'
-// import * as BooksAPI from './BooksAPI'
+import * as BooksAPI from './BooksAPI'
import './App.css'
+import Main from './Main'
+import Search from './Search'
+import {BrowserRouter as Router , Route} from 'react-router-dom'
class BooksApp extends React.Component {
- state = {
- /**
- * TODO: Instead of using this state variable to keep track of which page
- * we're on, use the URL in the browser's address bar. This will ensure that
- * users can use the browser's back and forward buttons to navigate between
- * pages, as well as provide a good URL they can bookmark and share.
- */
- showSearchPage: false
- }
+
render() {
return (
-
- {this.state.showSearchPage ? (
-
-
-
this.setState({ showSearchPage: false })}>Close
-
- {/*
- NOTES: The search from BooksAPI is limited to a particular set of search terms.
- You can find these search terms here:
- https://github.com/udacity/reactnd-project-myreads-starter/blob/master/SEARCH_TERMS.md
- However, remember that the BooksAPI.search method DOES search by title or author. So, don't worry if
- you don't find a specific author or title. Every search is limited by search terms.
- */}
-
+
+
+
+ (
+
+ )}/>
+ (
+
+ )} />
-
-
-
-
- ) : (
-
-
-
MyReads
-
-
-
-
-
Currently Reading
-
-
-
-
-
-
-
-
- Move to...
- Currently Reading
- Want to Read
- Read
- None
-
-
-
-
To Kill a Mockingbird
-
Harper Lee
-
-
-
-
-
-
-
-
- Move to...
- Currently Reading
- Want to Read
- Read
- None
-
-
-
-
Ender's Game
-
Orson Scott Card
-
-
-
-
-
-
-
Want to Read
-
-
-
-
-
-
-
-
- Move to...
- Currently Reading
- Want to Read
- Read
- None
-
-
-
-
1776
-
David McCullough
-
-
-
-
-
-
-
-
- Move to...
- Currently Reading
- Want to Read
- Read
- None
-
-
-
-
Harry Potter and the Sorcerer's Stone
-
J.K. Rowling
-
-
-
-
-
-
-
Read
-
-
-
-
-
-
-
-
- Move to...
- Currently Reading
- Want to Read
- Read
- None
-
-
-
-
The Hobbit
-
J.R.R. Tolkien
-
-
-
-
-
-
-
-
- Move to...
- Currently Reading
- Want to Read
- Read
- None
-
-
-
-
Oh, the Places You'll Go!
-
Seuss
-
-
-
-
-
-
-
-
- Move to...
- Currently Reading
- Want to Read
- Read
- None
-
-
-
-
The Adventures of Tom Sawyer
-
Mark Twain
-
-
-
-
-
-
-
-
- this.setState({ showSearchPage: true })}>Add a book
-
-
- )}
+
+
- )
+ );
}
}
diff --git a/src/Main.js b/src/Main.js
new file mode 100644
index 0000000000..34623682a0
--- /dev/null
+++ b/src/Main.js
@@ -0,0 +1,181 @@
+import React from 'react'
+import './App.css'
+import {Link} from 'react-router-dom'
+
+class Main extends React.Component
+{
+ render()
+ {
+ return (
+
+
+
+
+
+
MyReads
+
+
+
+
+
Currently Reading
+
+
+
+
+
+
+
+
+ Move to...
+ Currently Reading
+ Want to Read
+ Read
+ None
+
+
+
+
To Kill a Mockingbird
+
Harper Lee
+
+
+
+
+
+
+
+
+ Move to...
+ Currently Reading
+ Want to Read
+ Read
+ None
+
+
+
+
Ender's Game
+
Orson Scott Card
+
+
+
+
+
+
+
Want to Read
+
+
+
+
+
+
+
+
+ Move to...
+ Currently Reading
+ Want to Read
+ Read
+ None
+
+
+
+
1776
+
David McCullough
+
+
+
+
+
+
+
+
+ Move to...
+ Currently Reading
+ Want to Read
+ Read
+ None
+
+
+
+
Harry Potter and the Sorcerer's Stone
+
J.K. Rowling
+
+
+
+
+
+
+
Read
+
+
+
+
+
+
+
+
+ Move to...
+ Currently Reading
+ Want to Read
+ Read
+ None
+
+
+
+
The Hobbit
+
J.R.R. Tolkien
+
+
+
+
+
+
+
+
+ Move to...
+ Currently Reading
+ Want to Read
+ Read
+ None
+
+
+
+
Oh, the Places You'll Go!
+
Seuss
+
+
+
+
+
+
+
+
+ Move to...
+ Currently Reading
+ Want to Read
+ Read
+ None
+
+
+
+
The Adventures of Tom Sawyer
+
Mark Twain
+
+
+
+
+
+
+
+
+
+ Add a book
+
+
+
+
+ )}
+
+
);
+ }
+}
+
+export default Main
\ No newline at end of file
diff --git a/src/Search.js b/src/Search.js
new file mode 100644
index 0000000000..ecb8d3b9c1
--- /dev/null
+++ b/src/Search.js
@@ -0,0 +1,33 @@
+import React from 'react'
+import './App.css'
+import {Link} from 'react-router-dom'
+
+class Search extends React.Component
+{
+ render()
+ {
+ return (
+
+ );
+ }
+}
+
+export default Search;
\ No newline at end of file
From 4063b9b914f8a3ee492c152a9e403b1bc3d4a5c0 Mon Sep 17 00:00:00 2001
From: Sudhir Kumar <2017ucp1296@mnit.ac.in>
Date: Thu, 4 Jun 2020 01:50:17 +0530
Subject: [PATCH 3/7] updated main page
---
src/App.js | 30 ++++++-
src/Main.js | 228 +++++++++++++++++++++++-----------------------------
2 files changed, 127 insertions(+), 131 deletions(-)
diff --git a/src/App.js b/src/App.js
index 6d0d51ce38..9cfb76a924 100644
--- a/src/App.js
+++ b/src/App.js
@@ -6,16 +6,42 @@ import Search from './Search'
import {BrowserRouter as Router , Route} from 'react-router-dom'
class BooksApp extends React.Component {
-
+
+ state = {
+ books : []
+ }
+
+ async componentDidMount()
+ {
+ this.updatebook();
+ }
+
+ async updatebook()
+ {
+ const fetchapi = BooksAPI.getAll();
+ fetchapi.then((data) =>
+ {
+ console.log(data);
+ this.setState({books : data});
+ });
+ }
+
+
+
render() {
+
+ if(this.state.books.length === 0)
+ {
+ return
loading ....
+ }
return (
(
-
+
)}/>
(
diff --git a/src/Main.js b/src/Main.js
index 34623682a0..66c3250c3a 100644
--- a/src/Main.js
+++ b/src/Main.js
@@ -4,8 +4,25 @@ import {Link} from 'react-router-dom'
class Main extends React.Component
{
- render()
+ render(props)
{
+ const books = this.props.books;
+
+ const contreading = books.filter((book) =>
+ {
+ return book.shelf === "currentlyReading" ;
+ })
+ const wanttoread = books.filter((book) =>
+ {
+ return book.shelf === "wantToRead" ;
+ })
+ const read = books.filter((book) =>
+ {
+ return book.shelf === "read" ;
+ })
+
+
+
return (
@@ -20,151 +37,104 @@ class Main extends React.Component
Currently Reading
-
-
-
-
-
-
- Move to...
- Currently Reading
- Want to Read
- Read
- None
-
-
-
-
To Kill a Mockingbird
-
Harper Lee
-
-
-
-
-
-
-
-
- Move to...
- Currently Reading
- Want to Read
- Read
- None
-
-
-
-
Ender's Game
-
Orson Scott Card
-
-
+ {
+ contreading.map((book ) =>
+ {
+
+ return
+
+
+
+
+
+ Move to...
+ Currently Reading
+ Want to Read
+ Read
+ None
+
+
+
+
{book.title}
+
{book.authors}
+
+
+
+ })}
+
+
+
Want to Read
-
-
-
-
-
-
- Move to...
- Currently Reading
- Want to Read
- Read
- None
-
-
-
-
1776
-
David McCullough
-
-
-
-
-
-
-
-
- Move to...
- Currently Reading
- Want to Read
- Read
- None
-
-
-
-
Harry Potter and the Sorcerer's Stone
-
J.K. Rowling
-
-
+ {
+ wanttoread.map((book ) =>
+ {
+
+ return
+
+
+
+
+
+ Move to...
+ Currently Reading
+ Want to Read
+ Read
+ None
+
+
+
+
{book.title}
+
{book.authors}
+
+
+
+ })}
+
+
Read
-
-
-
-
-
-
- Move to...
- Currently Reading
- Want to Read
- Read
- None
-
-
-
-
The Hobbit
-
J.R.R. Tolkien
-
-
-
-
-
-
-
-
- Move to...
- Currently Reading
- Want to Read
- Read
- None
-
-
-
-
Oh, the Places You'll Go!
-
Seuss
-
-
-
-
-
-
-
-
- Move to...
- Currently Reading
- Want to Read
- Read
- None
-
-
-
-
The Adventures of Tom Sawyer
-
Mark Twain
-
-
+ {
+ read.map((book ) =>
+ {
+
+ return
+
+
+
+
+
+ Move to...
+ Currently Reading
+ Want to Read
+ Read
+ None
+
+
+
+
{book.title}
+
{book.authors}
+
+
+
+ })}
+
+
+
-
Add a book
@@ -178,4 +148,4 @@ class Main extends React.Component
}
}
-export default Main
\ No newline at end of file
+export default Main;
\ No newline at end of file
From 07ed09e47fdc349b89c719737cf961ab75953fea Mon Sep 17 00:00:00 2001
From: Sudhir Kumar <2017ucp1296@mnit.ac.in>
Date: Thu, 4 Jun 2020 05:24:39 +0530
Subject: [PATCH 4/7] work done
---
src/App.css | 7 +++
src/App.js | 25 +++++++++--
src/BooksAPI.js | 2 +-
src/Main.js | 24 +++++++---
src/Search.js | 114 ++++++++++++++++++++++++++++++++++++++++--------
5 files changed, 144 insertions(+), 28 deletions(-)
diff --git a/src/App.css b/src/App.css
index 28960adf8f..c81d0c3afe 100644
--- a/src/App.css
+++ b/src/App.css
@@ -184,6 +184,8 @@ button:active {
cursor: pointer;
}
+
+
/* book cover */
.book-cover {
@@ -196,3 +198,8 @@ button:active {
text-align: center;
font-size: 0.8em;
}
+
+
+.select-selected {
+ background-color: DodgerBlue;
+}
\ No newline at end of file
diff --git a/src/App.js b/src/App.js
index 9cfb76a924..2ca0a4e503 100644
--- a/src/App.js
+++ b/src/App.js
@@ -16,17 +16,34 @@ class BooksApp extends React.Component {
this.updatebook();
}
- async updatebook()
+
+
+ async updatebook(e)
{
const fetchapi = BooksAPI.getAll();
fetchapi.then((data) =>
{
- console.log(data);
+
this.setState({books : data});
});
}
+ updatebookshelf = async (id,shelf) =>
+ {
+ console.log(id);
+ console.log(shelf);
+
+ BooksAPI.update(id,shelf).then((data) =>
+ {
+
+ this.updatebook();
+ }
+ )
+ }
+
+
+
render() {
@@ -41,10 +58,10 @@ class BooksApp extends React.Component {
(
-
+
)}/>
(
-
+
)} />
diff --git a/src/BooksAPI.js b/src/BooksAPI.js
index 99b00b788e..0a76a1f610 100644
--- a/src/BooksAPI.js
+++ b/src/BooksAPI.js
@@ -23,7 +23,7 @@ export const getAll = () =>
.then(data => data.books)
export const update = (book, shelf) =>
- fetch(`${api}/books/${book.id}`, {
+ fetch(`${api}/books/${book}`, {
method: 'PUT',
headers: {
...headers,
diff --git a/src/Main.js b/src/Main.js
index 66c3250c3a..273416a1cd 100644
--- a/src/Main.js
+++ b/src/Main.js
@@ -1,11 +1,15 @@
import React from 'react'
import './App.css'
-import {Link} from 'react-router-dom'
+import {Link, } from 'react-router-dom'
+
class Main extends React.Component
{
+
render(props)
{
+
+
const books = this.props.books;
const contreading = books.filter((book) =>
@@ -40,15 +44,19 @@ class Main extends React.Component
{
contreading.map((book ) =>
{
+ console.log(book.shelf);
return
-
+
+ {
+ this.props.updatebookshelf(e.target.id , e.target.value);
+ }}>
Move to...
- Currently Reading
+ Currently Reading
Want to Read
Read
None
@@ -80,7 +88,10 @@ class Main extends React.Component
-
+
+ {
+ this.props.updatebookshelf(e.target.id , e.target.value);
+ }}>
Move to...
Currently Reading
Want to Read
@@ -113,7 +124,10 @@ class Main extends React.Component
-
+
+ {
+ this.props.updatebookshelf(e.target.id , e.target.value);
+ }}>
Move to...
Currently Reading
Want to Read
diff --git a/src/Search.js b/src/Search.js
index ecb8d3b9c1..ee5302fe44 100644
--- a/src/Search.js
+++ b/src/Search.js
@@ -1,31 +1,109 @@
import React from 'react'
+import * as BooksAPI from './BooksAPI'
import './App.css'
import {Link} from 'react-router-dom'
class Search extends React.Component
{
+ state = {
+ books : []
+ }
+
+ handleChange = (event) =>
+ {
+
+ console.log(event.target.value);
+ this.searchbooks(event.target.value);
+ }
+
+ searchbooks = async (query) =>
+ {
+ BooksAPI.search(query).then((data) =>
+ {
+
+ console.log(data);
+ if(data === undefined)
+ {
+ console.log(data);
+ }
+ else if(data.error === "empty query")
+ {
+ console.log(data);
+ }
+ else
+ {
+ this.setState({books : data});
+ console.log("hello2");
+ }
+
+ })
+
+
+ }
render()
{
+
return (
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+ {
+
+ this.state.books.map((book ) =>
+ {
+ console.log(book.shelf);
+
+ return
+
+
+
+
+
+ {
+ this.props.updatebookshelf(e.target.id , e.target.value);
+ }}>
+ Move to...
+ Currently Reading
+ Want to Read
+ Read
+ None
+
+
+
+
{book.title}
+
{book.authors}
+
+
+
+ }) }
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
);
}
}
From 0cf3281901a9a77ff3b96c2bc6b881f6af2174c4 Mon Sep 17 00:00:00 2001
From: Sudhir Kumar <2017ucp1296@mnit.ac.in>
Date: Fri, 5 Jun 2020 01:56:51 +0530
Subject: [PATCH 5/7] feedback update done
---
src/App.js | 2 +-
src/Main.js | 4 +-
src/Search.js | 127 +++++++++++++++++++++++++++-----------------------
3 files changed, 71 insertions(+), 62 deletions(-)
diff --git a/src/App.js b/src/App.js
index 2ca0a4e503..660b892bf2 100644
--- a/src/App.js
+++ b/src/App.js
@@ -61,7 +61,7 @@ class BooksApp extends React.Component {
)}/>
(
-
+
)} />
diff --git a/src/Main.js b/src/Main.js
index 273416a1cd..35334b2c08 100644
--- a/src/Main.js
+++ b/src/Main.js
@@ -7,9 +7,7 @@ class Main extends React.Component
{
render(props)
- {
-
-
+ {
const books = this.props.books;
const contreading = books.filter((book) =>
diff --git a/src/Search.js b/src/Search.js
index ee5302fe44..053a4c6a29 100644
--- a/src/Search.js
+++ b/src/Search.js
@@ -18,28 +18,33 @@ class Search extends React.Component
searchbooks = async (query) =>
{
- BooksAPI.search(query).then((data) =>
+ BooksAPI.search(query).then((data) =>
+ {
+
+ //console.log(data);
+ if(data === undefined)
{
-
console.log(data);
- if(data === undefined)
- {
- console.log(data);
- }
- else if(data.error === "empty query")
- {
- console.log(data);
- }
- else
- {
- this.setState({books : data});
- console.log("hello2");
- }
-
- })
-
+ this.setState({books : []});
+ }
+ else if(data.error === "empty query")
+ {
+ console.log(data);
+ this.setState({books : []});
+ }
+ else
+ {
+ this.setState({books : data});
+ //console.log("hello2");
+ }
+
+ })
+
}
+
+
+
render()
{
@@ -49,7 +54,7 @@ class Search extends React.Component
-
Close
+
Close
@@ -58,47 +63,53 @@ class Search extends React.Component
-
-
-
- {
-
- this.state.books.map((book ) =>
- {
- console.log(book.shelf);
-
- return
-
-
-
-
-
- {
- this.props.updatebookshelf(e.target.id , e.target.value);
- }}>
- Move to...
- Currently Reading
- Want to Read
- Read
- None
-
-
-
-
{book.title}
-
{book.authors}
-
-
-
- }) }
-
-
-
-
-
-
+ {
+ this.state.books.map((book ) =>
+ {
+
+ this.props.books.map((book1) =>
+ {
+ if(book1.id === book.id)
+ {
+ book.shelf = book1.shelf;
+ }
+ return "";
+ })
-
+ console.log(book);
+
+ if(book.imageLinks === undefined)
+ {
+ book.imageLinks = "";
+ }
+ if(book.authors === undefined)
+ {
+ book.authors = "";
+ }
+ return
+
+
+
+
+
+ {
+ this.props.updatebookshelf(e.target.id , e.target.value);
+ }}>
+ Move to...
+ Currently Reading
+ Want to Read
+ Read
+ None
+
+
+
+
{book.title}
+
{book.authors}
+
+
+ })
+ }
From 40262e65e394f260c9024aaee617b31c7959ae04 Mon Sep 17 00:00:00 2001
From: Sudhir Kumar <2017ucp1296@mnit.ac.in>
Date: Fri, 5 Jun 2020 01:59:02 +0530
Subject: [PATCH 6/7] some more feedback update
---
src/Search.js | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/Search.js b/src/Search.js
index 053a4c6a29..614e466434 100644
--- a/src/Search.js
+++ b/src/Search.js
@@ -76,6 +76,10 @@ class Search extends React.Component
}
return "";
})
+ if(book.shelf === undefined)
+ {
+ book.shelf = "none";
+ }
console.log(book);
From cb0e8241da6043d1fb5ebed3e13264871bb61a8a Mon Sep 17 00:00:00 2001
From: Sudhir Kumar <2017ucp1296@mnit.ac.in>
Date: Fri, 5 Jun 2020 02:05:11 +0530
Subject: [PATCH 7/7] redme update
---
README.md | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/README.md b/README.md
index ce4ea2eb85..c49c8891d2 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,14 @@
# MyReads Project
+# updaed by sudhir kumar
+This project was made under udacity react course project , Feel free to give star to the project if you like and also any suggestion if you want to give to make this project good.
+
+
+How to Run the App :-
+ 1 . install all the dependency `npm install`
+ 2 . Run the project on terminal in project folder `npm start`
+
+
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://github.com/facebookincubator/create-react-app) to bootstrap the project.