From 781e4e675ebc097dcbb86ce2474fbd2eb901e0b0 Mon Sep 17 00:00:00 2001 From: Henrik Skog Date: Sat, 27 Jul 2024 19:15:11 +0200 Subject: [PATCH] Remove toast about old.online.ntnu.no --- src/frontpage/components/ToastOld/index.tsx | 48 --------------------- src/frontpage/index.tsx | 32 +++++++------- 2 files changed, 15 insertions(+), 65 deletions(-) delete mode 100644 src/frontpage/components/ToastOld/index.tsx diff --git a/src/frontpage/components/ToastOld/index.tsx b/src/frontpage/components/ToastOld/index.tsx deleted file mode 100644 index 818a5bbf..00000000 --- a/src/frontpage/components/ToastOld/index.tsx +++ /dev/null @@ -1,48 +0,0 @@ -// @ts-nocheck; -import React, { useEffect } from 'react'; -import { useToast } from 'core/utils/toast/useToast'; -import { Checkbox } from '@dotkomonline/design-system'; - -const HIDE_TOAST = 'hideOldOWToast'; -const SESSION_HIDE_TOAST = 'hideToastForSession'; - -const Message: React.FC = () => { - const saveDoNotShow = (isChecked?: boolean) => { - window.localStorage.setItem(HIDE_TOAST, isChecked ? 'true' : 'false'); - }; - - return ( -
-

Heisann!

-

Velkommen til nye Onlinewebben! (OW)

-

- Du kan fortsatt finne den gamle på old.online.ntnu.no -

-

- Oppdager du noen feil, mangler, eller ønsker, send mail til dotkom@online.ntnu.no eller lag et issue på{' '} - Github -

- saveDoNotShow(checked)} label="Ikke vis denne meldingen igjen" /> -
- ); -}; - -const ToastOld: React.FC = () => { - const [displayMessage] = useToast({ type: 'basic', overwrite: true, duration: 1000 * 60 }); - useEffect(() => { - // This should be inside of the useEffect - // With NextJs the window element may be null. - - const permanentlyHiddenToast = window.localStorage.getItem(HIDE_TOAST) === 'true'; - const sessionHiddenToast = window.sessionStorage.getItem(SESSION_HIDE_TOAST) === 'true'; - - // Blame Johannes - if (!permanentlyHiddenToast && !sessionHiddenToast) { - displayMessage(); - window.sessionStorage.setItem(SESSION_HIDE_TOAST, 'true'); - } - }, []); - return null; -}; - -export default ToastOld; diff --git a/src/frontpage/index.tsx b/src/frontpage/index.tsx index 91e3e6b2..f2e36b0b 100644 --- a/src/frontpage/index.tsx +++ b/src/frontpage/index.tsx @@ -1,25 +1,23 @@ -import EventsContainer from 'events/components/EventsContainer'; -import React, { FC } from 'react'; -import Articles from './components/Articles'; -import ForCompanies from './components/ForCompanies'; -import Offline from './components/Offline'; -import ToastOld from './components/ToastOld'; -import { IOfflineIssue } from './models/Offline'; -import AprilFoolsCaptcha from './components/AprilFoolsCaptcha'; +import EventsContainer from "events/components/EventsContainer"; +import React, { FC } from "react"; +import Articles from "./components/Articles"; +import ForCompanies from "./components/ForCompanies"; +import Offline from "./components/Offline"; +import { IOfflineIssue } from "./models/Offline"; +import AprilFoolsCaptcha from "./components/AprilFoolsCaptcha"; interface FrontpageProps { - offlines: IOfflineIssue[]; + offlines: IOfflineIssue[]; } const Frontpage: FC = ({ offlines }) => ( - <> - - - - - - - + <> + + + + + + ); export default Frontpage;