All files / src/features/Merchants/MerchantSidePanel/ApprovalFlowPanel/components TasksCardHeader.tsx

100% Statements 7/7
85.71% Branches 6/7
100% Functions 1/1
100% Lines 7/7

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                                        21x 157x 157x 157x     157x       157x   157x                                                    
import { Stack } from "@mui/material";
import { TChipColors } from "@shared/Chip/GiveChip";
import GiveUnderwritingSidepanelTitle from "../../components/GiveUnderwritingSidepanelTitle";
import { useMerchantSidePanelContext } from "../../Provider/MerchantSidePanelProvider";
import GiveUnderwritingProgressBarV2 from "../../components/GiveUnderwritingProgressBarV2";
 
type Props = {
  status: {
    label: string;
    color: string;
  };
  counts: {
    completed: number;
    incomplete: number;
    incomplete2: number;
    disabled: number;
    hasData: boolean;
  };
};
 
const TasksCardHeader = ({ status, counts }: Props) => {
  const { data, isPendingView, queries } = useMerchantSidePanelContext();
  const { color, label } = status || {};
  const { completed, incomplete, incomplete2, disabled, hasData } = counts;
 
  const isLoading =
    queries?.merchantQuery?.isLoading ||
    !queries?.merchantQuery?.isSuccess ||
    queries?.merchantQuery?.isError;
 
  const imageUrl = data?.header?.imageURL;
 
  return (
    <Stack gap="12px">
      <GiveUnderwritingSidepanelTitle
        title={data?.merchantInfo?.merchantName}
        imageUrl={imageUrl ? imageUrl + "/thumb" : undefined}
        id={data?.merchantInfo?.merchantID}
        businessData={data?.businessProfile}
        label={label}
        color={color as TChipColors}
        isLoading={isLoading}
      />
      <Stack direction="row" justifyContent="space-between"></Stack>
      <GiveUnderwritingProgressBarV2
        completed={completed}
        incomplete={incomplete}
        incomplete2={incomplete2}
        hasData={hasData}
        disabled={disabled}
        label={label}
        isPendingView={isPendingView}
      />
    </Stack>
  );
};
 
export default TasksCardHeader;