Add ZXDB origins and label types

Show entry origins data and display label type names
in label detail view.

Signed-off-by: codex@lucy.xalior.com
This commit is contained in:
2026-01-10 18:12:30 +00:00
parent e2f6aac856
commit fb206734db
3 changed files with 125 additions and 2 deletions

View File

@@ -22,6 +22,14 @@ export type EntryDetailData = {
linkSite?: string | null;
comments?: string | null;
}[];
origins?: {
type: { id: string; name: string | null };
libraryTitle: string;
publication: string | null;
containerId: number | null;
issueId: number | null;
date: { year: number | null; month: number | null; day: number | null };
}[];
// extra fields for richer details
maxPlayers?: number;
availabletypeId?: string | null;
@@ -340,6 +348,53 @@ export default function EntryDetailClient({ data }: { data: EntryDetailData | nu
<hr />
<div>
<h5>Origins</h5>
{(!data.origins || data.origins.length === 0) && <div className="text-secondary">No origins recorded</div>}
{data.origins && data.origins.length > 0 && (
<div className="table-responsive">
<table className="table table-sm table-striped align-middle">
<thead>
<tr>
<th>Type</th>
<th>Title</th>
<th>Publication</th>
<th style={{ width: 140 }}>Issue</th>
<th style={{ width: 140 }}>Date</th>
</tr>
</thead>
<tbody>
{data.origins.map((o, idx) => {
const dateParts = [o.date.year, o.date.month, o.date.day]
.filter((v) => typeof v === "number" && Number.isFinite(v))
.map((v, i) => (i === 0 ? String(v) : String(v).padStart(2, "0")));
const dateText = dateParts.length ? dateParts.join("/") : "-";
return (
<tr key={`${o.type.id}-${idx}`}>
<td>{o.type.name ?? o.type.id}</td>
<td>{o.libraryTitle}</td>
<td>{o.publication ?? <span className="text-secondary">-</span>}</td>
<td>
{o.issueId ? (
<Link href={`/zxdb/issues/${o.issueId}`}>#{o.issueId}</Link>
) : o.containerId ? (
<span>#{o.containerId}</span>
) : (
<span className="text-secondary">-</span>
)}
</td>
<td>{dateText}</td>
</tr>
);
})}
</tbody>
</table>
</div>
)}
</div>
<hr />
{/* Aliases (alternative titles) */}
<div>
<h5>Aliases</h5>

View File

@@ -9,6 +9,7 @@ type Label = {
id: number;
name: string;
labeltypeId: string | null;
labeltypeName: string | null;
permissions: {
website: { id: number; name: string; link?: string | null };
type: { id: string; name: string | null };
@@ -49,7 +50,11 @@ export default function LabelDetailClient({ id, initial, initialTab, initialQ }:
<div className="d-flex align-items-center justify-content-between flex-wrap gap-2">
<h1 className="mb-0">{initial.label.name}</h1>
<div>
<span className="badge text-bg-light">{initial.label.labeltypeId ?? "?"}</span>
<span className="badge text-bg-light">
{initial.label.labeltypeName
? `${initial.label.labeltypeName} (${initial.label.labeltypeId ?? "?"})`
: (initial.label.labeltypeId ?? "?")}
</span>
</div>
</div>