All files / src/features/Settlements/ReconciliationHub/components HubStatusChip.tsx

100% Statements 4/4
100% Branches 2/2
100% Functions 1/1
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36                  3x                                   3x 19x 19x            
import GiveChip, { TChipColors } from "@shared/Chip/GiveChip";
import { ReconciledStatus } from "../types";
 
// Pale "soft" status pill — the design-system `variant="light" size="large"`
// chip (40px pill, 6px/16px padding, pale fill + tinted text). NOT GiveChip's
// saturated solid colors.
export const STATUS_META: Record<
  ReconciledStatus,
  { label: string; color: TChipColors }
> = {
  settled: { label: "Settled", color: "success" },
  open: { label: "Open", color: "blue" },
  review: { label: "Review", color: "warning" },
};
 
interface Props {
  status: ReconciledStatus;
}
 
/**
 * Renders the derived reconciliation-status chip. The status is computed by the
 * backend from the merchant's remaining (available) balance — see
 * {@link ReconciledStatus} — and is read-only (NOT a selector/dropdown).
 *
 * An unrecognized value falls back to "Review" so an unexpected status surfaces
 * for a human rather than masquerading as the benign "Open"/"Settled".
 */
const HubStatusChip = ({ status }: Props) => {
  const meta = STATUS_META[status] ?? STATUS_META.review;
  return (
    <GiveChip variant="light" size="large" color={meta.color} label={meta.label} />
  );
};
 
export default HubStatusChip;