Bookshelf

This commit is contained in:
2023-06-27 20:59:11 +10:00
parent c9e54bfc04
commit e248cb9146
14 changed files with 91 additions and 38 deletions

View File

@@ -46,3 +46,11 @@ h1, h2, h3, h4, h5, h6, h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {
font-family: "JetBrainsMono", Monaco, monospace;
}
.map-marker {
border: 3px solid blue;
border-radius: 8px;
background: RGBa(0, 0, 255, 0.1);
width: 14px;
height: 14px;
}

View File

@@ -1,9 +1,7 @@
# Colophon
# 🧱 Colophon
Hello! Welcome to dnitza.com 👋
This site is made from:
- Adamantium — A custom-built, [Hanami](https://github.com/hanami/hanami)-based, blogging engine [based on the Micropub spec](https://www.w3.org/TR/micropub/) (open sourced soon).

View File

@@ -21,6 +21,21 @@ module Adamantium
def template_type
:book
end
def authors
self.book_author.split(";").join(" ")
end
def status_colour
case book_status
when "read"
"text-green-100 bg-green-500"
when "to-read"
"text-blue-100 bg-blue-500"
when "reading"
"text-orange-100 bg-orange-500"
end
end
end
end
end

View File

@@ -131,7 +131,7 @@ module Adamantium
posts
.where(post_type: "book")
.published
.order(Sequel.desc(:published_at))
.order(Sequel.asc(:name))
.limit(limit)
.to_a
end

View File

@@ -1,23 +1,41 @@
- context.content_for(:title, "Books | ")
div class="mb-12 prose dark:prose-invert max-w-prose mx-auto text-gray-800 dark:text-gray-200"
h1 Books
h1 📚 Bookshelf
div class="mb-12 max-w-prose mx-auto"
table class="prose dark:prose-invert table-auto"
thead
tr
td Title
td Author
td Status
- books.each do |book|
td
td class="p-2" Title
td class="p-2" Author(s)
- reading.each do |book|
tr
td
/ a href="/books/#{book.slug}"
span class="rounded-md text-xs #{book.status_colour} p-1"
= book.book_status
td
= book.name
td
= book.book_author
= book.authors
- to_read.each do |book|
tr
td
= book.book_status
span class="rounded-md text-xs #{book.status_colour} p-1"
= book.book_status
td
= book.name
td
= book.authors
- read.each do |book|
tr
td
span class="rounded-md text-xs #{book.status_colour} p-1"
= book.book_status
td
= book.name
td
= book.authors
div class="max-w-screen-md mx-auto border-t-4 border-solid border-gray-400 dark:border-gray-600"

View File

@@ -17,5 +17,6 @@ div class="mb-12 max-w-prose mx-auto text-gray-800 dark:text-gray-200"
a class="block p-1 border border-blue-200 bg-blue-200 text-blue-900 hover:bg-blue-300 text-center rounded-lg" href="/movies" 🍿 Movies
a class="block p-1 border border-blue-200 bg-blue-200 text-blue-900 hover:bg-blue-300 text-center rounded-lg" href="/trips" 🛫 Trips
a class="block p-1 border border-blue-200 bg-blue-200 text-blue-900 hover:bg-blue-300 text-center rounded-lg" href="/podcasts" 🎙️ Podcasts
a class="block p-1 border border-blue-200 bg-blue-200 text-blue-900 hover:bg-blue-300 text-center rounded-lg" href="/bookshelf" 📚️ Bookshelf
/ a class="block p-1 border border-blue-200 bg-blue-300 text-blue-900 hover:bg-blue-200 text-center rounded-lg" href="/art" 🎨 Art things

View File

@@ -1,7 +1,7 @@
- context.content_for(:title, "Movies | ")
div class="mb-12 prose dark:prose-invert max-w-prose mx-auto text-gray-800 dark:text-gray-200"
h1 Movies
h1 🍿 Movies
div class="mb-12 max-w-prose mx-auto"
table class="prose dark:prose-invert table-auto"

View File

@@ -1,7 +1,7 @@
- context.content_for(:title, "Podcasts | ")
div class="mb-12 prose dark:prose-invert max-w-prose mx-auto text-gray-800 dark:text-gray-200"
h1 Podcasts
h1 🎙️ Podcasts
div class="mb-12 max-w-prose mx-auto"
table class="prose dark:prose-invert table-auto"

View File

@@ -1,7 +1,7 @@
- context.content_for(:title, "Trips | ")
div class="mb-4 prose dark:prose-invert max-w-prose mx-auto text-gray-800 dark:text-gray-200"
h1 Trips
h1 🛫 Trips
div class="mb-12 max-w-prose mx-auto"
table class="prose dark:prose-invert table-auto"

View File

@@ -1,7 +1,7 @@
- context.content_for(:title, "Hikes | ")
div class="mb-12 prose dark:prose-invert max-w-prose mx-auto text-gray-800 dark:text-gray-200"
h1 Hikes
h1 🥾 Hikes
div class="prose dark:prose-invert max-w-prose mx-auto"
- workouts_by_year.each do |year, workouts|

View File

@@ -4,8 +4,24 @@ module Adamantium
class Index < Adamantium::View
include Deps["repos.post_repo"]
expose :books do
post_repo.books_listing.map do |book|
private_expose :books do
post_repo.books_listing.group_by { |book| book.book_status }
end
expose :read do |books|
books["read"].map do |book|
Decorators::Books::Decorator.new book
end
end
expose :to_read do |books|
books["to-read"].map do |book|
Decorators::Books::Decorator.new book
end
end
expose :reading do |books|
books["reading"].map do |book|
Decorators::Books::Decorator.new book
end
end