From 1e0014059aee12b30c64f48b911f31ec0de9df96 Mon Sep 17 00:00:00 2001 From: Benjamin Chrobot Date: Sun, 10 Dec 2023 10:12:34 -0500 Subject: [PATCH] style: prefer unreachable code to comment blocks (#1676) --- .../components/NotificationCard.tsx | 98 ++++++++++--------- 1 file changed, 50 insertions(+), 48 deletions(-) diff --git a/src/containers/AdminDashboard/components/NotificationCard.tsx b/src/containers/AdminDashboard/components/NotificationCard.tsx index 5c00aeb22..0e86b334e 100644 --- a/src/containers/AdminDashboard/components/NotificationCard.tsx +++ b/src/containers/AdminDashboard/components/NotificationCard.tsx @@ -1,64 +1,66 @@ -// import Card from "@material-ui/core/Card"; -// import CardContent from "@material-ui/core/CardContent"; -// import Divider from "@material-ui/core/Divider"; -// import { useGetOrganizationNotificationsQuery } from "@spoke/spoke-codegen"; +import Card from "@material-ui/core/Card"; +import CardContent from "@material-ui/core/CardContent"; +import Divider from "@material-ui/core/Divider"; +import { useGetOrganizationNotificationsQuery } from "@spoke/spoke-codegen"; import React from "react"; -// import { -// isPending10DlcCampaignNotice, -// isPricing10DlcNotice, -// isPricingTollFreeNotice, -// isRegister10DlcBrandNotice, -// isRegister10DlcCampaignNotice -// } from "../../../api/notice"; -// import Pending10DlcCampaignNoticeCard from "./Pending10DlcCampaignNoticeCard"; -// import PricingNoticeCard from "./PricingNoticeCard"; -// import Register10DlcNoticeCard from "./Register10DlcNoticeCard"; +import { + isPending10DlcCampaignNotice, + isPricing10DlcNotice, + isPricingTollFreeNotice, + isRegister10DlcBrandNotice, + isRegister10DlcCampaignNotice +} from "../../../api/notice"; +import Pending10DlcCampaignNoticeCard from "./Pending10DlcCampaignNoticeCard"; +import PricingNoticeCard from "./PricingNoticeCard"; +import Register10DlcNoticeCard from "./Register10DlcNoticeCard"; import ShutdownNoticeCard from "./ShutdownNoticeCard"; interface NotificationCardProps { organizationId: string; } -export const NotificationCard: React.FC = () => { +export const NotificationCard: React.FC = ({ + organizationId +}) => { return ; - // const { data, loading, error } = useGetOrganizationNotificationsQuery({ - // variables: { organizationId } - // }); + const { data, loading, error } = useGetOrganizationNotificationsQuery({ + variables: { organizationId } + }); - // if (loading) return null; + if (loading) return null; - // if (error || !data?.notices) { - // return ( - // - // There was an error fetching notifications. - // - // ); - // } + if (error || !data?.notices) { + return ( + + There was an error fetching notifications. + + ); + } - // return ( - //
- // {data?.notices.edges.map(({ node }) => { - // if (window.SHOW_10DLC_REGISTRATION_NOTICES) { - // if ( - // isRegister10DlcBrandNotice(node) || - // isRegister10DlcCampaignNotice(node) - // ) { - // return ; - // } - // if (isPending10DlcCampaignNotice(node)) { - // return ; - // } - // if (isPricing10DlcNotice(node) || isPricingTollFreeNotice(node)) { - // return ; - // } - // } - // return null; - // })} - // {data?.notices.pageInfo.totalCount > 0 && } - //
- // ); + return ( +
+ {data?.notices.edges.map(({ node }) => { + if (window.SHOW_10DLC_REGISTRATION_NOTICES) { + if ( + isRegister10DlcBrandNotice(node) || + isRegister10DlcCampaignNotice(node) + ) { + return ; + } + if (isPending10DlcCampaignNotice(node)) { + return ; + } + if (isPricing10DlcNotice(node) || isPricingTollFreeNotice(node)) { + return ; + } + } + return null; + })} + {data?.notices.pageInfo.totalCount > 0 && } +
+ ); }; export default NotificationCard;