diff --git a/repo/menu/client.mjs b/repo/menu/client.mjs index 5002f0d..5ae3183 100644 --- a/repo/menu/client.mjs +++ b/repo/menu/client.mjs @@ -44,6 +44,7 @@ export default async function ({ env, fs, storage, registry, web }, db) { notifications.count++; } } + if ((await storage.get(['last_read_changelog'])) !== env.version) notifications.count++; if (notifications.count) { web.render( $sidebarLink.children[0], diff --git a/repo/menu/menu.mjs b/repo/menu/menu.mjs index 216c550..823c792 100644 --- a/repo/menu/menu.mjs +++ b/repo/menu/menu.mjs @@ -7,7 +7,7 @@ 'use strict'; import * as api from '../../api/_.mjs'; -import { notifications, $welcomeModal } from './notifications.mjs'; +import { notifications, $changelogModal } from './notifications.mjs'; const { env, fs, storage, registry, web, components } = api; for (const mod of await registry.list((mod) => registry.enabled(mod.id))) { @@ -348,8 +348,8 @@ const $coreNavItem = web.html`core`, ${await components.feather('clock', { class: 'nav-changelog-icon' })} `; $changelogNavItem.addEventListener('click', () => { - $welcomeModal.scrollTop = 0; - $welcomeModal.classList.add('modal-visible'); + $changelogModal.scrollTop = 0; + $changelogModal.classList.add('modal-visible'); }); web.render( diff --git a/repo/menu/notifications.mjs b/repo/menu/notifications.mjs index 1d5d4eb..8b34643 100644 --- a/repo/menu/notifications.mjs +++ b/repo/menu/notifications.mjs @@ -67,10 +67,11 @@ for (const notification of notifications.provider) { if (!cached && versionMatches && envMatches) notifications.add(notification); } -const $welcomeModalButton = web.html``; -export const $welcomeModal = web.render( +export const $changelogModal = web.render( web.html``, @@ -94,16 +95,16 @@ export const $welcomeModal = web.render( `, - web.render(web.html``, $welcomeModalButton) + web.render(web.html``, $changelogModalButton) ) ); -web.render(document.body, $welcomeModal); - -const lastAcceptedWelcome = await storage.get(['last_accepted_welcome']); -if (lastAcceptedWelcome !== env.version) { - $welcomeModal.classList.add('modal-visible'); +web.render(document.body, $changelogModal); +if (lastReadChangelog !== env.version) { + $changelogModal.classList.add('modal-visible'); } -$welcomeModalButton.addEventListener('click', async () => { - $welcomeModal.classList.remove('modal-visible'); - await storage.set(['last_accepted_welcome'], env.version); +$changelogModalButton.addEventListener('click', async () => { + $changelogModal.classList.remove('modal-visible'); + await storage.set(['last_read_changelog'], env.version); });