Skip to documentation

Design system / Sources & standards

Current repository source

memberCounts.tsx

src/components/members/memberCounts.tsx

This view contains the escaped source read during the deployment build. Code and policy text are unchanged. Markdown is shown as source, not rendered as a document. A new deployment refreshes the content.

import { Button } from "@/components/ui/button";
import { Text } from "@/components/ui/text";
import type { MemberCounts as Counts, MemberFilter } from "./member-directory-model";

/** Members-owned molecule: scoped saved totals and filter-opening intent. */
export function MemberCounts({ counts, unavailable = false, highlightVersion = 0, onSelect }: {
  counts: Counts; unavailable?: boolean; highlightVersion?: number; onSelect?: (filter: MemberFilter, trigger: HTMLButtonElement) => void;
}) {
  if (unavailable) return <Text variant="supporting" className="text-text-muted">Invitation counts are unavailable until the list loads.</Text>;
  const cells: Array<[MemberFilter, string, number]> = [
    ["all", "Total", counts.total], ["linked", "Linked members", counts.linked], ["unclaimed", "Unclaimed", counts.unclaimed],
  ];
  if (counts.unknown) cells.push(["unknown", "Linkage unknown", counts.unknown]);
  return <div className="min-w-0 space-y-2">
    <div className="flex flex-wrap items-center gap-x-2 gap-y-1" aria-label="Invitation counts">
      {cells.map(([filter, label, value]) => <Button key={filter} type="button" variant="ghost" size="sm"
        disabled={!onSelect} onClick={(event) => onSelect?.(filter, event.currentTarget)}
        aria-label={`View ${label.toLowerCase()}: ${value}`}
        className="relative h-auto min-h-8 gap-1 px-2 py-1 text-supporting pointer-coarse:min-h-11">
        {filter === "all" && highlightVersion > 0 && <span key={highlightVersion} aria-hidden="true" data-slot="member-total-highlight"
          className="pointer-events-none absolute -inset-px animate-success-border rounded-[inherit] border border-success motion-reduce:hidden" />}
        <Text as="span" variant="supporting">{label}</Text>
        <strong className="tabular-nums">{value}</strong>
      </Button>)}
    </div>
    {counts.pending > 0 && <Text variant="supporting" role="status" className="text-text-muted">{counts.pending} assignment{counts.pending === 1 ? "" : "s"} saving; not included in saved totals.</Text>}
  </div>;
}
All sources and standards
Current components and theme tokens. Fictional example data. Source views refresh on deployment; authors maintain contract notes.