Skip to content

Commit

Permalink
Update navigation items and book details
Browse files Browse the repository at this point in the history
  • Loading branch information
bhekanik committed Feb 27, 2024
1 parent a2c8ffd commit 1b2875f
Show file tree
Hide file tree
Showing 24 changed files with 130 additions and 135 deletions.
25 changes: 16 additions & 9 deletions src/components/AllBookTags.astro
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
---
import { getCollection } from "astro:content";
import Link from "./Link.astro";
import TagsList from "./TagsList.astro";
import { getCollection } from "astro:content"
import Link from "./Link.astro"
import TagsList from "./TagsList.astro"
export interface Props {
selectedTag?: string;
title?: string;
selectedTag?: string
title?: string
}
const allBooks = await getCollection("books");
const allBooks = await getCollection("books")
const tags = [...new Set(allBooks.map((book) => book.data.tags).flat())];
const tags = [
...new Set(
allBooks
.filter((book) => book.data.exclusiveShelf === "read")
.map((book) => book.data.tags)
.flat(),
),
]
const { selectedTag, title } = Astro.props;
const { selectedTag, title } = Astro.props
const { tag } = Astro.params;
const { tag } = Astro.params
---

{
Expand Down
24 changes: 13 additions & 11 deletions src/components/RecentBooks.astro
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
---
import { getCollection } from "astro:content";
import BookListItem from "./BookListItem.astro";
import { getCollection } from "astro:content"
import BookListItem from "./BookListItem.astro"
const allBooks = await getCollection("books");
const allBooks = await getCollection("books")
interface Props {
limit?: number;
slug: string;
limit?: number
slug: string
}
const { slug, limit = 3 } = Astro.props;
const { slug, limit = 3 } = Astro.props
const books = allBooks.filter((book) => {
if (slug === book.slug) return false;
const books = allBooks
.filter((book) => book.data.exclusiveShelf === "read")
.filter((book) => {
if (slug === book.slug) return false
return true;
});
return true
})
---

<div class="my-8">
Expand All @@ -27,7 +29,7 @@ const books = allBooks.filter((book) => {
.sort(
(a, b) =>
new Date(b.data.dateAdded).valueOf() -
new Date(a.data.dateAdded).valueOf()
new Date(a.data.dateAdded).valueOf(),
)
.slice(0, limit)
.map((book) => <BookListItem book={book} />)
Expand Down
38 changes: 20 additions & 18 deletions src/components/RelatedBooks.astro
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
---
import { getCollection } from "astro:content";
import BookListItem from "./BookListItem.astro";
import RecentBooks from "./RecentBooks.astro";
import { getCollection } from "astro:content"
import BookListItem from "./BookListItem.astro"
import RecentBooks from "./RecentBooks.astro"
type Props = {
tags: string[];
slug: string;
};
tags: string[]
slug: string
}
const { tags, slug } = Astro.props;
const { tags, slug } = Astro.props
const allBooks = await getCollection("books");
const books = allBooks.filter((book) => {
if (slug === book.slug) return false;
const allBooks = await getCollection("books")
const books = allBooks
.filter((book) => book.data.exclusiveShelf === "read")
.filter((book) => {
if (slug === book.slug) return false
let keep = false;
tags.forEach((tag: string) => {
if (book.data.tags.includes(tag)) {
keep = true;
}
});
let keep = false
tags.forEach((tag: string) => {
if (book.data.tags.includes(tag)) {
keep = true
}
})
return keep;
});
return keep
})
---

{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,24 @@ id: 58612786
title: "100M Offers How To Make Offers So Good People Feel Stupid Saying No Acquisitioncom 100M Series Book 1"
author: Alex Hormozi
authorLF: Hormozi Alex
additionalAuthors:
additionalAuthors:
ISBN: "1737475707"
ISBN13: "9781737475705"
myRating: 0
averageRating: 4.62
publisher:
publisher:
binding: Kindle Edition
numberOfPages: 210
yearPublished: "2021"
originalPublicationYear: "undefined"
dateRead: "2024-01-25"
dateRead: null
dateAdded: "2022-12-13"
bookshelves: toread
bookshelvesWithPositions: toread 23
exclusiveShelf: toread
myReview:
myReview:
spoiler: null
readCount: 0
ownedCopies: 0
tags: []
---

7 changes: 3 additions & 4 deletions src/content/books/a-room of one’s own.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ id: 18521
title: "A Room of One’s Own"
author: Virginia Woolf
authorLF: Woolf Virginia
additionalAuthors:
additionalAuthors:
ISBN: ""
ISBN13: "undefined"
myRating: 0
Expand All @@ -13,15 +13,14 @@ binding: Paperback
numberOfPages: 112
yearPublished: "2000"
originalPublicationYear: "1929"
dateRead: "2024-01-25"
dateRead: null
dateAdded: "2021-06-28"
bookshelves: toread
bookshelvesWithPositions: toread 30
exclusiveShelf: toread
myReview:
myReview:
spoiler: null
readCount: 0
ownedCopies: 0
tags: []
---

7 changes: 3 additions & 4 deletions src/content/books/bird-by bird.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ id: 12543
title: "Bird by Bird"
author: Anne Lamott
authorLF: Lamott Anne
additionalAuthors:
additionalAuthors:
ISBN: ""
ISBN13: "undefined"
myRating: 0
Expand All @@ -13,15 +13,14 @@ binding: Paperback
numberOfPages: 237
yearPublished: "1995"
originalPublicationYear: "1994"
dateRead: "2024-01-25"
dateRead: null
dateAdded: "2023-01-06"
bookshelves: toread
bookshelvesWithPositions: toread 29
exclusiveShelf: toread
myReview:
myReview:
spoiler: null
readCount: 0
ownedCopies: 0
tags: []
---

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ id: 12951631
title: "Breaking the Habit of Being Yourself How to Lose Your Mind and Create a New One"
author: Joe Dispenza
authorLF: Dispenza Joe
additionalAuthors:
additionalAuthors:
ISBN: "1401938086"
ISBN13: "9781401938086"
myRating: 0
Expand All @@ -13,15 +13,14 @@ binding: Hardcover
numberOfPages: 329
yearPublished: "2012"
originalPublicationYear: "2012"
dateRead: "2024-01-25"
dateRead: null
dateAdded: "2021-03-14"
bookshelves: toread
bookshelvesWithPositions: toread 14
exclusiveShelf: toread
myReview:
myReview:
spoiler: null
readCount: 0
ownedCopies: 0
tags: []
---

9 changes: 4 additions & 5 deletions src/content/books/bridge-over waters.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,24 @@ id: 54644555
title: "Bridge over waters"
author: Tsungai Marandure
authorLF: Marandure Tsungai
additionalAuthors:
additionalAuthors:
ISBN: ""
ISBN13: "undefined"
myRating: 0
averageRating: 0
publisher:
publisher:
binding: Kindle Edition
numberOfPages: null
yearPublished: "2020"
originalPublicationYear: "undefined"
dateRead: "2024-01-25"
dateRead: null
dateAdded: "2020-07-22"
bookshelves: toread
bookshelvesWithPositions: toread 6
exclusiveShelf: toread
myReview:
myReview:
spoiler: null
readCount: 0
ownedCopies: 0
tags: []
---

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ id: 15015
title: "Conversations with God An Uncommon Dialogue Book 1"
author: Neale Donald Walsch
authorLF: Walsch Neale Donald
additionalAuthors:
additionalAuthors:
ISBN: "0399142789"
ISBN13: "9780399142789"
myRating: 0
Expand All @@ -13,15 +13,14 @@ binding: Hardcover
numberOfPages: 223
yearPublished: "1996"
originalPublicationYear: "1995"
dateRead: "2024-01-25"
dateRead: null
dateAdded: "2021-08-09"
bookshelves: toread
bookshelvesWithPositions: toread 19
exclusiveShelf: toread
myReview:
myReview:
spoiler: null
readCount: 0
ownedCopies: 0
tags: []
---

7 changes: 3 additions & 4 deletions src/content/books/cultish-the language of fanaticism.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ id: 55338982
title: "Cultish The Language of Fanaticism"
author: Amanda Montell
authorLF: Montell Amanda
additionalAuthors:
additionalAuthors:
ISBN: "0062993151"
ISBN13: "9780062993151"
myRating: 0
Expand All @@ -13,15 +13,14 @@ binding: Hardcover
numberOfPages: 309
yearPublished: "2021"
originalPublicationYear: "2021"
dateRead: "2024-01-25"
dateRead: null
dateAdded: "2023-09-29"
bookshelves: currentlyreading
bookshelvesWithPositions: currentlyreading 13
exclusiveShelf: currentlyreading
myReview:
myReview:
spoiler: null
readCount: 1
ownedCopies: 0
tags: []
---

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
id: 25744928
title: "Deep Work Rules for Focused Success in a Distracted World"
title: "Deep Work: Rules for Focused Success in a Distracted World"
author: Cal Newport
authorLF: Newport Cal
additionalAuthors:
additionalAuthors:
ISBN: "1455586692"
ISBN13: "9781455586691"
myRating: 5
Expand All @@ -15,13 +15,12 @@ yearPublished: "2016"
originalPublicationYear: "2016"
dateRead: "2023-07-06"
dateAdded: "2023-07-06"
bookshelves:
bookshelvesWithPositions:
bookshelves:
bookshelvesWithPositions:
exclusiveShelf: read
myReview:
myReview:
spoiler: null
readCount: 1
ownedCopies: 0
tags: []
---

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ id: 54651516
title: "Digital Minimalism On Living Better with Less Technology"
author: Cal Newport
authorLF: Newport Cal
additionalAuthors:
additionalAuthors:
ISBN: ""
ISBN13: "undefined"
myRating: 0
Expand All @@ -13,15 +13,14 @@ binding: Kindle Edition
numberOfPages: 294
yearPublished: "2019"
originalPublicationYear: "2019"
dateRead: "2024-01-25"
dateRead: null
dateAdded: "2023-04-11"
bookshelves: toread
bookshelvesWithPositions: toread 34
exclusiveShelf: toread
myReview:
myReview:
spoiler: null
readCount: 0
ownedCopies: 0
tags: []
---

Loading

0 comments on commit 1b2875f

Please sign in to comment.