From b51d8c048d8d7144d8cf07554462608ce3fe9821 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Wed, 23 Nov 2022 21:01:35 +0100 Subject: [PATCH] Remove legacy announcement TypeScript --- app/javascript/packs/application.ts | 2 -- .../retrospring/features/announcement/close.ts | 5 ----- .../retrospring/features/announcement/index.ts | 14 -------------- 3 files changed, 21 deletions(-) delete mode 100644 app/javascript/retrospring/features/announcement/close.ts delete mode 100644 app/javascript/retrospring/features/announcement/index.ts diff --git a/app/javascript/packs/application.ts b/app/javascript/packs/application.ts index b4f80ef9..e6a85b3e 100644 --- a/app/javascript/packs/application.ts +++ b/app/javascript/packs/application.ts @@ -4,7 +4,6 @@ import { Application } from '@hotwired/stimulus'; import { definitionsFromContext } from '@hotwired/stimulus-webpack-helpers'; import start from 'retrospring/common'; -import initAnnouncements from 'retrospring/features/announcement'; import initAnswerbox from 'retrospring/features/answerbox/index'; import initInbox from 'retrospring/features/inbox/index'; import initUser from 'retrospring/features/user'; @@ -27,7 +26,6 @@ document.addEventListener('turbo:load', initQuestionbox); document.addEventListener('DOMContentLoaded', initQuestion); document.addEventListener('DOMContentLoaded', initModeration); document.addEventListener('DOMContentLoaded', initMemes); -document.addEventListener('turbo:load', initAnnouncements); document.addEventListener('turbo:load', initLocales); document.addEventListener('turbo:load', initFront); diff --git a/app/javascript/retrospring/features/announcement/close.ts b/app/javascript/retrospring/features/announcement/close.ts deleted file mode 100644 index 0068d07f..00000000 --- a/app/javascript/retrospring/features/announcement/close.ts +++ /dev/null @@ -1,5 +0,0 @@ -export default function (event: Event): void { - const announcement = (event.target as HTMLElement).closest(".announcement") as HTMLDivElement; - const announcementId = announcement.dataset.announcementId; - window.localStorage.setItem(`announcement${announcementId}`, 'true'); -} \ No newline at end of file diff --git a/app/javascript/retrospring/features/announcement/index.ts b/app/javascript/retrospring/features/announcement/index.ts deleted file mode 100644 index 077bb4c9..00000000 --- a/app/javascript/retrospring/features/announcement/index.ts +++ /dev/null @@ -1,14 +0,0 @@ -import registerEvents from 'utilities/registerEvents'; -import closeAnnouncementHandler from './close'; - -export default (): void => { - registerEvents([ - { type: 'click', target: document.querySelector('.announcement button.close'), handler: closeAnnouncementHandler }, - ]); - - document.querySelectorAll('.announcement').forEach(function (el: HTMLDivElement) { - if (!window.localStorage.getItem(`announcement${el.dataset.announcementId}`)) { - el.classList.remove('d-none'); - } - }); -}