aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/announcements
diff options
context:
space:
mode:
authorLibravatar Dominik Guzei <dominik.guzei@gmail.com>2019-04-16 16:26:50 +0200
committerLibravatar Dominik Guzei <dominik.guzei@gmail.com>2019-04-16 16:26:50 +0200
commit8f0a4518ea896e2c55e9a52306203ea4840e055b (patch)
tree086500954d54231eb3dc5841e55166f9d525b5af /src/features/announcements
parentRun tests (diff)
downloadferdium-app-8f0a4518ea896e2c55e9a52306203ea4840e055b.tar.gz
ferdium-app-8f0a4518ea896e2c55e9a52306203ea4840e055b.tar.zst
ferdium-app-8f0a4518ea896e2c55e9a52306203ea4840e055b.zip
hide news menu item when there are no news
Diffstat (limited to 'src/features/announcements')
-rw-r--r--src/features/announcements/store.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/features/announcements/store.js b/src/features/announcements/store.js
index aa98d3bd1..7ecc0e346 100644
--- a/src/features/announcements/store.js
+++ b/src/features/announcements/store.js
@@ -34,6 +34,12 @@ export class AnnouncementsStore extends FeatureStore {
34 return getAnnouncementRequest.result; 34 return getAnnouncementRequest.result;
35 } 35 }
36 36
37 @computed get areNewsAvailable() {
38 const isChangelogAvailable = getChangelogRequest.wasExecuted && !!this.changelog;
39 const isAnnouncementAvailable = getAnnouncementRequest.wasExecuted && !!this.announcement;
40 return isChangelogAvailable || isAnnouncementAvailable;
41 }
42
37 @computed get settings() { 43 @computed get settings() {
38 return localStorage.getItem(LOCAL_STORAGE_KEY) || {}; 44 return localStorage.getItem(LOCAL_STORAGE_KEY) || {};
39 } 45 }
@@ -87,6 +93,7 @@ export class AnnouncementsStore extends FeatureStore {
87 // ======= ACTIONS ======= // 93 // ======= ACTIONS ======= //
88 94
89 @action _showAnnouncement = ({ targetVersion } = {}) => { 95 @action _showAnnouncement = ({ targetVersion } = {}) => {
96 if (!this.areNewsAvailable) return;
90 this.targetVersion = targetVersion || this.currentVersion; 97 this.targetVersion = targetVersion || this.currentVersion;
91 this.isAnnouncementVisible = true; 98 this.isAnnouncementVisible = true;
92 this.actions.service.blurActive(); 99 this.actions.service.blurActive();