ChangeCard

tcmts.share.ChangeCard · #vc2p47tw · term · runs on the server

uses tcmts.share.shareNow, which uses process

One change in a contribution (ChangeBox), with what reviewing it adds: "Viewed", its comments, and a form to comment on it.

import { ChangeBox, CommentView, Fold, leafOf, Say, shareNow, ViewedToggle } from "#codebase/tcmts/share";
import type { ReviewItem } from "#codebase/tcmts/share";
import type { Comment, Contribution } from "#codebase/tcmts/store";

export function ChangeCard({
  c,
  item,
  comments,
}: {
  c: Contribution;
  item: ReviewItem;
  comments: Comment[];
}) {
  const s = shareNow();
  return (
    <ChangeBox
      item={item}
      extra={<ViewedToggle k={`${c.id}.${item.path}.${item.hash ?? item.old ?? ""}`} />}
    >
      {comments.map((k) => (
        <CommentView key={k.id} k={k} />
      ))}
      {c.status === "open" && s.caller.role !== "reader" && (
        <div className="card-say">
          <Fold head={<span className="muted">Comment on {leafOf(item.path)}</span>}>
            <Say c={c} about={[]} fixed={item.path} />
          </Fold>
        </div>
      )}
    </ChangeBox>
  );
}

uses

used by