Added loading message

Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
This commit is contained in:
2025-05-06 14:45:01 +01:00
parent a7c18eea37
commit c29e828d23

View File

@@ -55,43 +55,11 @@
<h1>Next Book</h1> <h1>Next Book</h1>
<p>Suggestions for the next book to read from your Storygraph to-read pile</p> <p>Suggestions for the next book to read from your Storygraph to-read pile</p>
</header> </header>
<main> {{ if index . "Fiction" }}
{{ $cat := "Fiction" }} <main>
{{ $book := index . $cat }} {{ $cat := "Fiction" }}
<div class="category" style="grid-column: span 4;"> {{ $book := index . $cat }}
<h3>{{ $cat }}</h3> <div class="category" style="grid-column: span 4;">
<a href="{{ $book.Link }}" target="_blank">
<img src="{{ $book.Image }}" alt="{{ $book.Name }} cover" style="height: 250px;" />
</a>
<a href="{{ $book.Link }}" target="_blank">{{ $book.Name }}</a>
<div class="rating">⭐ {{ $book.Rating }}</div>
</div>
{{ $cat := "Non-Fiction" }}
{{ $book := index . $cat }}
<div class="category" style="grid-column: span 4;">
<h3>{{ $cat }}</h3>
<a href="{{ $book.Link }}" target="_blank">
<img src="{{ $book.Image }}" alt="{{ $book.Name }} cover" style="height: 250px;" />
</a>
<a href="{{ $book.Link }}" target="_blank">{{ $book.Name }}</a>
<div class="rating">⭐ {{ $book.Rating }}</div>
</div>
{{ $cat := "Comics" }}
{{ $book := index . $cat }}
<div class="category" style="grid-column: span 4;">
<h3>{{ $cat }}</h3>
<a href="{{ $book.Link }}" target="_blank">
<img src="{{ $book.Image }}" alt="{{ $book.Name }} cover" style="height: 250px;" />
</a>
<a href="{{ $book.Link }}" target="_blank">{{ $book.Name }}</a>
<div class="rating">⭐ {{ $book.Rating }}</div>
</div>
{{ range $cat, $book := .}}
{{ if or (eq $cat "Fiction") (eq $cat "Non-Fiction") (eq $cat "Comics") }}
{{ continue }}
{{ end }}
<div class="category">
<h3>{{ $cat }}</h3> <h3>{{ $cat }}</h3>
<a href="{{ $book.Link }}" target="_blank"> <a href="{{ $book.Link }}" target="_blank">
<img src="{{ $book.Image }}" alt="{{ $book.Name }} cover" style="height: 250px;" /> <img src="{{ $book.Image }}" alt="{{ $book.Name }} cover" style="height: 250px;" />
@@ -99,7 +67,45 @@
<a href="{{ $book.Link }}" target="_blank">{{ $book.Name }}</a> <a href="{{ $book.Link }}" target="_blank">{{ $book.Name }}</a>
<div class="rating">⭐ {{ $book.Rating }}</div> <div class="rating">⭐ {{ $book.Rating }}</div>
</div> </div>
{{ end }} {{ $cat := "Non-Fiction" }}
</main> {{ $book := index . $cat }}
<div class="category" style="grid-column: span 4;">
<h3>{{ $cat }}</h3>
<a href="{{ $book.Link }}" target="_blank">
<img src="{{ $book.Image }}" alt="{{ $book.Name }} cover" style="height: 250px;" />
</a>
<a href="{{ $book.Link }}" target="_blank">{{ $book.Name }}</a>
<div class="rating">⭐ {{ $book.Rating }}</div>
</div>
{{ $cat := "Comics" }}
{{ $book := index . $cat }}
<div class="category" style="grid-column: span 4;">
<h3>{{ $cat }}</h3>
<a href="{{ $book.Link }}" target="_blank">
<img src="{{ $book.Image }}" alt="{{ $book.Name }} cover" style="height: 250px;" />
</a>
<a href="{{ $book.Link }}" target="_blank">{{ $book.Name }}</a>
<div class="rating">⭐ {{ $book.Rating }}</div>
</div>
{{ range $cat, $book := .}}
{{ if or (eq $cat "Fiction") (eq $cat "Non-Fiction") (eq $cat "Comics") }}
{{ continue }}
{{ end }}
<div class="category">
<h3>{{ $cat }}</h3>
<a href="{{ $book.Link }}" target="_blank">
<img src="{{ $book.Image }}" alt="{{ $book.Name }} cover" style="height: 250px;" />
</a>
<a href="{{ $book.Link }}" target="_blank">{{ $book.Name }}</a>
<div class="rating">⭐ {{ $book.Rating }}</div>
</div>
{{ end }}
</main>
{{ else }}
<div class="container" style="text-align: center;padding: 4rem;">
<h2>Still loading book recommendations...</h2>
</div>
{{ end }}
</body> </body>
</html> </html>