[...slug].astroAstro131 lines5.7 KiBtoo large to serve raw — clone the repo
---
import ContourField from '../../components/ContourField.astro';
import { render } from 'astro:content';
import Base from '../../layouts/Base.astro';
import Icon from '../../components/Icon.astro';
import ReportMark from '../../components/ReportMark.astro';
import SheetCredit from '../../components/SheetCredit.astro';
import SheetReferences from '../../components/SheetReferences.astro';
import Toc from '../../components/Toc.astro';
import { categoryOf } from '../../lib/taxonomy';
import { sheetsByCategory, prevNext, sheetHref, isReportGuide, tagSlug, toolHref, type Sheet } from '../../lib/sheets';
import { url } from '../../lib/url';
export async function getStaticPaths() {
const groups = await sheetsByCategory();
const paths: any[] = [];
for (const g of groups) {
// Cross-listed sheets still generate one canonical page and pagination.
const primaryItems = g.items.filter((entry) => entry.data.category === g.slug);
for (const entry of primaryItems) {
const { prev, next } = prevNext(primaryItems, entry);
paths.push({ params: { slug: entry.id }, props: { entry, prev, next } });
}
}
return paths;
}
interface Props { entry: Sheet; prev?: Sheet; next?: Sheet }
const { entry, prev, next } = Astro.props;
const d = entry.data;
const reportGuide = isReportGuide(entry);
const cat = categoryOf(d.category);
const { Content, headings } = await render(entry);
const pdfHref = d.pdf ? url(`pdfs/${d.pdf}`) : null;
---
<Base title={`${d.title} — DÆMON//SEC`} description={d.description}>
<div class="wrap">
<nav class="breadcrumb" style="margin-top:1.5rem;">
<a href={url('')}>~</a><span class="sep">/</span>
<a href={url(cat.slug)} style={`color: var(--${cat.accent})`}>{cat.tag.toLowerCase()}</a>
<span class="sep">/</span>
<span class="muted">{entry.id.split('/').pop()}</span>
</nav>
<header class="sheet-head plate signal-hero" data-pagefind-meta={`category:${cat.title}`}>
{/* The contour field, in the plate's night values. It draws no line
inside a `data-contour-clear` box, and it reads at most six of
them, so the head's small type is gathered into three: the
eyebrow's words, the title block, and the meta lines. Each box
hugs its words (`.sheet-head__block`, `.eyebrow__text`), so the
lines run beside the type rather than stopping a column short. */}
<ContourField />
<span class="grain grain--local" aria-hidden="true"></span>
<span class="scanlines" aria-hidden="true"></span>
<p class="eyebrow" style={`--acc: var(--${cat.accent});`}>
<span class="eyebrow__text" data-contour-clear>
<span class="eyebrow__n">{cat.tag}</span>
<span class="eyebrow__mark">^:</span>
<span>{cat.title}</span>
</span>
<span class="eyebrow__rule" aria-hidden="true"></span>
</p>
<div class="sheet-head__block" data-contour-clear>
<h1 class="sheet-title" data-pagefind-meta="title"><span data-title-text>{d.title}</span> <ReportMark marked={reportGuide} /></h1>
{reportGuide && (
<p class="report-sequence-note"><button type="button" class="report-index-link" data-report-index-open aria-haspopup="dialog" aria-controls="report-index-dialog">☧ Unlock tool order</button></p>
)}
{d.description && <p class="sheet-desc">{d.description}</p>}
</div>
<div class="sheet-head__block" data-contour-clear>
<div class="sheet-meta">
<span class="badge badge--{d.difficulty}">{d.difficulty}</span>
{d.updated && <span class="badge">updated {d.updated}</span>}
</div>
{d.tags.length > 0 && (
<div class="tags-row" style="margin-top:0.8rem;">
{d.tags.map((t) => <a class="tag-pill" href={url(`tags/${tagSlug(t)}`)}>#{t}</a>)}
</div>
)}
{/* Every tool the sheet uses, each a link to the other sheets that use
it — the badge this replaces showed the first four as plain text. */}
{d.tools.length > 0 && (
<div class="tags-row tools-row" style="margin-top:0.5rem;">
<span class="tools-row__label"><Icon name="wrench" />Tools</span>
{d.tools.map((t) => <a class="tag-pill tag-pill--tool" href={url(toolHref(t))}>{t}</a>)}
</div>
)}
</div>
</header>
<SheetCredit
name={d.upstreamName}
upstreamUrl={d.upstreamUrl}
author={d.upstreamAuthor}
license={d.upstreamLicense}
relation={d.upstreamRelation}
copyright={d.upstreamCopyright}
/>
<div class="sheet-layout">
<article class="prose" data-pagefind-body>
{pdfHref && (
<figure class="code-pane plate corners" style="margin-bottom:1.6rem;">
<figcaption class="code-pane__bar">
<span class="code-pane__lang">{d.pdf}</span>
<a class="code-copy" href={pdfHref} download>Download</a>
</figcaption>
<iframe class="pdf-frame" src={pdfHref} title={`${d.title} (PDF)`} loading="lazy"></iframe>
</figure>
)}
<Content />
<SheetReferences references={d.references} />
</article>
<Toc headings={headings} numbered />
</div>
<nav class="prevnext" aria-label="Pagination">
{prev ? (
<a href={url(sheetHref(prev))} style={`--acc: var(--${cat.accent})`}>
<span class="dir">← Prev</span><strong>{prev.data.title}</strong>
</a>
) : <span></span>}
{next ? (
<a class="nx" href={url(sheetHref(next))} style={`--acc: var(--${cat.accent})`}>
<span class="dir">Next →</span><strong>{next.data.title}</strong>
</a>
) : <span></span>}
</nav>
</div>
</Base>