--- import type { Status } from '@/lib/constants/status' import { forEntry, formatDiagnostics } from '@/lib/diagnostics/report' import type { Diagnostic } from '@/lib/diagnostics/types' import { getSite } from '@/lib/site' type Props = { collection: string id: string status?: Status diagnostics?: Diagnostic[] } const { collection, id, status, diagnostics = [] } = Astro.props const NOTICE: Partial> = { draft: 'Draft – not built in production', unlisted: 'Unlisted – has page, but appears in no list', } const site = import.meta.env.DEV ? await getSite() : null const here = site ? [...forEntry(site.diagnostics, collection, id), ...diagnostics] : [] const elsewhere = site ? site.diagnostics.filter((d) => !here.includes(d)) : [] const notice = status ? NOTICE[status] : undefined const label = [status && status !== 'published' ? status : null, here.length || null] .filter(Boolean) .join(' · ') --- {site && (here.length || elsewhere.length || notice) && (
Dev{label && {label}}
{notice &&

{notice}

} {here.length > 0 && (
    {here.map((d) => (
  • {d.message}
  • ))}
)} {elsewhere.length > 0 && (
{elsewhere.length} elsewhere
{formatDiagnostics(elsewhere)}
)}
)}