From c354872904e57c8f0c087965d63a4870aad90d2a Mon Sep 17 00:00:00 2001 From: Andy Jiang Date: Mon, 16 Oct 2023 11:11:21 -0400 Subject: [PATCH] Revert "feat(temporary banners) (#517)" This reverts commit 2f51e07936bc948aa1b388e676109b138e0fdd86. --- frontend/alert/pages/_app.tsx | 16 +- frontend/alert/pages/index.tsx | 8 +- frontend/plan/pages/_app.tsx | 19 +- .../review/src/components/Announcement.js | 206 ----------------- frontend/review/src/index.js | 43 ++-- .../src/common/Announcement.tsx | 213 ------------------ 6 files changed, 20 insertions(+), 485 deletions(-) delete mode 100644 frontend/review/src/components/Announcement.js delete mode 100644 frontend/shared-components/src/common/Announcement.tsx diff --git a/frontend/alert/pages/_app.tsx b/frontend/alert/pages/_app.tsx index 96508a264..d04b6e0b8 100644 --- a/frontend/alert/pages/_app.tsx +++ b/frontend/alert/pages/_app.tsx @@ -1,8 +1,7 @@ import React from "react"; import * as Sentry from "@sentry/browser"; import { createGlobalStyle } from "styled-components"; -import Head from "next/head"; -import { Announcement } from "pcx-shared-components/src/common/Announcement"; +import Head from 'next/head' Sentry.init({ dsn: "https://7c27d176a3984f8c931600ca1751d526@sentry.pennlabs.org/16", @@ -32,19 +31,6 @@ function App({ Component, pageProps }) { - -
- -
); } diff --git a/frontend/alert/pages/index.tsx b/frontend/alert/pages/index.tsx index ee224ee20..c03accaa4 100644 --- a/frontend/alert/pages/index.tsx +++ b/frontend/alert/pages/index.tsx @@ -148,9 +148,9 @@ function App() { // update on router value updates as it fires multiple times, starting with null. useEffect(() => { - // change page based on url route query. - setPage(router.query.route ? (router.query.route as string) : "home"); - }, [router.query.route]); + // change page based on url route query. + setPage(router.query.route ? router.query.route as string : "home"); + }, [router.query.route]) useEffect(() => { ReactGA.initialize("UA-21029575-12"); @@ -270,7 +270,7 @@ function App() { ) : null} ) : ( - + )} diff --git a/frontend/plan/pages/_app.tsx b/frontend/plan/pages/_app.tsx index 566a70cfa..55516b267 100644 --- a/frontend/plan/pages/_app.tsx +++ b/frontend/plan/pages/_app.tsx @@ -8,7 +8,6 @@ import "rc-slider/assets/index.css"; import "../styles/App.css"; import * as Sentry from "@sentry/browser"; import type { AppProps } from "next/app"; -import { Announcement } from "pcx-shared-components/src/common/Announcement"; Sentry.init({ dsn: "https://b476d74f4a224b5ea5bd44449cfc5d67@sentry.pennlabs.org/17", @@ -16,23 +15,7 @@ Sentry.init({ // eslint-disable-next-line function App({ Component, pageProps }: AppProps) { - return ( - <> - -
- -
- - ); + return ; } export default App; diff --git a/frontend/review/src/components/Announcement.js b/frontend/review/src/components/Announcement.js deleted file mode 100644 index 36def7cd7..000000000 --- a/frontend/review/src/components/Announcement.js +++ /dev/null @@ -1,206 +0,0 @@ -import React, { useEffect, useRef, useState } from "react"; - -const issueIcon = - "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjUiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNSAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICAgIDxwYXRoCiAgICAgICAgZD0iTTI0LjY0MjggMTkuMDc2N0wxNC44ODMyIDEuOTQyODFDMTQuNjM5NCAxLjUyMzA0IDE0LjI5MTIgMS4xNzQ5OSAxMy44NzMzIDAuOTMzMTQ5QzEzLjQ1NTMgMC42OTEzMTEgMTIuOTgyMSAwLjU2NDA4NyAxMi41MDA2IDAuNTY0MDg3QzEyLjAxOSAwLjU2NDA4NyAxMS41NDU4IDAuNjkxMzExIDExLjEyNzkgMC45MzMxNDlDMTAuNzA5OSAxLjE3NDk5IDEwLjM2MTcgMS41MjMwNCAxMC4xMTc5IDEuOTQyODFMMC4zNTgzMjIgMTkuMDc2N0MwLjEyMzY2NCAxOS40ODI3IDAgMTkuOTQ0NSAwIDIwLjQxNDdDMCAyMC44ODUgMC4xMjM2NjQgMjEuMzQ2OCAwLjM1ODMyMiAyMS43NTI4QzAuNTk5MDggMjIuMTc1MSAwLjk0NjY1MSAy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EwLjYxNTIgMTAuOTY2IDEwLjQ2OTggMTEuMDQ4NCAxMC4zMTA1IDExLjA4ODZDMTAuMTUxNCAxMS4xMjkzIDkuOTg0MzcgMTEuMTI2NCA5LjgyNjgzIDExLjA4MDRDOS42NjkyOSAxMS4wMzQzIDkuNTI3MSAxMC45NDY4IDkuNDE1MiAxMC44MjY5TDUuNDg3OCA2LjkwNzgxTDEuNTYwNCAxMC44MjY5QzEuMzg2ODggMTAuOTg4MSAxLjE1NzUyIDExLjA3NTggMC45MjA1MTIgMTEuMDcxN0MwLjY4MzUwNSAxMS4wNjc2IDAuNDU3MzE1IDEwLjk3MiAwLjI4OTQ4MSAxMC44MDVDMC4xMjIwODcgMTAuNjM3NSAwLjAyNjI3MzggMTAuNDExOCAwLjAyMjE3OTcgMTAuMTc1M0MwLjAxODA4NTUgOS45Mzg3OSAwLjEwNjAyOSA5LjcwOTkxIDAuMjY3NTI3IDkuNTM2NzdMNC4xOTQ5MyA1LjYxNzY3TDAuMjY3NTI3IDEuNjk4NTdDMC4wOTYyMjA5IDEuNTI3NDIgMCAxLjI5NTQxIDAgMS4wNTM1QzAgMC44MTE2MDMgMC4wOTYyMjA5IDAuNTc5NTkzIDAuMjY3NTI3IDAuNDA4NDM2WiIKICAgICAgICBmaWxsPSIjQkFCQUJBIiAvPgo8L3N2Zz4KICAgIA=="; - -const COLORS = { - issue: "#EF4B5F", - notice: "#209CEE" -}; - -const useDismiss = key => { - const dismissKey = `dismissed-${key}`; - const [dismissed, setDismissed] = useState(() => true); - useEffect(() => { - setDismissed(window.localStorage.getItem(dismissKey) === "true"); - }, []); - const dismiss = () => { - window.localStorage.setItem(dismissKey, "true"); - setDismissed(true); - }; - return { dismissed, dismiss }; -}; - -const useIsClamped = ref => { - const [isClamped, setIsClamped] = useState(false); - - useEffect(() => { - const handleResize = () => { - if (!ref.current) { - return; - } - const { clientHeight, scrollHeight } = ref.current; - setIsClamped(clientHeight < scrollHeight); - }; - handleResize(); - window.addEventListener("resize", handleResize); - return () => window.removeEventListener("resize", handleResize); - }, [ref]); - - return isClamped; -}; - -/** - * - * Temporary hard-coded announcement banner for maintenance (231014) - */ -export const Announcement = ({ - type, - title - // message, -}) => { - const { dismissed, dismiss } = useDismiss( - `org.pennlabs.announcements.outage.231014` - ); - const textRef = useRef(null); - const isClamped = useIsClamped(textRef); - const [expanded, setExpanded] = useState(false); - - const icon = type === "issue" ? issueIcon : infoIcon; - - if (dismissed) return null; - - return ( - <> - {/* @ts-ignore */} - -
-
- -
-
-
- {title && ( -
- {title} -
- )} -
- 🔧 We're performing essential maintenance over Fall Break weekend. - Please expect possible service interruptions until Sunday. We - greatly appreciate your understanding.{" "} - - Contact us - {" "} - for assistance. -
- {isClamped && ( -
- -
- )} -
-
- -
-
-
- - ); -}; diff --git a/frontend/review/src/index.js b/frontend/review/src/index.js index 89818515b..463940508 100755 --- a/frontend/review/src/index.js +++ b/frontend/review/src/index.js @@ -13,7 +13,6 @@ import { ReviewPage } from "./pages"; import { GoogleAnalytics } from "./components/common"; -import { Announcement } from "./components/Announcement"; if (window.location.hostname !== "localhost") { window.Raven.config( @@ -22,33 +21,19 @@ if (window.location.hostname !== "localhost") { } ReactDOM.render( - <> - - - - - - - - - - - -
- -
- , + + + + + + + + + + + , document.getElementById("root") ); diff --git a/frontend/shared-components/src/common/Announcement.tsx b/frontend/shared-components/src/common/Announcement.tsx deleted file mode 100644 index efb0e1e2f..000000000 --- a/frontend/shared-components/src/common/Announcement.tsx +++ /dev/null @@ -1,213 +0,0 @@ -import { useEffect, useRef, useState } from "react"; - -const issueIcon = - "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjUiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNSAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICAgIDxwYXRoCiAgICAgICAgZD0iTTI0LjY0MjggMTkuMDc2N0wxNC44ODMyIDEuOTQyODFDMTQuN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NTc5NTkzIDAuMjY3NTI3IDAuNDA4NDM2WiIKICAgICAgICBmaWxsPSIjQkFCQUJBIiAvPgo8L3N2Zz4KICAgIA=="; - -export interface AnnouncementProps { - type: "issue" | "notice"; - title?: string; - // message: string -} - -const COLORS = { - issue: "#EF4B5F", - notice: "#209CEE", -}; - -const useDismiss = (key: string) => { - const dismissKey = `dismissed-${key}`; - const [dismissed, setDismissed] = useState(() => true); - useEffect(() => { - setDismissed(window.localStorage.getItem(dismissKey) === "true"); - }, []); - const dismiss = () => { - window.localStorage.setItem(dismissKey, "true"); - setDismissed(true); - }; - return { dismissed, dismiss }; -}; - -const useIsClamped = (ref: React.RefObject) => { - const [isClamped, setIsClamped] = useState(false); - - useEffect(() => { - const handleResize = () => { - if (!ref.current) { - return; - } - const { clientHeight, scrollHeight } = ref.current; - setIsClamped(clientHeight < scrollHeight); - }; - handleResize(); - window.addEventListener("resize", handleResize); - return () => window.removeEventListener("resize", handleResize); - }, [ref]); - - return isClamped; -}; - -/** - * - * Temporary hard-coded announcement banner for maintenance (231014) - */ -export const Announcement: React.FC = ({ - type, - title, - // message, -}) => { - const { dismissed, dismiss } = useDismiss( - `org.pennlabs.announcements.outage.231014` - ); - const textRef = useRef(null); - const isClamped = useIsClamped(textRef); - const [expanded, setExpanded] = useState(false); - - const icon = type === "issue" ? issueIcon : infoIcon; - - if (dismissed) return null; - - return ( - <> - {/* @ts-ignore */} - -
-
- -
-
-
- {title && ( -
- {title} -
- )} -
- 🔧 We're performing essential maintenance over Fall - Break weekend. Please expect possible service - interruptions until Sunday. We greatly appreciate - your understanding.{" "} - - Contact us - {" "} - for assistance. -
- {isClamped && ( -
- -
- )} -
-
- -
-
-
- - ); -};