CodebaseRow

tcmts.registry.pages.CodebaseRow · #qw4afqy4 · term · runs anywhere

A listed codebase in a list: its name, opening its page; how many definitions it has, as mirrored; who lists it, what it is, where it's served (opening its own web UI) and when it was listed.

import type { Trusted } from "#codebase/tcmts/cli/attest";
import { codebaseBrowseHref, codebaseHost, codebaseHref, said, whoHref } from "#codebase/tcmts/registry";
import type { RegistryCodebase } from "#codebase/tcmts/registry";
import { ago } from "#codebase/tcmts/share";

export function CodebaseRow({ c, who }: { c: RegistryCodebase; who: Trusted }) {
  return (
    <div className="lib">
      <div>
        <a className="name mono" href={codebaseHref(who, c.name)}>
          {said(who)}/{c.name}
        </a>
      </div>
      {c.definitions !== undefined && (
        <div className="stat">
          <b>{c.definitions.toLocaleString("en")}</b>
          definition{c.definitions === 1 ? "" : "s"}
        </div>
      )}
      {c.description && <div className="desc">{c.description}</div>}
      <div className="meta">
        <span>
          by <a href={whoHref(who)}>{said(who)}</a>
        </span>
        <a className="mono" href={codebaseBrowseHref(c)} rel="nofollow noopener">
          {codebaseHost(c)} ↗
        </a>
        <span>listed {ago(Date.parse(c.createdAt))}</span>
      </div>
    </div>
  );
}

uses

used by