Show the edition statement on cards and in the library

The edition comes only from a record for this exact edition: the Library
of Congress record's edition statement first, then Open Library's edition
name when it is a well-formed statement. Existing books are filled in at
startup without changing anything else about them.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Fable 5.2 committed 2026-11-19 17:49:59 -07:00
1 parent e83774adbd
commit bb46d343a8
26 files changed
+455 -34

No files matched your search

+1 -1
View File
@@ -5,7 +5,7 @@ import { CallNo } from './CallNo.tsx';
import { StateMark, StateText } from './StateMark.tsx';
function Main({ book, showYear }: { book: Book; showYear: boolean }) {
const byline = [displayAuthors(book.authors).join(', '), showYear ? book.year : null].filter(Boolean).join(' · ');
const byline = [displayAuthors(book.authors).join(', '), showYear ? book.edition : null, showYear ? book.year : null].filter(Boolean).join(' · ');
return (
<span class="row-main">
<span class="row-title">{book.title}</span>
+8
View File
@@ -43,6 +43,7 @@ function EditorForm({ book, fixing, initial, onClose }: {
const [authors, setAuthors] = useState(book ? displayAuthors(book.authors).join('; ') : initial?.authors ?? '');
const [publisher, setPublisher] = useState(book?.publisher ?? '');
const [year, setYear] = useState(book?.year?.toString() ?? '');
const [edition, setEdition] = useState(book?.edition ?? '');
const [callNumber, setCallNumber] = useState(book?.callNumber ?? '');
const [picked, setPicked] = useState<SearchResult | null>(null);
const [yearError, setYearError] = useState('');
@@ -77,6 +78,7 @@ function EditorForm({ book, fixing, initial, onClose }: {
title: title.trim(), authors: names,
...(y.value !== null ? { year: y.value } : {}),
...(publisher.trim() ? { publisher: publisher.trim() } : {}),
...(edition.trim() ? { edition: edition.trim() } : {}),
...(callNumber.trim() ? { callNumber: callNumber.trim() } : {}),
});
upsertBook(created); setLastScan(created.id, false);
@@ -85,6 +87,8 @@ function EditorForm({ book, fixing, initial, onClose }: {
return;
}
const patch: BookPatch = { title: title.trim(), authors: names, publisher: publisher.trim() || null, year: y.value };
// Only a changed edition is sent: an untouched empty one stays "not looked up yet" so the catalogue can fill it.
if (edition.trim() !== (book.edition ?? '')) patch.edition = edition.trim();
const numberChanged = callNumber.trim() !== (book.callNumber ?? '');
if (numberChanged) patch.callNumber = callNumber.trim();
let saved = await api.patchBook(book.id, patch);
@@ -130,6 +134,10 @@ function EditorForm({ book, fixing, initial, onClose }: {
</label>
</div>
{yearError ? <p class="error" role="alert">{yearError}</p> : null}
<label class="field">Edition
<input value={edition} onInput={e => setEdition(e.currentTarget.value)} />
<span class="help">From the catalogue when it has one, for example Third edition. Optional.</span>
</label>
<label class="field">Call number
<input class="mono" value={callNumber} onInput={e => setCallNumber(e.currentTarget.value)} />
<span class="help">{book ? 'Changing this locks the number' : 'Optional. Leave it empty to have it looked up.'}</span>