2021-03-08 18:12:59 +05:30
|
|
|
export const getStorageKey = (appEl) => appEl.getAttribute('data-storage-key');
|
2021-02-22 17:27:13 +05:30
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
export const setNotification = (appEl) => {
|
2021-02-22 17:27:13 +05:30
|
|
|
const storageKey = getStorageKey(appEl);
|
|
|
|
const notificationEl = document.querySelector('.header-help');
|
|
|
|
let notificationCountEl = notificationEl.querySelector('.js-whats-new-notification-count');
|
|
|
|
|
|
|
|
if (JSON.parse(localStorage.getItem(storageKey)) === false) {
|
|
|
|
notificationEl.classList.remove('with-notifications');
|
|
|
|
if (notificationCountEl) {
|
|
|
|
notificationCountEl.parentElement.removeChild(notificationCountEl);
|
|
|
|
notificationCountEl = null;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
notificationEl.classList.add('with-notifications');
|
|
|
|
}
|
|
|
|
};
|