Skip to content

Commit

Permalink
refactor: use title/content notice type for rewired shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
bchrobot committed Dec 10, 2023
1 parent adb168d commit 6fe0512
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ const validators = {
default: false,
isClient: true
}),
ENABLE_REWIRED_SHUTDOWN_NOTICE: bool({
desc: "Show the Rewired shutdown notice",
default: true
}),
DISABLE_ASSIGNMENT_CASCADE: bool({
desc:
"Whether to just assign from 1 campaign rather than gathering from multiple to fulfill a request",
Expand Down
3 changes: 0 additions & 3 deletions src/containers/AdminDashboard/components/NotificationCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
import Pending10DlcCampaignNoticeCard from "./Pending10DlcCampaignNoticeCard";
import PricingNoticeCard from "./PricingNoticeCard";
import Register10DlcNoticeCard from "./Register10DlcNoticeCard";
import ShutdownNoticeCard from "./ShutdownNoticeCard";
import TitleContentNoticeCard from "./TitleContentNoticeCard";

interface NotificationCardProps {
Expand All @@ -25,8 +24,6 @@ interface NotificationCardProps {
export const NotificationCard: React.FC<NotificationCardProps> = ({
organizationId
}) => {
return <ShutdownNoticeCard />;

const { data, loading, error } = useGetOrganizationNotificationsQuery({
variables: { organizationId }
});
Expand Down
10 changes: 9 additions & 1 deletion src/server/lib/notices/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import type { Notice } from "@spoke/spoke-codegen";

import { config } from "../../../config";
import { get10DlcBrandNotices } from "./register-10dlc-brand";
import SpokeRewiredShutdownNotice from "./spoke-rewired-shutdown";
import type { OrgLevelNotificationGetter } from "./types";

export const getInstanceNotifications = (_userId: string): Notice[] => [];
export const getInstanceNotifications = (_userId: string): Notice[] => {
return [
...(config.ENABLE_REWIRED_SHUTDOWN_NOTICE
? [SpokeRewiredShutdownNotice]
: [])
];
};

export const getOrgLevelNotifications: OrgLevelNotificationGetter = async (
userId,
Expand Down
16 changes: 16 additions & 0 deletions src/server/lib/notices/spoke-rewired-shutdown.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { TitleContentNotice } from "@spoke/spoke-codegen";

const shutdownNoticeContent = `Politics Rewired is winding down operations. Text messages will no longer be deliverable after **November 15, 2023** and your instance will no longer be available after **November 22, 2023**. Please find more details in our transition document here: [https://www.politicsrewired.com](https://www.politicsrewired.com)
Thank you for choosing us for your texting outreach, and we wish you the best of luck with all of your future organizing work ❤️`;

export const SpokeRewiredShutdownNotice: TitleContentNotice = {
__typename: "TitleContentNotice",
id: "shutdown-notice",
title: "Spoke Rewired Shutdown",
avatarIcon: "announcement",
avatarColor: "error",
markdownContent: shutdownNoticeContent
};

export default SpokeRewiredShutdownNotice;

0 comments on commit 6fe0512

Please sign in to comment.