{book.title}
diff --git a/src/web/components/Editor.tsx b/src/web/components/Editor.tsx
index 6802e84..d70a61d 100644
--- a/src/web/components/Editor.tsx
+++ b/src/web/components/Editor.tsx
@@ -1,5 +1,6 @@
import { useEffect, useState } from 'preact/hooks';
import type { Book, SearchResult } from '../../shared/types.ts';
+import { displayAuthors } from '../../shared/names.ts';
import { api } from '../api.ts';
import type { BookPatch } from '../api.ts';
import { getBook, setLastScan, upsertBook, dispatch, useBooks } from '../live.ts';
@@ -39,7 +40,7 @@ function EditorForm({ book, fixing, initial, onClose }: {
book: Book | undefined; fixing: boolean; initial?: { title?: string; authors?: string }; onClose: () => void;
}) {
const [title, setTitle] = useState(book ? knownTitle(book) || book.title : initial?.title ?? '');
- const [authors, setAuthors] = useState(book?.authors.join('; ') ?? initial?.authors ?? '');
+ 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 [callNumber, setCallNumber] = useState(book?.callNumber ?? '');
@@ -98,7 +99,7 @@ function EditorForm({ book, fixing, initial, onClose }: {
function pick(r: SearchResult) {
setPicked(r);
setTitle(r.title);
- setAuthors(r.authors.join('; '));
+ setAuthors(displayAuthors(r.authors).join('; '));
setPublisher(r.publisher ?? '');
setYear(r.year ? String(r.year) : '');
if (r.lcc[0]) setCallNumber(r.lcc[0]);
diff --git a/src/web/components/Results.tsx b/src/web/components/Results.tsx
index c3471ea..4b49c75 100644
--- a/src/web/components/Results.tsx
+++ b/src/web/components/Results.tsx
@@ -1,3 +1,4 @@
+import { displayAuthors } from '../../shared/names.ts';
import type { SearchResult } from '../../shared/types.ts';
/** Next highlighted index for an arrow key; -1 means nothing is highlighted. */
@@ -22,7 +23,7 @@ export function ResultList({ id, label, results, active, onPick, onHover, footer
onHover(i)} onClick={() => onPick(r)}>
{r.title}
- {[r.authors.join(', '), r.year, r.publisher].filter(Boolean).join(' · ')}
+ {[displayAuthors(r.authors).join(', '), r.year, r.publisher].filter(Boolean).join(' · ')}
))}
{footer ? (
diff --git a/src/web/library.ts b/src/web/library.ts
index 571e8c3..f2820fc 100644
--- a/src/web/library.ts
+++ b/src/web/library.ts
@@ -1,6 +1,7 @@
import type { Book } from '../shared/types.ts';
import { parseCallNumber } from '../shared/callnumber.ts';
import { classNames } from '../shared/lcc-outline.ts';
+import { displayAuthors } from '../shared/names.ts';
import { compareShelf } from './store.ts';
export interface LibraryGroup { key: string; heading: string; books: Book[] }
@@ -17,7 +18,7 @@ export function mainClass(book: Book): string | null {
export function matchesQuery(book: Book, query: string): boolean {
const needle = query.trim().toLowerCase();
if (!needle) return true;
- return [book.title, book.authors.join(' '), book.isbn13 ?? '', book.callNumber ?? ''].some(s => s.toLowerCase().includes(needle));
+ return [book.title, book.authors.join(' '), displayAuthors(book.authors).join(' '), book.isbn13 ?? '', book.callNumber ?? ''].some(s => s.toLowerCase().includes(needle));
}
export const needsAttention = (book: Book) => book.status === 'needs_attention';
diff --git a/src/web/shelve.ts b/src/web/shelve.ts
index 1e64b15..53fdad0 100644
--- a/src/web/shelve.ts
+++ b/src/web/shelve.ts
@@ -1,5 +1,6 @@
import type { Book } from '../shared/types.ts';
import { cardLines, formatCallNumber, parseCallNumber, withYear } from '../shared/callnumber.ts';
+import { displayAuthors } from '../shared/names.ts';
import { cutterFor, mainEntry } from '../shared/cutter.ts';
/** A call number for `authors`/`title` that shelves next to `neighbour`: its class part, a new cutter, then the year. */
@@ -21,7 +22,7 @@ export function findNeighbours(books: Book[], text: string, limit = 8): Book[] {
const out: Book[] = [];
for (const b of books) {
if (!b.callNumber || !parseCallNumber(b.callNumber)) continue;
- if ([b.title, b.authors.join(' ')].some(s => s.toLowerCase().includes(needle))) out.push(b);
+ if ([b.title, b.authors.join(' '), displayAuthors(b.authors).join(' ')].some(s => s.toLowerCase().includes(needle))) out.push(b);
if (out.length >= limit) break;
}
return out;
diff --git a/src/web/views/LastScan.tsx b/src/web/views/LastScan.tsx
index 75db6d3..d176cca 100644
--- a/src/web/views/LastScan.tsx
+++ b/src/web/views/LastScan.tsx
@@ -1,3 +1,4 @@
+import { displayAuthors } from '../../shared/names.ts';
import { useState } from 'preact/hooks';
import { api } from '../api.ts';
import { rowState } from '../bookstate.ts';
@@ -32,7 +33,7 @@ export function LastScan({ onFix }: { onFix: (id: number) => void }) {
return (
{book.title}
- {book.authors.length ? {book.authors.join(', ')}
: null}
+ {book.authors.length ? {displayAuthors(book.authors).join(', ')}
: null}
{s.kind === 'looking' ? <>> : null}
{s.kind === 'ready' ? (