SPB Git

Repository Public MIT

page.tsx 2.7 KB 40 lines tsx

1import type { Metadata } from "next";2import Link from "next/link";3import { ActionForm, Field } from "@/components/action-form";4import { submitReport } from "./actions";56export const metadata: Metadata = { title: "Report a problem", robots: { index: false } };78const CATEGORIES = [["malware", "Malicious or harmful behaviour"], ["secret-leak", "Leaked credential or private data"], ["license", "Licence or copyright problem"], ["impersonation", "Impersonation or misleading identity"], ["spam", "Spam"], ["broken", "Broken or unusable"], ["other", "Something else"]];910export default async function Page({ searchParams }: { searchParams: Promise<{ artifact?: string; version?: string }> }) {11  const sp = await searchParams;12  return (13    <div className="container-page max-w-2xl pb-10 pt-12">14      <p className="eyebrow mb-3">Trust</p>15      <h1 className="text-3xl font-semibold tracking-tight">Report a problem</h1>16      <p className="mb-8 mt-3 text-muted">17        No account is needed. Reports go to the registry moderators and are handled under the <Link className="link" href="/docs/security">security policy</Link>. For a vulnerability in the registry itself, use the private channel on the <Link className="link" href="/contact">contact page</Link> instead.18      </p>19      <ActionForm action={submitReport} submit="Send report" className="card space-y-5 p-6">20        <Field label="Artifact" name="artifact" required defaultValue={sp.artifact ?? ""} placeholder="@namespace/slug" pattern="@?[a-z0-9-]+/[a-z0-9-]+" autoComplete="off" />21        <Field label="Version (optional)" name="version" defaultValue={sp.version ?? ""} placeholder="1.0.0" autoComplete="off" />22        <Field label="Category" name="category">23          <select id="f-category" name="category" required className="input" defaultValue="">24            <option value="" disabled>Choose a category</option>25            {CATEGORIES.map(([v, l]) => <option key={v} value={v}>{l}</option>)}26          </select>27        </Field>28        <Field label="What is wrong?" name="details" hint="20 to 5000 characters. Include file paths and what you observed. Do not paste secrets.">29          <textarea id="f-details" name="details" required minLength={20} maxLength={5000} rows={6} className="input py-2" aria-describedby="h-details" />30        </Field>31        <Field label="Contact (optional)" name="contact" type="email" hint="Only used to follow up on this report." autoComplete="email" />32        <div className="hidden" aria-hidden>33          <label htmlFor="f-website">Leave this field empty</label>34          <input id="f-website" name="website" tabIndex={-1} autoComplete="off" />35        </div>36      </ActionForm>37    </div>38  );39}40
Files main
Menu

Theme