Add entry_id relationship links to Entries
- Introduce reusable EntryLink component - Use EntryLink in Releases and Label detail tables - Link both ID and title to /zxdb/entries/[id] for consistency Signed-off-by: Junie@MacOS
This commit is contained in:
@@ -66,6 +66,9 @@ export type EntryDetailData = {
|
||||
year: number | null;
|
||||
}[];
|
||||
}[];
|
||||
// Additional relationships
|
||||
aliases?: { releaseSeq: number; languageId: string; title: string }[];
|
||||
webrefs?: { link: string; languageId: string; website: { id: number; name: string; link?: string | null } }[];
|
||||
};
|
||||
|
||||
export default function EntryDetailClient({ data }: { data: EntryDetailData | null }) {
|
||||
@@ -286,6 +289,74 @@ export default function EntryDetailClient({ data }: { data: EntryDetailData | nu
|
||||
|
||||
<hr />
|
||||
|
||||
{/* Aliases (alternative titles) */}
|
||||
<div>
|
||||
<h5>Aliases</h5>
|
||||
{(!data.aliases || data.aliases.length === 0) && <div className="text-secondary">No aliases</div>}
|
||||
{data.aliases && data.aliases.length > 0 && (
|
||||
<div className="table-responsive">
|
||||
<table className="table table-sm table-striped align-middle">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style={{ width: 90 }}>Release #</th>
|
||||
<th style={{ width: 120 }}>Language</th>
|
||||
<th>Title</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{data.aliases.map((a, idx) => (
|
||||
<tr key={`${a.releaseSeq}-${a.languageId}-${idx}`}>
|
||||
<td>#{a.releaseSeq}</td>
|
||||
<td>{a.languageId}</td>
|
||||
<td>{a.title}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
|
||||
{/* Web links (external references) */}
|
||||
<div>
|
||||
<h5>Web links</h5>
|
||||
{(!data.webrefs || data.webrefs.length === 0) && <div className="text-secondary">No web links</div>}
|
||||
{data.webrefs && data.webrefs.length > 0 && (
|
||||
<div className="table-responsive">
|
||||
<table className="table table-sm table-striped align-middle">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Website</th>
|
||||
<th style={{ width: 120 }}>Language</th>
|
||||
<th>URL</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{data.webrefs.map((w, idx) => (
|
||||
<tr key={`${w.website.id}-${idx}`}>
|
||||
<td>
|
||||
{w.website.link ? (
|
||||
<a href={w.website.link} target="_blank" rel="noopener noreferrer">{w.website.name}</a>
|
||||
) : (
|
||||
<span>{w.website.name}</span>
|
||||
)}
|
||||
</td>
|
||||
<td>{w.languageId}</td>
|
||||
<td>
|
||||
<a href={w.link} target="_blank" rel="noopener noreferrer">{w.link}</a>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
|
||||
<div>
|
||||
<h5>Files</h5>
|
||||
{(!data.files || data.files.length === 0) && <div className="text-secondary">No files linked</div>}
|
||||
|
||||
Reference in New Issue
Block a user