-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
style: prefer unreachable code to comment blocks (#1676)
- Loading branch information
Showing
1 changed file
with
50 additions
and
48 deletions.
There are no files selected for viewing
98 changes: 50 additions & 48 deletions
98
src/containers/AdminDashboard/components/NotificationCard.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<NotificationCardProps> = () => { | ||
export const NotificationCard: React.FC<NotificationCardProps> = ({ | ||
organizationId | ||
}) => { | ||
return <ShutdownNoticeCard />; | ||
|
||
// 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 ( | ||
// <Card style={{ marginBottom: "2em" }}> | ||
// <CardContent>There was an error fetching notifications.</CardContent> | ||
// </Card> | ||
// ); | ||
// } | ||
if (error || !data?.notices) { | ||
return ( | ||
<Card style={{ marginBottom: "2em" }}> | ||
<CardContent>There was an error fetching notifications.</CardContent> | ||
</Card> | ||
); | ||
} | ||
|
||
// return ( | ||
// <div> | ||
// {data?.notices.edges.map(({ node }) => { | ||
// if (window.SHOW_10DLC_REGISTRATION_NOTICES) { | ||
// if ( | ||
// isRegister10DlcBrandNotice(node) || | ||
// isRegister10DlcCampaignNotice(node) | ||
// ) { | ||
// return <Register10DlcNoticeCard key={node.id} {...node} />; | ||
// } | ||
// if (isPending10DlcCampaignNotice(node)) { | ||
// return <Pending10DlcCampaignNoticeCard key={node.id} {...node} />; | ||
// } | ||
// if (isPricing10DlcNotice(node) || isPricingTollFreeNotice(node)) { | ||
// return <PricingNoticeCard key={node.id} {...node} />; | ||
// } | ||
// } | ||
// return null; | ||
// })} | ||
// {data?.notices.pageInfo.totalCount > 0 && <Divider />} | ||
// </div> | ||
// ); | ||
return ( | ||
<div> | ||
{data?.notices.edges.map(({ node }) => { | ||
if (window.SHOW_10DLC_REGISTRATION_NOTICES) { | ||
if ( | ||
isRegister10DlcBrandNotice(node) || | ||
isRegister10DlcCampaignNotice(node) | ||
) { | ||
return <Register10DlcNoticeCard key={node.id} {...node} />; | ||
} | ||
if (isPending10DlcCampaignNotice(node)) { | ||
return <Pending10DlcCampaignNoticeCard key={node.id} {...node} />; | ||
} | ||
if (isPricing10DlcNotice(node) || isPricingTollFreeNotice(node)) { | ||
return <PricingNoticeCard key={node.id} {...node} />; | ||
} | ||
} | ||
return null; | ||
})} | ||
{data?.notices.pageInfo.totalCount > 0 && <Divider />} | ||
</div> | ||
); | ||
}; | ||
|
||
export default NotificationCard; |