Skip to content

Commit 47ed1df

Browse files
committed
Add books and reviews from your favorite authors!
0 parents  commit 47ed1df

File tree

7,247 files changed

+1104599
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

7,247 files changed

+1104599
-0
lines changed

.DS_Store

6 KB
Binary file not shown.

.babelrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["@babel/preset-env", "@babel/preset-react"]
3+
}

_PRESS-RELEASE.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Project Name #
2+
> Bookmark
3+
4+
## Heading ##
5+
> Bookmark
6+
7+
## Sub-Heading ##
8+
> A way for bibliophiles to index book reviews by author from The New York Times archives.
9+
10+
## Summary ##
11+
> If you love authors, books, the New York Times, book reviews, and no-fuss, sorbet-colored lists, then Bookmark can keep track of all your future to-reads.
12+
13+
## Problem ##
14+
> We all have books from the authors we love that we hear about and really want to read... but who can remember them later? Bookmark can help.
15+
16+
## Solution ##
17+
> Search the NYT for book reviews by author name and Bookmark will add all of their books to your list. You can delete the ones you've read/don't want to read, and you can mark each book as read as you go!
18+
19+
## Quote from You ##
20+
> A list in time saves nine hours of head scratching. Never have to scratch your head about what your next book is again.
21+
22+
## How to Get Started ##
23+
> Simply search an author to find their reviews of the specific or a related book in the New York Times. Then click save, and you'll have it in your list.
24+
25+
## Customer Quote ##
26+
> 'What could be better than a list of books from authors I want to read, plus a link to the book review in the New York Times?'
27+
28+
## Closing and Call to Action ##
29+
> Thank you for your support.

client/.DS_Store

6 KB
Binary file not shown.

client/dist/bundle.js

+678
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/dist/index.html

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
6+
<meta name="theme-color" content="#000000">
7+
<title>Bookmark: Find Books from Your Favorite Authors in The New York Times</title>
8+
</head>
9+
<body>
10+
11+
<div id="app"></div>
12+
<script type="text/javascript" src="bundle.js"></script>
13+
14+
</body>
15+
</html>
16+
17+
18+

client/src/.DS_Store

6 KB
Binary file not shown.

client/src/App.css

+150
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
@import url('https://fonts.googleapis.com/css2?family=Lora:wght@500&family=Montserrat:wght@300&family=Playfair+Display:wght@600&family=Quicksand:wght@300&display=swap');
2+
3+
* {
4+
margin: 0;
5+
text-align: center;
6+
font-family: 'Montserrat';
7+
background-color: plum;
8+
outline: none;
9+
text-decoration: none;
10+
}
11+
12+
a {
13+
color: black;
14+
background-color: palevioletred;
15+
}
16+
17+
.App {
18+
padding-top: 100px;
19+
padding-bottom: 100px;
20+
}
21+
22+
.Header {
23+
padding-left: 15%;
24+
padding-right: 15%;
25+
}
26+
27+
.Header h1 {
28+
background-color: peru;
29+
border: 1px solid #000;
30+
border-radius: 4px;
31+
box-shadow: #fff 4px 4px 0 0,#000 4px 4px 0 1px;
32+
box-sizing: border-box;
33+
display: inline-block;
34+
padding: 10px;
35+
36+
}
37+
38+
p {
39+
font-size: small;
40+
font-style: italic;
41+
padding: 5px;
42+
background-color: palevioletred;
43+
}
44+
.Search {
45+
padding: 20px;
46+
}
47+
.Search h3 {
48+
background-color: rosybrown;
49+
border: 1px solid #000;
50+
border-radius: 4px;
51+
box-shadow: #fff 4px 4px 0 0,#000 4px 4px 0 1px;
52+
box-sizing: border-box;
53+
display: inline-block;
54+
padding: 10px;
55+
}
56+
57+
.BookList {
58+
padding-top: 30px;
59+
padding-left: 15%;
60+
padding-right: 15%;
61+
}
62+
63+
64+
.BookList h3 {
65+
background-color: thistle;
66+
border: 1px solid #000;
67+
border-radius: 4px;
68+
box-shadow: #fff 4px 4px 0 0,#000 4px 4px 0 1px;
69+
box-sizing: border-box;
70+
display: inline-block;
71+
padding: 10px;
72+
}
73+
74+
.BookList h4 {
75+
font-family: "Lucida Console", "Courier New", monospace;
76+
font-weight: bold;
77+
background-color: palevioletred;
78+
border: 1px solid #000;
79+
border-radius: 4px;
80+
box-shadow: #fff 4px 4px 0 0,#000 4px 4px 0 1px;
81+
box-sizing: border-box;
82+
display: inline-block;
83+
padding: 10px;
84+
padding-top: 15px;
85+
}
86+
87+
.BookList h5 {
88+
padding: 20px;
89+
padding-top: 15px;
90+
}
91+
92+
.EachBook {
93+
padding-top: 30px;
94+
}
95+
.Form {
96+
padding-top: 0px;
97+
flex: auto;
98+
background-color: rosybrown;
99+
}
100+
101+
/*
102+
<!-- HTML !-->
103+
<button class="button-54" role="button">Button 54</button> */
104+
105+
/* CSS */
106+
.button-54 {
107+
background-color: cornsilk;
108+
font-family: "Open Sans", sans-serif;
109+
font-size: 12px;
110+
letter-spacing: 2px;
111+
text-decoration: none;
112+
text-transform: uppercase;
113+
color: #000;
114+
cursor: pointer;
115+
border: 3px solid;
116+
padding: 5px;
117+
box-shadow: 1px 1px 0px 0px, 2px 2px 0px 0px, 3px 3px 0px 0px, 4px 4px 0px 0px, 5px 5px 0px 0px;
118+
position: relative;
119+
min-width: 100px;
120+
max-width: 200px;
121+
min-height: 10px;
122+
max-height: 30px;
123+
user-select: none;
124+
-webkit-user-select: none;
125+
touch-action: manipulation;
126+
display:inline
127+
}
128+
129+
.button-54:active {
130+
box-shadow: 0px 0px 0px 0px;
131+
top: 5px;
132+
left: 5px;
133+
}
134+
135+
@media (min-width: 768px) {
136+
.button-54 {
137+
padding: 0.25em 0.75em;
138+
}
139+
}
140+
141+
.CheckBox {
142+
display:inline;
143+
background-color: rosybrown;
144+
}
145+
146+
input[type=checkbox] {
147+
outline-color:transparent;
148+
accent-color: #9b59b6;
149+
150+
}

