import { PageHeader } from "@/components/PageHeader";
import { RecordLink } from "@/components/RecordLink";
import type { EntityView, RelationItem } from "@/lib/catalog";
/**
* Generic record page: title, summary, sources, claims, and neighbouring relations.
* OnCo EntityDetail was not copied. That file special-cases domain panels.
*/
function RelationBlock({
headingId,
title,
relations,
}: {
headingId: string;
title: string;
relations: RelationItem[];
}) {
return (
{title}
{relations.length === 0 ? (
No {title.toLowerCase()} relations.
) : (
{relations.map((relation) => (
-
{relation.wording}
{" · "}
))}
)}
);
}
export function EntityDetail({ entity }: { entity: EntityView }) {
const currentIndex = entity.readingPath.findIndex((step) => step.id === entity.id);
return (
<>
{entity.glossary ? (
{entity.glossary}
) : null}
{entity.summary}
{entity.tags.length > 0 ? (
{entity.tags.map((tag) => (
- {tag}
))}
) : null}
{entity.readingPath.length > 0 ? (
) : null}
Sources
{entity.sources.length === 0 ? (
No sources.
) : (
{entity.sources.map((source) => (
-
{source.title}
{source.license ? · {source.license} : null}
))}
)}
Claims
{entity.claims.length === 0 ? (
No claims.
) : (
{entity.claims.map((claim) => (
-
{claim.key}
· {claim.status}
{claim.value ? · {claim.value} : null}
))}
)}
Relations
{entity.relationRemainder > 0 ? (
{entity.relationRemainder} more relations are not listed.
) : null}
{entity.collection ? (
{entity.collection.title}
{entity.collection.members.length === 0 ? (
No members.
) : (
{entity.collection.members.map((member) => (
-
))}
)}
) : null}
{entity.related.length > 0 ? (
{entity.related.map((item) => (
-
))}
) : null}
Open graph
{" · "}
Back to {entity.kindLabel}
>
);
}