All files / src/features/Merchants/MerchantSidePanel/GiveMerchantFile/businessProfile GiveBusinessProfileTag.tsx

100% Statements 5/5
100% Branches 6/6
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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109                                                            77x 67x   67x                                 38x                                                                                                                    
import { memo } from "react";
import GiveChip, { TChipColors } from "@shared/Chip/GiveChip";
import { ChipProps, SxProps } from "@mui/material";
 
export type BusinessProfileStatusType =
  | "pending"
  | "pending_review"
  | "move_back_to_pending"
  | "approved"
  | "declined"
  | "suspended"
  | "ready_for_verification"
  | "declined_by_msp"
  | "pending_review_issue"
  | "In progress"
  | "Delivered"
  | "Undeliverable"
  | "incomplete"
  | "linking";
 
interface Props {
  statusCode?: BusinessProfileStatusType;
  sx?: SxProps;
  size?: ChipProps["size"];
}
function GiveBusinessProfileTag({
  statusCode,
  sx = {},
  size = "small",
}: Props) {
  if (!statusCode || !BusinessProfileStatus[statusCode]) return <></>;
  const { label, color } = BusinessProfileStatus[statusCode];
 
  return (
    <GiveChip
      variant="outline"
      size={size}
      label={label}
      color={color}
      sx={sx}
    />
  );
}
 
export default memo(GiveBusinessProfileTag);
 
type StatusObject = { label: string; color: TChipColors };
export const BusinessProfileStatus: Record<
  BusinessProfileStatusType,
  StatusObject
> = {
  pending_review: {
    label: "Pending Review",
    color: "warning",
  },
  move_back_to_pending: {
    label: "Pending",
    color: "default",
  },
  approved: {
    label: "Approved",
    color: "success",
  },
  declined: {
    label: "Declined",
    color: "error",
  },
  suspended: {
    label: "Suspended",
    color: "warning",
  },
  ready_for_verification: {
    label: "Ready for Verification",
    color: "blue",
  },
  pending: {
    label: "Pending",
    color: "default",
  },
  declined_by_msp: {
    label: "Pending",
    color: "default",
  },
  pending_review_issue: {
    label: "Pending",
    color: "default",
  },
  "In progress": {
    label: "In progress",
    color: "warning",
  },
  Delivered: {
    label: "Delivered",
    color: "warning",
  },
  Undeliverable: {
    label: "Undeliverable",
    color: "error",
  },
  incomplete: {
    label: "Incomplete",
    color: "warning",
  },
  linking: {
    label: "Linking Request",
    color: "default",
  },
};