diff --git a/AGENTS.md b/AGENTS.md index 14f286c..dd9e566 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -153,7 +153,10 @@ Comment what the code does, not what the agent has done. The documentation's pur - Use imperative mood (e.g., "Add feature X", "Fix bug Y"). - Include relevant issue numbers if applicable. - Sign-off commit message as @ +- validation and review: + - When changes are visual or UX-related, provide concrete links/routes to validate. + - Call out what to inspect visually (e.g., section names, table columns, empty states). ### References -- ZXDB setup and API usage: `docs/ZXDB.md` \ No newline at end of file +- ZXDB setup and API usage: `docs/ZXDB.md` diff --git a/src/app/zxdb/entries/[id]/EntryDetail.tsx b/src/app/zxdb/entries/[id]/EntryDetail.tsx index 50e9348..609c3b1 100644 --- a/src/app/zxdb/entries/[id]/EntryDetail.tsx +++ b/src/app/zxdb/entries/[id]/EntryDetail.tsx @@ -28,6 +28,7 @@ export type EntryDetailData = { publication: string | null; containerId: number | null; issueId: number | null; + issue: { id: number; magazineId: number | null; magazineTitle: string | null } | null; date: { year: number | null; month: number | null; day: number | null }; }[]; // extra fields for richer details @@ -359,7 +360,7 @@ export default function EntryDetailClient({ data }: { data: EntryDetailData | nu Type Title Publication - Issue + Issue Date @@ -375,10 +376,17 @@ export default function EntryDetailClient({ data }: { data: EntryDetailData | nu {o.libraryTitle} {o.publication ?? -} - {o.issueId ? ( - #{o.issueId} + {o.issue ? ( +
+ Issue #{o.issue.id} + {o.issue.magazineId != null && ( + + {o.issue.magazineTitle ?? `Magazine #${o.issue.magazineId}`} + + )} +
) : o.containerId ? ( - #{o.containerId} + Container #{o.containerId} ) : ( - )} diff --git a/src/server/repo/zxdb.ts b/src/server/repo/zxdb.ts index 6fe6e3a..2e452a7 100644 --- a/src/server/repo/zxdb.ts +++ b/src/server/repo/zxdb.ts @@ -305,6 +305,7 @@ export interface EntryDetail { publication: string | null; containerId: number | null; issueId: number | null; + issue: { id: number; magazineId: number | null; magazineTitle: string | null } | null; date: { year: number | null; month: number | null; day: number | null }; }[]; // Additional entry fields for richer details @@ -575,6 +576,8 @@ export async function getEntryById(id: number): Promise { origintypeName: string | null; containerId: number | string | null; issueId: number | string | null; + magazineId: number | string | null; + magazineTitle: string | null; dateYear: number | string | null; dateMonth: number | string | null; dateDay: number | string | null; @@ -620,14 +623,25 @@ export async function getEntryById(id: number): Promise { origintypeName: origintypes.name, containerId: searchByOrigins.containerId, issueId: searchByOrigins.issueId, + magazineId: magazines.id, + magazineTitle: magazines.name, dateYear: searchByOrigins.dateYear, dateMonth: searchByOrigins.dateMonth, dateDay: searchByOrigins.dateDay, publication: searchByOrigins.publication, }) .from(searchByOrigins) + .leftJoin(issues, eq(issues.id, searchByOrigins.issueId)) + .leftJoin(magazines, eq(magazines.id, issues.magazineId)) .leftJoin(origintypes, eq(origintypes.id, searchByOrigins.origintypeId)) - .where(eq(searchByOrigins.entryId, id)); + .where(eq(searchByOrigins.entryId, id)) + .orderBy( + asc(searchByOrigins.origintypeId), + desc(searchByOrigins.dateYear), + desc(searchByOrigins.dateMonth), + desc(searchByOrigins.dateDay), + asc(searchByOrigins.libraryTitle) + ); originRows = rows as typeof originRows; } catch {} @@ -655,6 +669,13 @@ export async function getEntryById(id: number): Promise { publication: o.publication ?? null, containerId: o.containerId != null ? Number(o.containerId) : null, issueId: o.issueId != null ? Number(o.issueId) : null, + issue: o.issueId != null + ? { + id: Number(o.issueId), + magazineId: o.magazineId != null ? Number(o.magazineId) : null, + magazineTitle: o.magazineTitle ?? null, + } + : null, date: { year: o.dateYear != null ? Number(o.dateYear) : null, month: o.dateMonth != null ? Number(o.dateMonth) : null,