AttestationItem
A review, advisory or yank in the feed: who said what about which release.
import type { Trusted } from "#codebase/tcmts/cli/attest"; import { libraryHref, said, whoHref } from "#codebase/tcmts/registry"; import type { RegistryAttestation, RegistryRelease } from "#codebase/tcmts/registry"; import { Initial } from "#codebase/tcmts/registry/pages"; import { ago } from "#codebase/tcmts/share"; export function AttestationItem({ a, who, r, author, }: { a: RegistryAttestation; who: Trusted; r?: RegistryRelease | undefined; author?: Trusted | undefined; }) { const what = r && author ? ( <a className="mono" href={libraryHref(author, r.package, r.version)}> {said(author)}/{r.package} {r.version} </a> ) : ( <span className="mono">{a.release ?? a.namespace.slice(0, 8)}</span> ); const verb = a.kind === "review" ? ( "reviewed" ) : a.kind === "advisory" ? ( <span className="bad">flagged</span> ) : ( "yanked" ); return ( <div className="ev"> <Initial who={who} /> <div> <div> <a href={whoHref(who)}> <b>{said(who)}</b> </a>{" "} {verb} {what} <span className="when">· {ago(Date.parse(a.createdAt))}</span> </div> <blockquote> {a.kind === "advisory" && ( <span className={`badge ${a.severity === "low" ? "b-edit" : "b-rm"}`}> {a.severity} </span> )}{" "} {a.body.split("\n")[0]} {a.fixedIn ? ` Fixed in ${a.fixedIn}.` : ""} </blockquote> </div> </div> ); }
uses
- tcmts.cli.attest.Trusted
- tcmts.registry.RegistryAttestation
- tcmts.registry.RegistryRelease
- tcmts.registry.libraryHref
- tcmts.registry.pages.Initial
- tcmts.registry.said
- tcmts.registry.whoHref
- tcmts.share.ago