Commit a0d45464afed54dcb36fdf48278c914c2204a62e
allow hiding of "update available" until next launch
closes #559Matt McKegg committed on 6/21/2017, 1:33:20 AM
Parent: 10b9468f44ad8180f73a885140a5fdf7bbe3620f
Files changed
lib/latest-update.js | changed |
main-window.js | changed |
styles/main-window.mcss | changed |
lib/latest-update.js | ||
---|---|---|
@@ -1,11 +1,13 @@ | ||
1 | 1 | var https = require('https') |
2 | 2 | var packageInfo = require('../package.json') |
3 | 3 | var compareVersion = require('compare-version') |
4 | 4 | var Value = require('mutant/value') |
5 | +var computed = require('mutant/computed') | |
5 | 6 | |
6 | 7 | module.exports = function () { |
7 | 8 | var update = Value() |
9 | + var hidden = Value(false) | |
8 | 10 | update.sync = Value(false) |
9 | 11 | var version = packageInfo.version |
10 | 12 | https.get({ |
11 | 13 | host: 'api.github.com', |
@@ -26,6 +28,9 @@ | ||
26 | 28 | update.sync.set(true) |
27 | 29 | }) |
28 | 30 | } |
29 | 31 | }) |
30 | - return update | |
32 | + | |
33 | + var obs = computed([update, hidden], (update, hidden) => update && !hidden) | |
34 | + obs.ignore = () => hidden.set(true) | |
35 | + return obs | |
31 | 36 | } |
main-window.js | ||
---|---|---|
@@ -12,9 +12,8 @@ | ||
12 | 12 | var ref = require('ssb-ref') |
13 | 13 | var setupContextMenuAndSpellCheck = require('./lib/context-menu-and-spellcheck') |
14 | 14 | var watch = require('mutant/watch') |
15 | 15 | |
16 | - | |
17 | 16 | module.exports = function (config) { |
18 | 17 | var sockets = combine( |
19 | 18 | overrideConfig(config), |
20 | 19 | addCommand('app.navigate', setView), |
@@ -97,9 +96,10 @@ | ||
97 | 96 | ]), |
98 | 97 | when(latestUpdate, |
99 | 98 | h('div.info', [ |
100 | 99 | h('a.message -update', { href: 'https://github.com/ssbc/patchwork/releases' }, [ |
101 | - h('strong', ['Patchwork ', latestUpdate, ' has been released.']), ' Click here to download and view more info!' | |
100 | + h('strong', ['Patchwork ', latestUpdate, ' has been released.']), ' Click here to download and view more info!', | |
101 | + h('a.ignore', {'ev-click': latestUpdate.ignore}, 'X') | |
102 | 102 | ]) |
103 | 103 | ]) |
104 | 104 | ), |
105 | 105 | api.app.html.progressNotifier(), |
styles/main-window.mcss | ||
---|---|---|
@@ -140,8 +140,20 @@ | ||
140 | 140 | background: #deffde; |
141 | 141 | transition: color 0.2s, background-color 0.2s; |
142 | 142 | color: #217720; |
143 | 143 | |
144 | + a.ignore { | |
145 | + float: right | |
146 | + border-radius: 10px | |
147 | + padding: 2px 5px | |
148 | + margin-top: -2px | |
149 | + :hover { | |
150 | + text-decoration: none | |
151 | + background: #c0c0c0 | |
152 | + color: white | |
153 | + } | |
154 | + } | |
155 | + | |
144 | 156 | :hover { |
145 | 157 | text-decoration: none |
146 | 158 | background: #c0ffae |
147 | 159 | } |
Built with git-ssb-web