All files / src/features/Merchants/MerchantSidePanel/Modals/PreviewInvitationModal/components PreviewInvitationModalFooter.tsx

100% Statements 10/10
66.66% Branches 4/6
100% Functions 5/5
100% Lines 10/10

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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89                        1x             6x 6x 6x                             6x 12x     6x               12x                                   1x 6x                                          
import { Text } from "@common/Text";
import { LoginExternalLink } from "@components/Login";
import { giveCorpAddress } from "@constants/constants";
import { Box, Stack } from "@mui/material";
import GiveText from "@shared/Text/GiveText";
import { useAppTheme } from "@theme/v2/Provider";
import { Fragment, useMemo } from "react";
 
type Props = {
  isPAHFromMerchantCreation?: boolean;
};
 
const ExternalLinks = ({
  forceUnderline,
  shouldRenderAdditionalLinks,
}: {
  forceUnderline?: boolean;
  shouldRenderAdditionalLinks?: boolean;
}) => {
  const { palette } = useAppTheme();
  const links = useMemo(
    () => [
      {
        text: "Privacy Policy",
        href: "/privacy",
        alwaysShow: true,
      },
      {
        text: "Support",
        href: "mailto:support@givepayments.com",
        alwaysShow: true,
      },
    ],
    [],
  );
 
  const filteredLinks = links.filter(
    (link: any) => link.alwaysShow || shouldRenderAdditionalLinks,
  );
 
  return (
    <Stack
      direction="row"
      gap="4px"
      marginTop={!forceUnderline ? "16px" : "0"}
      alignItems="center"
    >
      {filteredLinks.map((link, index) => (
        <Fragment key={link.text}>
          <LoginExternalLink
            isDisabled
            underline={palette.text.secondary}
            href={link.href}
            forceUnderline={forceUnderline}
          >
            <GiveText variant="bodyXXS" color="secondary">
              {link.text}
            </GiveText>
          </LoginExternalLink>
          {index < filteredLinks.length - 1 && <Text>-</Text>}
        </Fragment>
      ))}
    </Stack>
  );
};
 
const PreviewInvitationModalFooter = ({ isPAHFromMerchantCreation }: Props) => {
  return (
    <Stack alignItems="center" gap={2}>
      <Stack alignItems="center">
        <GiveText variant="bodyXXS" color="secondary">
          © {new Date().getFullYear()} GivePayments Inc.
        </GiveText>
        <GiveText variant="bodyXXS" color="secondary">
          {giveCorpAddress.line1} {giveCorpAddress.line2}
        </GiveText>
      </Stack>
      <Box>
        <ExternalLinks
          shouldRenderAdditionalLinks={isPAHFromMerchantCreation}
          forceUnderline={isPAHFromMerchantCreation}
        />
      </Box>
    </Stack>
  );
};
 
export default PreviewInvitationModalFooter;