Remove legacy announcement TypeScript

This commit is contained in:
Andreas Nedbal 2022-11-23 21:01:35 +01:00
parent 3b1f15ebb9
commit b51d8c048d
3 changed files with 0 additions and 21 deletions

View File

@ -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);

View File

@ -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');
}

View File

@ -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');
}
});
}