All files / react-app/src/components/Footer index.tsx

100% Statements 18/18
100% Branches 8/8
100% Functions 9/9
100% Lines 17/17

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 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170                                        105x 9x 9x 9x 9x 9x 9x   9x                       1x                 1x                               1x                   1x                         1x                     1x                                                                                                       105x 362x 362x                                
import { useMemo } from "react";
import { Link } from "react-router";
import { isStateUser } from "shared-utils";
 
import { useGetUser, useGetUserDetails } from "@/api";
import { Alert, Button } from "@/components";
import { useFeatureFlag } from "@/hooks/useFeatureFlag";
import { sendGAEvent } from "@/utils/ReactGA/SendGAEvent";
 
type Props = {
  email: string;
  address: {
    street: string;
    state: string;
    city: string;
    zip: number;
  };
  showNavLinks?: boolean;
};
 
export const Footer = ({ email, address, showNavLinks }: Props) => {
  const shouldShowNavLinks = showNavLinks ?? true;
  const { data: user } = useGetUser();
  const { data: userDetailsData } = useGetUserDetails();
  const showUserManagement = useMemo(() => {
    const role = userDetailsData?.role;
    return ["systemadmin", "statesystemadmin", "cmsroleapprover", "helpdesk"].includes(role);
  }, [userDetailsData]);
  const isStateHomepage = useFeatureFlag("STATE_HOMEPAGE_FLAG");
 
  return (
    <footer>
      {shouldShowNavLinks && (
        <section className="bg-[#f0f0f0] text-sm">
          <div className="grid grid-cols-12 gap-4 px-10 py-4 max-w-screen-xl mx-auto">
            <div className="col-span-6 flex gap-8">
              <a
                href="/"
                className="underline font-bold"
                onClick={() => {
                  sendGAEvent("home_footer_link", { link_name: "home" });
                }}
              >
                <p>Home</p>
              </a>
              <a
                href="/dashboard"
                className="underline font-bold"
                onClick={() => {
                  sendGAEvent("home_footer_link", { link_name: "dashboard" });
                }}
              >
                <p>Dashboard</p>
              </a>
 
              {showUserManagement && (
                <a href="/usermanagement" className="underline font-bold">
                  <p>User Management</p>
                </a>
              )}
              {isStateHomepage && isStateUser(user.user) && (
                <a
                  href="/latestupdates"
                  className="underline font-bold"
                  onClick={() => {
                    sendGAEvent("home_footer_link", { link_name: "latestupdates" });
                  }}
                >
                  <p>Latest Updates</p>
                </a>
              )}
              <a
                href="/faq"
                className="underline font-bold"
                onClick={() => {
                  sendGAEvent("home_footer_link", { link_name: "support" });
                }}
              >
                <p>Support</p>
              </a>
            </div>
            <div className="col-span-6 flex gap-8 justify-end">
              <p>Help Desk:</p>
              <p>
                <a
                  href="tel:(833) 228-2540"
                  className="underline"
                  onClick={() => {
                    sendGAEvent("home_help_phone", null);
                  }}
                >
                  (833) 228-2540
                </a>
              </p>
              <p>
                <a
                  href="mailto:OneMAC_Helpdesk@cms.hhs.gov"
                  className="underline"
                  onClick={() => {
                    sendGAEvent("home_help_email", null);
                  }}
                >
                  OneMAC_Helpdesk@cms.hhs.gov
                </a>
              </p>
            </div>
          </div>
        </section>
      )}
 
      <section className="bg-sky-100">
        <div className="grid grid-cols-12 gap-4 px-10 py-4 max-w-screen-xl mx-auto">
          <img
            src="/MedicaidLogo.svg"
            alt="Logo for Medicaid"
            className="w-36 col-span-6 sm:col-span-6 justify-self-start self-center sm:justify-self-start sm:self-center"
          />
          <img
            className="max-w-36 col-span-6 sm:col-span-2 justify-self-end self-center"
            src="/DepartmentOfHealthLogo.svg"
            alt="Logo for Department of Health and Human Services"
          />
          <p className="col-span-12 sm:col-span-4">
            A federal government website managed and paid for by the U.S. Centers for Medicare and
            Medicaid Services and part of the MACPro suite.
          </p>
        </div>
      </section>
 
      <div className="w-full bg-primary">
        <div className="px-10 py-4 text-white text-[.8rem] flex flex-col items-center sm:flex-row max-w-screen-xl mx-auto">
          <div>
            Email{" "}
            <a href={`mailto:${email}`} className="font-bold underline">
              {email}
            </a>{" "}
            for help or feedback
          </div>
          <div className="flex-1"></div>
          <div>
            <span className="sm:block">{address.street} </span>
            <span className="sm:block">
              {address.city}, {address.state} {address.zip}
            </span>
          </div>
        </div>
      </div>
    </footer>
  );
};
 
export const FAQFooter = () => {
  const useChipForm = useFeatureFlag("CHIP_SPA_SUBMISSION");
  if (useChipForm) return null;
 
  return (
    <Alert
      variant={"infoBlock"}
      className="mb-8 items-center flex py-8 px-14 flex-row text-sm justify-center gap-24"
    >
      <p className="text-lg">Do you have questions or need support?</p>
      <Link to="/faq" target="_blank">
        <Button className="mx-4" size="lg">
          View FAQs
        </Button>
      </Link>
    </Alert>
  );
};