Redesign the interface around Scan and Library, classify uncatalogued books from similar ones
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
308c0e1ed3
commit
6cec404e21
71 files changed
+8634
-1502
No files matched your search
@@ -0,0 +1,45 @@
|
||||
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(' · ');
|
||||
return (
|
||||
<span class="row-main">
|
||||
<span class="row-title">{book.title}</span>
|
||||
{byline ? <span class="row-sub">{byline}</span> : null}
|
||||
<StateText book={book} />
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
/** A queued book on the Scan screen: state, call number, title, and the actions that apply. */
|
||||
export function QueueRow({ book, onFix, onRemove }: { book: Book; onFix: () => void; onRemove: () => void }) {
|
||||
const kind = rowState(book).kind;
|
||||
return (
|
||||
<li class={'row row-queue row-' + kind} data-book-id={book.id}>
|
||||
<StateMark book={book} />
|
||||
<CallNo value={kind === 'looking' ? null : book.callNumber} approximate={book.confidence === 'approximate'} source={book.source} />
|
||||
<Main book={book} showYear={false} />
|
||||
<span class="row-actions">
|
||||
{kind === 'attention' ? <button type="button" class="btn" onClick={onFix}>Fix</button> : null}
|
||||
<button type="button" class="btn-icon" onClick={onRemove} aria-label={`Remove "${book.title}"`} title="Remove">×</button>
|
||||
</span>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
||||
/** A book in the Library: the whole row opens the editor. */
|
||||
export function LibraryRow({ book, onOpen }: { book: Book; onOpen: () => void }) {
|
||||
const kind = rowState(book).kind;
|
||||
return (
|
||||
<li data-book-id={book.id}>
|
||||
<button type="button" class={'row row-library row-' + kind} onClick={onOpen}>
|
||||
<StateMark book={book} />
|
||||
<CallNo value={kind === 'looking' ? null : book.callNumber} approximate={book.confidence === 'approximate'} source={book.source} />
|
||||
<Main book={book} showYear />
|
||||
</button>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user