client/src/App.jsx

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
import React from "react";
2+
import ReactDOM from 'react-dom';
3+
import Search from './Search.jsx';
4+
import Books from './Books.jsx';
5+
import $ from 'jquery';
6+
import axios from 'axios';
7+
8+
9+
class App extends React.Component {
10+
constructor(props) {
11+
super(props);
12+
13+
this.state = {
14+
bookList: []
15+
}
16+
17+
this.loadBooks = this.loadBooks.bind(this);
18+
this.updateBook = this.updateBook.bind(this);
19+
this.deleteBook = this.deleteBook.bind(this);
20+
this.authorSearch = this.authorSearch.bind(this);
21+
22+
}
23+
24+
componentDidMount() {
25+
this.loadBooks()
26+
}
27+
28+
loadBooks() {
29+
fetch('/books')
30+
.then(res => res.json())
31+
.then((data) => {
32+
this.setState({ bookList: data })
33+
})
34+
.then(() => {
35+
console.log('no. of books indexed: ', this.state.bookList.results.length)
36+
})
37+
.catch((err) => {
38+
console.error('failed to loadBooks in Books.jsx: ', err);
39+
})
40+
}
41+
42+
updateBook(id, readStatus) {
43+
console.log('read status', readStatus)
44+
fetch(`/books/${id}`,
45+
{
46+
method: 'PUT',
47+
headers: {
48+
'Accept': 'application/json',
49+
'Content-Type': 'application/json'
50+
},
51+
body: JSON.stringify({
52+
'readStatus': readStatus
53+
})
54+
})
55+
.then(() => {
56+
console.log('read status updated')
57+
})
58+
.catch(function (res) { console.log(res) })
59+
}
60+
61+
deleteBook(id) {
62+
fetch(`/books/${id}`,
63+
{
64+
headers: {
65+
'Accept': 'application/json',
66+
'Content-Type': 'application/json'
67+
},
68+
})
69+
.then((res) => {
70+
this.loadBooks();
71+
})
72+
.catch(function (res) { console.log(res) })
73+
}
74+
75+
authorSearch(search) {
76+
console.log('searching... ', search)
77+
axios.post('/books', {search})
78+
.then((data) => {
79+
this.loadBooks()
80+
})
81+
.catch(function (error) {
82+
console.log(error);
83+
});
84+
}
85+
86+
render() {
87+
return (
88+
<div className='App'>
89+
<div className='Header'>
90+
<h1>Bookmark with The New York Times</h1>
91+
</div>
92+
<Search authorSearch={this.authorSearch} loadBooks={this.loadBooks} bookList={this.state.bookList} />
93+
<Books bookList={this.state.bookList} loadBooks={this.loadBooks} updateBook={this.updateBook} deleteBook={this.deleteBook} />
94+
</div>
95+
96+
)
97+
}
98+
};
99+
100+
export default App;

client/src/Books.jsx

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import React from "react";
2+
import ReactDOM from 'react-dom';
3+
import $ from 'jquery';
4+
import axios from 'axios';
5+
6+
class Books extends React.Component {
7+
constructor(props) {
8+
super(props);
9+
this.setChecked = this.setChecked.bind(this);
10+
}
11+
12+
setChecked(e, id) {
13+
if (!e.target.checked) {
14+
e.target.checked = false
15+
this.props.updateBook(id, e.target.checked)
16+
} else {
17+
if (e.target.checked) {
18+
// mark as read
19+
e.target.checked = true
20+
this.props.updateBook(id, e.target.checked)
21+
}
22+
}
23+
}
24+
25+
render() {
26+
let bookList = this.props.bookList;
27+
return (
28+
<div className="BookList">
29+
<h3>Your Book List</h3><br />
30+
{bookList.results && bookList.results.length > 0 && bookList.results.map((book) => {
31+
return (<div key={book._id} className='EachBook'>
32+
<h4>
33+
<a href={book.url} >{book.book_title} by {book.book_author}</a>
34+
<p>
35+
{book.summary}
36+
</p>
37+
</h4>
38+
<form>
39+
<input type="checkbox" onChange={(e) => this.setChecked(e, book._id)} name="controlled" className="CheckBox"></input>
40+
</form>
41+
42+
<button onClick={(e) => { this.props.deleteBook(book._id) }} className="button-54">Remove from list</button>
43+
</div>)
44+
})}
45+
</div>
46+
)
47+
}
48+
49+
50+
};
51+
52+
export default Books;

client/src/Index.jsx

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from 'react';
2+
import ReactDOM from 'react-dom';
3+
import App from './App.jsx';
4+
import './App.css';
5+
6+
ReactDOM.render(
7+
<React.StrictMode>
8+
<App />
9+
</React.StrictMode>,
10+
document.getElementById('app')
11+
);

0 commit comments

Comments
 (0)