This might seem like a small win but I'm a sucker for good naming conventions:
function getBooks(user_id) { // camelCase for js function
return select_books.all(user_id); // snake_case for sql statement
}
Very nice :) the readability of your code at first look went way up with that
The one issue that stood out for me was with organisation of your code base. Did you notice that addBookReview() is never used after being exported from templates.js? Instead, you replicate it's functionality within displayYourBooks()
function displayYourBooks(books) {
return /*html*/ `
<div class="Cover">
<h1>Add a book</h1>
<form> // shouldn't this form be in it's own template? we're dealing with two concerns here
...
</form>
<ul class="Center Stack"> // the code only does what it says on the tin from this line onward
${books
.map(
(entry) => `
<li>
<h2>${entry.title}</h2>
<p>${entry.author}</p>
<p>${entry.review}</p>
<p>${entry.rating}</p>
</li>
`
)
.join("")}
</ul>
<a href="/log-out" class="Button">Log out</a>
</div>
`;
}
This might seem like a small win but I'm a sucker for good naming conventions:
Very nice :) the readability of your code at first look went way up with that
The one issue that stood out for me was with organisation of your code base. Did you notice that
addBookReview()is never used after being exported fromtemplates.js? Instead, you replicate it's functionality withindisplayYourBooks()