Added layouts + routes

This commit is contained in:
2026-09-22 15:21:19 +02:00
parent 5cad56000c
commit 3f9574dce6
15 changed files with 331 additions and 23 deletions

View File

@@ -0,0 +1,47 @@
---
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<Record<Status, string>> = {
draft: 'Draft – not build in production',
unlisted: 'Unlisted – has page, but appears in no list',
archived: 'Archived - 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
---
{site && (here.length || elsewhere.length || notice) && (
<aside class="dev-banner">
{notice && <p class="notice">{notice}</p>}
{here.length > 0 && (
<ul>
{here.map((d) => (
<li class={d.level}>
{d.level === 'error' ? '✖' : '▲'} {d.message}
</li>
))}
</ul>
)}
{elsewhere.length > 0 && (
<details>
<summary>{elsewhere.length} problem(s) elsewhere</summary>
<pre>{formatDiagnostics(elsewhere)}</pre>
</details>
)}
</aside>
)}