From 7e04826fa5569e8acd09b20d6d0b4341cc75c7a0 Mon Sep 17 00:00:00 2001 From: patrick Date: Wed, 12 Aug 2026 13:44:14 -0400 Subject: [PATCH] feat: draw covers for books without one Full-bleed serif title on a woven ground, drawn in the browser rather than stored, sized with container queries so one component works from 36px to full page. Colour is hashed into a list of bookcloth tones instead of the hue wheel. The grid and search were falling back to default_cover.jpg because a missing cover made the src "/api/undefined"; they now check for one first. --- .../lib/components/layout/search-form.svelte | 15 +- .../src/lib/components/view/book-cover.svelte | 23 +-- .../lib/components/view/book-thumbnail.svelte | 32 +++- .../components/view/generated-cover.svelte | 163 ++++++++++++++++++ 4 files changed, 203 insertions(+), 30 deletions(-) create mode 100644 frontend/src/lib/components/view/generated-cover.svelte diff --git a/frontend/src/lib/components/layout/search-form.svelte b/frontend/src/lib/components/layout/search-form.svelte index 1d1e945..fdc3c5a 100644 --- a/frontend/src/lib/components/layout/search-form.svelte +++ b/frontend/src/lib/components/layout/search-form.svelte @@ -10,6 +10,7 @@ import { getLibraryState } from '$lib/state/library.svelte'; import type { PaginatedResponse, Book } from '$lib/schema'; import BookImage from '../view/book-image.svelte'; + import GeneratedCover from '../view/generated-cover.svelte'; import { goto } from '$app/navigation'; const libraryState = getLibraryState(); @@ -104,10 +105,16 @@ class="cursor-pointer" >
- + {#if book.cover_image} + + {:else} +
+ +
+ {/if}
{book.title} {book.subtitle} diff --git a/frontend/src/lib/components/view/book-cover.svelte b/frontend/src/lib/components/view/book-cover.svelte index 903a4b9..526164f 100644 --- a/frontend/src/lib/components/view/book-cover.svelte +++ b/frontend/src/lib/components/view/book-cover.svelte @@ -1,5 +1,6 @@ - {book.title} - {#if authors} - {authors} - {/if} + {/if} diff --git a/frontend/src/lib/components/view/book-thumbnail.svelte b/frontend/src/lib/components/view/book-thumbnail.svelte index 6fb35a7..762d01e 100644 --- a/frontend/src/lib/components/view/book-thumbnail.svelte +++ b/frontend/src/lib/components/view/book-thumbnail.svelte @@ -1,6 +1,7 @@ + + + + +