Repository Public
1import type { AccessRequest } from "./schemas";23type Labels = { name: string; affiliation: string; email: string; projectTitle: string; researchQuestion: string; compute: string; dates: string; dataConstraints: string; expectedOutputs: string };45/** Plain-text body shared by the mailto: fallback and the server-side email. */6export function requestBody(r: AccessRequest, l: Labels): string {7 const rows: [string, string][] = [8 [l.name, r.name],9 [l.affiliation, r.affiliation],10 [l.email, r.email],11 [l.projectTitle, r.projectTitle],12 [l.researchQuestion, r.researchQuestion],13 [l.compute, r.compute],14 [l.dates, r.dates],15 [l.dataConstraints, r.dataConstraints],16 [l.expectedOutputs, r.expectedOutputs],17 ];18 return rows.filter(([, v]) => v && v.trim()).map(([k, v]) => `${k}\n${v.trim()}`).join("\n\n");19}2021export function mailtoHref(to: string, subject: string, body: string): string {22 return `mailto:${to}?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(body)}`;23}24