All files / src/features/Settlements/ReconciliationHub/components PerMerchantBreakdownRow.tsx

100% Statements 3/3
100% Branches 0/0
100% Functions 1/1
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                                2x 14x                                                 2x      
import { Stack } from "@mui/material";
import GiveThumbnail from "@shared/Thumbnail/GiveThumbnail";
import GiveText from "@shared/Text/GiveText";
import { addSizeToImage } from "@utils/image.helpers";
import { memo } from "react";
import { ReconciliationHubMerchantView } from "../types";
import { StyledBodyCell, StyledTableRow } from "../../styles";
import HubStatusChip from "./HubStatusChip";
import { renderAmountCells, renderRateCells } from "./PerMerchantBreakdown.constants";
 
interface Props {
  row: ReconciliationHubMerchantView;
  isMobileView?: boolean;
}
 
/** A single merchant row: Merchant cell (logo + name), amount/rate cells, status chip. */
const PerMerchantBreakdownRow = memo(({ row, isMobileView }: Props) => (
  <StyledTableRow>
    <StyledBodyCell isFirstColumn isMobileView={isMobileView}>
      <Stack direction="row" alignItems="center" gap="12px">
        <GiveThumbnail
          imageUrl={addSizeToImage(row.merchantImageURL, "thumb")}
          size="extra_extra_small"
          type="merchant"
          name={row.merchantName}
        />
        <GiveText variant="bodyS" color="primary">
          {row.merchantName}
        </GiveText>
      </Stack>
    </StyledBodyCell>
    {renderAmountCells(row, isMobileView)}
    {renderRateCells(row, isMobileView)}
    <StyledBodyCell
      align="center"
      isMobileView={isMobileView}
      data-testid={`hub-status-chip-${row.merchantAccID}`}
    >
      <HubStatusChip status={row.reconciledStatus} />
    </StyledBodyCell>
  </StyledTableRow>
));
PerMerchantBreakdownRow.displayName = "PerMerchantBreakdownRow";
 
export default PerMerchantBreakdownRow;