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

100% Statements 3/3
71.42% Branches 5/7
100% Functions 2/2
100% Lines 3/3

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                                                  24x                   180x                                       1620x                  
import SectionCardBase from "shared/SidePanel/components/SectionCard/SectionCardBase";
import GiveBusinessProfileTag from "./GiveBusinessProfileTag";
import { BusinessProfileStatusType } from "components/common/Tag/BusinessProfileTag";
import { Grid } from "@mui/material";
import { Fragment } from "react/jsx-runtime";
import GiveDivider from "shared/GiveDivider/GiveDivider";
import { GiveSectionItem } from "../GiveSectionItem";
import {
  ActionsType,
  DisabledActionType,
} from "shared/SidePanel/components/SectionCard/SectionCardBase.types";
import LinkingBPInProgress from "./LinkingBPInProgress";
import { ISectionItem } from "@features/TransactionPanel/types";
 
type BusinessProfileSectionContentProps = {
  items: ISectionItem[];
  actions: ActionsType;
  disabledActions?: DisabledActionType;
  status?: BusinessProfileStatusType;
  linkedBPTaxId?: string;
  merchantId?: number;
  showLinkedApprovalButtons?: boolean;
  email?: string;
};
 
export const BusinessProfileSectionContent = ({
  items,
  disabledActions,
  actions,
  status,
  linkedBPTaxId,
  merchantId,
  showLinkedApprovalButtons = true,
  email,
}: BusinessProfileSectionContentProps) => {
  return (
    <SectionCardBase
      leftTitle="Business Profile"
      actions={actions}
      disabledActions={disabledActions}
      {...(status && {
        tag: <GiveBusinessProfileTag statusCode={status} />,
      })}
    >
      {linkedBPTaxId && (
        <LinkingBPInProgress
          taxId={linkedBPTaxId}
          merchantAccId={merchantId}
          showLinkedApprovalButtons={showLinkedApprovalButtons}
          email={email}
        />
      )}
 
      <Grid container spacing={2}>
        {items.map((item, index) => (
          <Fragment key={index}>
            {item.split && <GiveDivider key={`${index}-${item.title}`} />}
            <GiveSectionItem key={`${item.title}-${index}`} item={item} />
          </Fragment>
        ))}
      </Grid>
    </SectionCardBase>
  );
};