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

100% Statements 6/6
100% Branches 0/0
100% Functions 1/1
100% Lines 6/6

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                                      21x 2x 2x 2x       2x       2x                                              
import { XIcon } from "@phosphor-icons/react";
import GiveIconButton from "@shared/IconButton/GiveIconButton";
import { SidePanelHeaderBase } from "@shared/SidePanel/components/SidePanelHeader/SidePanelHeader";
import { SidePanelContainerWrapper } from "@shared/SidePanel/SidePanelAtoms";
import GiveText from "@shared/Text/GiveText";
import TasksBody from "./TasksBody/TasksBody";
import { WithRepositoryProvider } from "../../WithRepository/WithRepositoryContext";
import { useConfigureUnderwritingTasks } from "../hooks/useUnderwritingTasksRepository";
import { useGetUnderwritingTasksStats } from "../hooks/useGetUnderwritingTasksStats";
import { CardContainer } from "@features/Underwriting/UnderwritingCard/UnderwritingCard.style";
import { useAppTheme } from "@theme/v2/Provider";
import { Box } from "@mui/material";
import { IParsedData } from "@components/Merchants/MerchantPreview/data.types";
 
type Props = {
  data: IParsedData;
  handleClose: () => void;
};
 
const UnderwritingTasksPanel = ({ data, handleClose }: Props) => {
  const merchantId = data?.merchantInfo?.merchantID;
  const { palette } = useAppTheme();
  const { configs, repositories } = useConfigureUnderwritingTasks({
    merchantId,
  });
 
  const { stats } = useGetUnderwritingTasksStats({
    merchantId,
  });
 
  return (
    <SidePanelContainerWrapper>
      <SidePanelHeaderBase
        leftItems={<GiveText>Underwriting</GiveText>}
        rightItems={
          <GiveIconButton Icon={XIcon} variant="ghost" onClick={handleClose} />
        }
      />
      <WithRepositoryProvider configs={configs} repositories={repositories}>
        <Box
          p="20px"
          sx={{ "& .tasks-actions": { paddingTop: 0, border: "none" } }}
        >
          <CardContainer backgroundColor={palette.surface?.primary}>
            <TasksBody stats={stats} merchantData={data} />
          </CardContainer>
        </Box>
      </WithRepositoryProvider>
    </SidePanelContainerWrapper>
  );
};
 
export default UnderwritingTasksPanel;