BranchesPage

tcmts.share.BranchesPage · #nuulldfo · term · runs on the server

is an async component

The branches: each one's latest change, how far it is from the default, and any contribution proposing it.

import { branchList } from "#codebase/tcmts/cli/changes";
import { ago, at, contributionHref, Frame, shareNow, StateBadge } from "#codebase/tcmts/share";

export async function BranchesPage() {
  const s = shareNow();
  if (!s.signedIn) return <Frame tab="branches" title="Sign in" children={null} />;
  const open = s.cb.store.contributions("open");
  return (
    <Frame tab="branches" title="Branches">
      <div className="narrow">
        <div className="filters">
          <h2 className="title">Branches</h2>
          <span className="right muted">
            a contributor's are under their handle: <code>@ada/…</code>
          </span>
        </div>
        <div className="box">
          {branchList(s.cb).map((b) => {
            const c = open.find((x) => x.source === b.name);
            return (
              <div className="lrow" key={b.name}>
                <div>
                  <a className="mono" href={at(`/history?branch=${encodeURIComponent(b.name)}`)}>
                    <b>{b.name}</b>
                  </a>
                  {b.current && <span className="pill">default</span>}
                  <div className="muted" style={{ fontSize: 13 }}>
                    {b.ts ? `changed ${ago(b.ts)}` : "no history"}
                    {b.current
                      ? ""
                      : ` · ${b.differs} name${b.differs === 1 ? "" : "s"} differ from ${s.cb.store.branch().name}`}
                  </div>
                </div>
                {c && (
                  <span>
                    <a href={contributionHref(c.id)}>
                      #{c.id} {c.title}
                    </a>{" "}
                    <StateBadge c={c} />
                  </span>
                )}
              </div>
            );
          })}
        </div>
      </div>
    </Frame>
  );
}

uses

used by