All files / src/features/Merchants/MerchantsTable/components BadgeTooltipContent.tsx

25% Statements 1/4
0% Branches 0/6
0% Functions 0/1
25% Lines 1/4

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                33x                                                                                      
import { useAppTheme } from "@theme/v2/Provider";
import { LastMessageActivityType } from "@hooks/enterprise-api/account/LastMessageActivityType";
import { formatDistanceToNow, fromUnixTime } from "date-fns";
import GiveText from "@shared/Text/GiveText";
import GiveAvatar from "@shared/Avatar/GiveAvatar";
import { Stack } from "@mui/material";
import placeholder from "assets/images/Placeholder.png";
 
const BadgeTooltipContent = ({ data }: { data: LastMessageActivityType }) => {
  const { palette } = useAppTheme();
  const { subject, createdAt, authorAvatar } = data || {};
 
  return (
    <Stack direction="row" spacing="12px">
      <Stack
        color={palette.text.primary}
        spacing="4px"
        width="179px"
        textAlign="left"
      >
        <GiveText variant="bodyXS">Notified Merchant</GiveText>
        <Stack direction="row" spacing="4px">
          <GiveText color="secondary" variant="bodyXS" minWidth={46}>
            Subject:
          </GiveText>
          <GiveText noWrap variant="bodyXS">
            {subject}
          </GiveText>
        </Stack>
        <Stack direction="row" spacing="4px">
          <GiveText color="secondary" variant="bodyXS" minWidth={46}>
            Replied:
          </GiveText>
          <GiveText variant="bodyXS">
            {createdAt
              ? formatDistanceToNow(fromUnixTime(createdAt), {
                  addSuffix: true,
                })
              : "N/A"}
          </GiveText>
        </Stack>
      </Stack>
      <GiveAvatar
        size="24px"
        imageUrl={authorAvatar ? `${authorAvatar}/thumb` : placeholder}
      />
    </Stack>
  );
};
 
export default BadgeTooltipContent;