diff --git a/web/components/audit-page.tsx b/web/components/audit-page.tsx index c75bbe2..f33f42a 100644 --- a/web/components/audit-page.tsx +++ b/web/components/audit-page.tsx @@ -1,3 +1,4 @@ +import Image from "next/image"; import { ArrowLeft, ArrowRight } from "lucide-react"; import { CopyCommandButton } from "@/components/copy-command"; import { GitHubMark } from "@/components/icons"; @@ -7,6 +8,7 @@ import { buttonVariants } from "@/components/ui/button"; import { cn } from "@/lib/utils"; import { AUDITS, PROMPTS, auditCommand, auditTitle } from "@/lib/content"; import { auditDetail } from "@/lib/audit-details"; +import { heroSrc } from "@/lib/heroes"; import { glossify } from "@/lib/glossary"; import { SITE_URL } from "@/lib/site"; import { type Lang, t } from "@/lib/i18n"; @@ -19,6 +21,7 @@ export function AuditDetailPage({ name, lang }: { name: string; lang: Lang }) { if (!audit || !detail) return null; const Icon = audit.icon; + const hero = heroSrc(name); const home = lang === "de" ? "/de" : "/"; const langHref = lang === "de" ? `/audits/${name}` : `/de/audits/${name}`; @@ -72,9 +75,33 @@ export function AuditDetailPage({ name, lang }: { name: string; lang: Lang }) {
-
-
-
+
+ {hero ? ( + <> + + {/* Left-weighted scrim so the headline/CTA stay legible over the image. */} +
+ + ) : ( +
+ )} +
public hero-image path, by matching `.` in + * `public/`. Read once at module load (build / server render). Imported only by + * the server-rendered audit page, so the `fs` read never reaches a client + * bundle. No match returns null and the audit page keeps its typographic grid + * hero, so dropping a new `public/.webp` lights up a hero with no code change. + */ +const heroByKey: ReadonlyMap = (() => { + const map = new Map(); + if (existsSync(PUBLIC_DIR)) { + for (const file of readdirSync(PUBLIC_DIR)) { + const ext = IMG.exec(file); + if (!ext) continue; + const key = file.slice(0, -ext[0].length); + if (!map.has(key)) map.set(key, `/${file}`); + } + } + return map; +})(); + +/** The public path to an audit's hero image, or null if none has been added. */ +export function heroSrc(name: string): string | null { + return heroByKey.get(name) ?? null; +} diff --git a/web/public/accessibility.webp b/web/public/accessibility.webp new file mode 100644 index 0000000..4ad3a3b Binary files /dev/null and b/web/public/accessibility.webp differ diff --git a/web/public/ai-llm.webp b/web/public/ai-llm.webp new file mode 100644 index 0000000..0898553 Binary files /dev/null and b/web/public/ai-llm.webp differ diff --git a/web/public/api.webp b/web/public/api.webp new file mode 100644 index 0000000..8cafa00 Binary files /dev/null and b/web/public/api.webp differ diff --git a/web/public/compliance-privacy.webp b/web/public/compliance-privacy.webp new file mode 100644 index 0000000..f1e111e Binary files /dev/null and b/web/public/compliance-privacy.webp differ diff --git a/web/public/content.webp b/web/public/content.webp new file mode 100644 index 0000000..223c043 Binary files /dev/null and b/web/public/content.webp differ diff --git a/web/public/data.webp b/web/public/data.webp new file mode 100644 index 0000000..6e1043b Binary files /dev/null and b/web/public/data.webp differ diff --git a/web/public/documentation.webp b/web/public/documentation.webp new file mode 100644 index 0000000..24dec30 Binary files /dev/null and b/web/public/documentation.webp differ diff --git a/web/public/frontend.webp b/web/public/frontend.webp new file mode 100644 index 0000000..078ec01 Binary files /dev/null and b/web/public/frontend.webp differ diff --git a/web/public/infrastructure.webp b/web/public/infrastructure.webp new file mode 100644 index 0000000..95f5cf7 Binary files /dev/null and b/web/public/infrastructure.webp differ diff --git a/web/public/lean.webp b/web/public/lean.webp new file mode 100644 index 0000000..9ced754 Binary files /dev/null and b/web/public/lean.webp differ diff --git a/web/public/performance.webp b/web/public/performance.webp new file mode 100644 index 0000000..c3c8ac2 Binary files /dev/null and b/web/public/performance.webp differ diff --git a/web/public/repo.webp b/web/public/repo.webp new file mode 100644 index 0000000..1415a88 Binary files /dev/null and b/web/public/repo.webp differ diff --git a/web/public/security.webp b/web/public/security.webp new file mode 100644 index 0000000..680f406 Binary files /dev/null and b/web/public/security.webp differ