All files / src/lib guide-screenshots.ts

100% Statements 6/6
100% Branches 4/4
100% Functions 3/3
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65                  4x                                                                                         522x             9893x 481x    
/**
 * The user guide shows a screenshot of each feature's page on mouse-over.
 *
 * Every card's page is listed with the demo persona whose menu holds it, so
 * the screenshot shows what that persona sees. `null` is a signed-out visitor.
 * __tests__/e2e/capture-guide-screenshots.spec.ts takes them from the static
 * site; __tests__/unit/lib/guide-screenshots.test.ts fails when a card has no
 * screenshot or a screenshot no card.
 */
export const GUIDE_SCREENS: { href: string; persona: string | null }[] = [
  { href: "/auth/signin", persona: null },
  { href: "/", persona: null },
  { href: "/onboarding", persona: "edcadmin" },
  { href: "/settings", persona: "clinicuser" },
  { href: "/auth/eudi-qr", persona: null },
  { href: "/overview", persona: "regulator" },
  { href: "/catalog", persona: "clinicuser" },
  { href: "/catalog/editor", persona: "clinicuser" },
  { href: "/patient", persona: "patient1" },
  { href: "/analytics", persona: "researcher" },
  { href: "/query", persona: "researcher" },
  { href: "/eehrxf", persona: "clinicuser" },
  { href: "/patient/query", persona: "patient1" },
  { href: "/patient/profile", persona: "patient1" },
  { href: "/patient/research", persona: "patient1" },
  { href: "/patient/programmes", persona: "patient1" },
  { href: "/patient/insights", persona: "patient1" },
  { href: "/docs/klarbefund", persona: "patient1" },
  { href: "/compliance", persona: "regulator" },
  { href: "/compliance/tck", persona: "regulator" },
  { href: "/credentials", persona: "regulator" },
  { href: "/applications", persona: "researcher" },
  { href: "/requests", persona: "researcher" },
  { href: "/supervision", persona: "regulator" },
  { href: "/permits", persona: "regulator" },
  { href: "/activity-report", persona: "regulator" },
  { href: "/information", persona: "regulator" },
  { href: "/jurisdictions", persona: "regulator" },
  { href: "/data/share", persona: "clinicuser" },
  { href: "/data/discover", persona: "researcher" },
  { href: "/negotiate", persona: "researcher" },
  { href: "/tasks", persona: "researcher" },
  { href: "/data/transfer", persona: "researcher" },
  { href: "/admin", persona: "edcadmin" },
  { href: "/admin/components", persona: "edcadmin" },
  { href: "/admin/attestation", persona: "edcadmin" },
  { href: "/admin/tenants", persona: "edcadmin" },
  { href: "/admin/participants", persona: "edcadmin" },
  { href: "/admin/policies", persona: "edcadmin" },
  { href: "/admin/audit", persona: "edcadmin" },
];
 
/** `/patient/query` → `patient-query`, `/` → `home`. */
export function guideScreenshotSlug(href: string): string {
  return href.replace(/^\//, "").replace(/\//g, "-") || "home";
}
 
/** The English screenshot's public path, without the static site's base
 *  path: LocalizedImage adds that, and picks a translated variant under
 *  /images/guide/<lang>/ when there is one (ADR-071). */
export function guideScreenshotSrc(href: string): string | null {
  if (!GUIDE_SCREENS.some((s) => s.href === href)) return null;
  return `/images/guide/${guideScreenshotSlug(href)}.webp`;
}