content-explorer/ui/components/OriginNotice.tsx

22 lines
1.1 KiB
TypeScript
Raw Normal View History

import { originNotices } from "@/lib/catalog";
/** One credit line for each distinct origin. Pages that render the records use this. */
export function OriginNotice({ dataspaceId }: { dataspaceId: string }) {
const notices = originNotices(dataspaceId);
if (notices.length === 0) return null;
return (
<aside className="mx-auto max-w-7xl px-4 pt-6 text-sm text-muted sm:px-6" aria-label="Data origin">
{notices.map((source) => (
<p key={`${source.license}:${source.originSha ?? ""}:${source.attribution}`}>
{source.uri ? <a className="underline" href={source.uri}>{source.attribution}</a> : source.attribution}
{source.licenseUrl ? <> · <a className="underline" href={source.licenseUrl}>{source.license}</a></> : <> · {source.license}</>}
{source.retrievedAt ? <> · retrieved {source.retrievedAt}</> : null}
{source.originSha ? <> · origin {source.originSha}</> : null}
{source.license === "CC-BY-NC-4.0" ? <> · NonCommercial</> : null}
{source.modificationNotice ? <> · {source.modificationNotice}</> : null}
</p>
))}
</aside>
);
}