Remove legacy announcement TypeScript
This commit is contained in:
parent
3b1f15ebb9
commit
b51d8c048d
|
@ -4,7 +4,6 @@ import { Application } from '@hotwired/stimulus';
|
||||||
import { definitionsFromContext } from '@hotwired/stimulus-webpack-helpers';
|
import { definitionsFromContext } from '@hotwired/stimulus-webpack-helpers';
|
||||||
|
|
||||||
import start from 'retrospring/common';
|
import start from 'retrospring/common';
|
||||||
import initAnnouncements from 'retrospring/features/announcement';
|
|
||||||
import initAnswerbox from 'retrospring/features/answerbox/index';
|
import initAnswerbox from 'retrospring/features/answerbox/index';
|
||||||
import initInbox from 'retrospring/features/inbox/index';
|
import initInbox from 'retrospring/features/inbox/index';
|
||||||
import initUser from 'retrospring/features/user';
|
import initUser from 'retrospring/features/user';
|
||||||
|
@ -27,7 +26,6 @@ document.addEventListener('turbo:load', initQuestionbox);
|
||||||
document.addEventListener('DOMContentLoaded', initQuestion);
|
document.addEventListener('DOMContentLoaded', initQuestion);
|
||||||
document.addEventListener('DOMContentLoaded', initModeration);
|
document.addEventListener('DOMContentLoaded', initModeration);
|
||||||
document.addEventListener('DOMContentLoaded', initMemes);
|
document.addEventListener('DOMContentLoaded', initMemes);
|
||||||
document.addEventListener('turbo:load', initAnnouncements);
|
|
||||||
document.addEventListener('turbo:load', initLocales);
|
document.addEventListener('turbo:load', initLocales);
|
||||||
document.addEventListener('turbo:load', initFront);
|
document.addEventListener('turbo:load', initFront);
|
||||||
|
|
||||||
|
|
|
@ -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');
|
|
||||||
}
|
|
|
@ -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');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
Loading…
Reference in New Issue