Improved handling of errors and included manual refreshing
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
This commit is contained in:
@@ -54,11 +54,19 @@
|
||||
<header>
|
||||
<h1>Next Book</h1>
|
||||
<p>Suggestions for the next book to read from your Storygraph to-read pile</p>
|
||||
{{ if .Refreshing }}
|
||||
<div>Refreshing recommendations...</div>
|
||||
{{ else if .LastUpdated }}
|
||||
<div>
|
||||
Last Update: {{ .LastUpdated }}
|
||||
<a href="/refresh">Refresh recommendations</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
</header>
|
||||
{{ if index . "Fiction" }}
|
||||
{{ if index .Books "Fiction" }}
|
||||
<main>
|
||||
{{ $cat := "Fiction" }}
|
||||
{{ $book := index . $cat }}
|
||||
{{ $book := index .Books $cat }}
|
||||
<div class="category" style="grid-column: span 4;">
|
||||
<h3>{{ $cat }}</h3>
|
||||
<a href="{{ $book.Link }}" target="_blank">
|
||||
@@ -68,7 +76,7 @@
|
||||
<div class="rating">⭐ {{ $book.Rating }}</div>
|
||||
</div>
|
||||
{{ $cat := "Non-Fiction" }}
|
||||
{{ $book := index . $cat }}
|
||||
{{ $book := index .Books $cat }}
|
||||
<div class="category" style="grid-column: span 4;">
|
||||
<h3>{{ $cat }}</h3>
|
||||
<a href="{{ $book.Link }}" target="_blank">
|
||||
@@ -78,7 +86,7 @@
|
||||
<div class="rating">⭐ {{ $book.Rating }}</div>
|
||||
</div>
|
||||
{{ $cat := "Comics" }}
|
||||
{{ $book := index . $cat }}
|
||||
{{ $book := index .Books $cat }}
|
||||
<div class="category" style="grid-column: span 4;">
|
||||
<h3>{{ $cat }}</h3>
|
||||
<a href="{{ $book.Link }}" target="_blank">
|
||||
@@ -88,7 +96,7 @@
|
||||
<div class="rating">⭐ {{ $book.Rating }}</div>
|
||||
</div>
|
||||
|
||||
{{ range $cat, $book := .}}
|
||||
{{ range $cat, $book := .Books }}
|
||||
{{ if or (eq $cat "Fiction") (eq $cat "Non-Fiction") (eq $cat "Comics") }}
|
||||
{{ continue }}
|
||||
{{ end }}
|
||||
|
||||
Reference in New Issue
Block a user