All files / react-app/src/components/Banner MMDLSpaBanner.tsx

66.66% Statements 4/6
20% Branches 1/5
33.33% Functions 1/3
60% Lines 3/5

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                                                                                                        78x 34x 34x                                                                                  
import { Cross2Icon } from "@radix-ui/react-icons";
import { InfoCircledIcon } from "@radix-ui/react-icons";
import { Link } from "react-router";
 
import { useGetSystemNotifs } from "@/api";
import { FAQ_TAB } from "@/consts";
 
// MMDL banner hidden for UAT until further notice, do not remove
// const MMDLAlertBanner = () => {
//   const { clearNotif, notifications } = useGetSystemNotifs();
//   const isBannerHidden = useHideBanner();
//   if (!notifications.length || isBannerHidden) return null;
 
//   return (
//     <section
//       className="bg-[#E1F3F8] grid md:grid-cols-[min-content_auto_min-content] md:grid-rows-[auto_auto] grid-cols-[auto_auto] gap-4 md:gap-x-4 border-l-[8px] border-[#00A6D2] p-3"
//       aria-label="mmdl-alert-banner"
//     >
//       <InfoCircledIcon className="w-10 h-10" aria-hidden="true" />
//       <div className="flex gap-x-4 flex-grow">
//         <div className="flex flex-col flex-grow">
//           <h3 className="font-bold text-black text-lg break-words">{notifications[0].header}</h3>
//           <p className="text-black leading-normal break-words">{notifications[0].body}</p>
//         </div>
//       </div>
//       <div className="flex space-x-4 col-start-2 md:col-start-auto">
//         {notifications[0].buttonText && (
//           <Link
//             to={notifications[0].buttonLink}
//             onClick={(e) => notifications[0].disabled && e.preventDefault()}
//             target={FAQ_TAB}
//             rel="noopener noreferrer"
//             className="border-2 border-black rounded h-[38px] px-4 text font-bold text-center whitespace-nowrap pt-1"
//           >
//             {notifications[0].buttonText}
//           </Link>
//         )}
//         <button
//           onClick={() => clearNotif(notifications[0].notifId)}
//           aria-label="Dismiss"
//           className="rounded-full w-6 h-6"
//         >
//           <Cross2Icon className="w-full h-full" aria-hidden="true" />
//         </button>
//       </div>
//     </section>
//   );
// };
 
// export default MMDLAlertBanner;
 
//new upgrade banner for OneMAC Upgrade
const MMDLAlertBanner = () => {
  const { clearNotif, notifications } = useGetSystemNotifs();
  Eif (!notifications.length) return null;
 
  return (
    <section
      className="bg-[#046B99] grid md:grid-cols-[min-content_auto_min-content] md:grid-rows-[auto_auto] grid-cols-[auto_auto] gap-4 md:gap-x-4 p-3"
      aria-label="mmdl-alert-banner"
    >
      <InfoCircledIcon className="w-10 h-10 text-white" aria-hidden="true" />
      <div className="flex gap-x-4 flex-grow col-start-2 col-span-2 md:col-span-1">
        <div className="flex flex-col flex-grow">
          <h3 className="font-bold text-white text-lg break-words">{notifications[0].header}</h3>
          <p className="text-white leading-normal break-words">{notifications[0].body}</p>
        </div>
      </div>
      <div className="flex space-x-4 col-start-3 row-start-2 md:row-start-1">
        {notifications[0].buttonText && (
          <Link
            to={notifications[0].buttonLink}
            onClick={(e) => notifications[0].disabled && e.preventDefault()}
            target={FAQ_TAB}
            rel="noopener noreferrer"
            className="border-2 border-white rounded h-[38px] px-4 text font-bold text-center whitespace-nowrap pt-1 text-white"
          >
            {notifications[0].buttonText}
          </Link>
        )}
      </div>
      <div className="flex space-x-4 col-start-4 md:row-start-1">
        <button
          onClick={() => clearNotif(notifications[0].notifId)}
          aria-label="Dismiss"
          className="rounded-full w-6 h-6"
        >
          <Cross2Icon className="w-full h-full text-white" aria-hidden="true" />
        </button>
      </div>
    </section>
  );
};
 
export default MMDLAlertBanner;