All files / src/features/Merchants/MerchantSidePanel/AgreementAndSnapshot/Snapshot/components/merchantApplication BankAccount.tsx

60% Statements 6/10
75% Branches 3/4
25% Functions 1/4
55.55% Lines 5/9

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                  1x 1x 1x 1x                       22x                                      
import SectionCardBase from "@shared/SidePanel/components/SectionCard/SectionCardBase";
import { useMerchantSidePanelContext } from "features/Merchants/MerchantSidePanel/Provider/MerchantSidePanelProvider";
 
import { RenderTextsComponent } from "../BaseCardComponent";
import { IMerchantBankAccount } from "@components/Merchants/MerchantPreview/data.types";
import { isEmpty } from "lodash";
import useSnapShot from "features/Merchants/MerchantSidePanel/hooks/useSnapShot";
 
function BankAccount() {
  const { data } = useMerchantSidePanelContext();
  const { bankAccounts } = useSnapShot();
  const bankAccountList = data?.bankAccountList || [];
  Eif (isEmpty(bankAccountList)) return <></>;
  return (
    <SectionCardBase sx={{ marginTop: "40px" }} leftTitle="Bank Account">
      {bankAccounts.map((bank, index) => (
        <RenderBankDetails key={index} bank={bank} />
      ))}
    </SectionCardBase>
  );
}
 
export default BankAccount;
 
const RenderBankDetails = ({
  bank,
}: {
  bank: {
    label: string;
    value: string | number;
  }[];
}) => {
  return (
    <>
      {bank.map((detail) => (
        <RenderTextsComponent
          key={`${detail.label}-${detail.value}`}
          {...detail}
        />
      ))}
    </>
  );
};