Show author names in natural order everywhere
Names read from MARC personal-name fields are stored as "Steve Allen", and names already stored as "Allen, Steve" are shown and printed in natural order. Search matches both forms. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
7ae1bcef0a
commit
60fa4ef6f7
17 files changed
+183
-15
No files matched your search
@@ -1,10 +1,11 @@
|
||||
import { displayAuthors } from '../../shared/names.ts';
|
||||
import type { Book } from '../../shared/types.ts';
|
||||
import { rowState } from '../bookstate.ts';
|
||||
import { CallNo } from './CallNo.tsx';
|
||||
import { StateMark, StateText } from './StateMark.tsx';
|
||||
|
||||
function Main({ book, showYear }: { book: Book; showYear: boolean }) {
|
||||
const byline = [book.authors.join(', '), showYear ? book.year : null].filter(Boolean).join(' · ');
|
||||
const byline = [displayAuthors(book.authors).join(', '), showYear ? book.year : null].filter(Boolean).join(' · ');
|
||||
return (
|
||||
<span class="row-main">
|
||||
<span class="row-title">{book.title}</span>
|
||||
|
||||
@@ -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]);
|
||||
|
||||
@@ -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
|
||||
<li role="option" id={`${id}-${i}`} class={'result' + (i === active ? ' active' : '')} aria-selected={i === active}
|
||||
onMouseDown={keep} onMouseMove={() => onHover(i)} onClick={() => onPick(r)}>
|
||||
<span class="result-title">{r.title}</span>
|
||||
<span class="result-sub">{[r.authors.join(', '), r.year, r.publisher].filter(Boolean).join(' · ')}</span>
|
||||
<span class="result-sub">{[displayAuthors(r.authors).join(', '), r.year, r.publisher].filter(Boolean).join(' · ')}</span>
|
||||
</li>
|
||||
))}
|
||||
{footer ? (
|
||||
|
||||
Reference in new issue
Block a user