All files / src/features/Merchants/MerchantSidePanel/GiveMerchantFile/bankAccounts GiveBAStatusChip.tsx

100% Statements 4/4
0% Branches 0/1
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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60                        43x 28x   28x                               43x                                                        
import { BankAccountTagType } from "@common/Tag/BankAccountTag";
import { SxProps } from "@mui/material";
import GiveChip from "@shared/Chip/GiveChip";
import { memo } from "react";
 
type TChip = BankAccountTagType | "update_requested" | "update_requestedV2";
 
type Props = {
  accountStatus?: TChip;
  sx?: SxProps;
};
 
const GiveBAStatusChip = ({ accountStatus = "pending", sx }: Props) => {
  const { color, label } = BAStatus[accountStatus];
 
  return (
    <GiveChip
      variant="light"
      size="small"
      color={color}
      label={label}
      sx={{ marginRight: "5px", maxHeight: "22px", ...sx }}
    />
  );
};
 
type StatusObject = {
  label: string;
  color: "default" | "success" | "warning" | "error";
};
 
const BAStatus: Record<TChip, StatusObject> = {
  pending: {
    label: "Pending",
    color: "default",
  },
  approved: {
    label: "Approved",
    color: "success",
  },
  declined: {
    label: "Declined",
    color: "error",
  },
  upload: {
    label: "Upload",
    color: "warning",
  },
  update_requested: {
    label: "Update Required",
    color: "warning",
  },
  update_requestedV2: {
    label: "Update Requested",
    color: "warning",
  },
};
 
export default memo(GiveBAStatusChip);