git ssb

10+

Matt McKegg / patchwork



Commit a0d45464afed54dcb36fdf48278c914c2204a62e

allow hiding of "update available" until next launch

closes #559
Matt McKegg committed on 6/21/2017, 1:33:20 AM
Parent: 10b9468f44ad8180f73a885140a5fdf7bbe3620f

Files changed

lib/latest-update.jschanged
main-window.jschanged
styles/main-window.mcsschanged
lib/latest-update.jsView
@@ -1,11 +1,13 @@
11 var https = require('https')
22 var packageInfo = require('../package.json')
33 var compareVersion = require('compare-version')
44 var Value = require('mutant/value')
5 +var computed = require('mutant/computed')
56
67 module.exports = function () {
78 var update = Value()
9 + var hidden = Value(false)
810 update.sync = Value(false)
911 var version = packageInfo.version
1012 https.get({
1113 host: 'api.github.com',
@@ -26,6 +28,9 @@
2628 update.sync.set(true)
2729 })
2830 }
2931 })
30- return update
32 +
33 + var obs = computed([update, hidden], (update, hidden) => update && !hidden)
34 + obs.ignore = () => hidden.set(true)
35 + return obs
3136 }
main-window.jsView
@@ -12,9 +12,8 @@
1212 var ref = require('ssb-ref')
1313 var setupContextMenuAndSpellCheck = require('./lib/context-menu-and-spellcheck')
1414 var watch = require('mutant/watch')
1515
16-
1716 module.exports = function (config) {
1817 var sockets = combine(
1918 overrideConfig(config),
2019 addCommand('app.navigate', setView),
@@ -97,9 +96,10 @@
9796 ]),
9897 when(latestUpdate,
9998 h('div.info', [
10099 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')
102102 ])
103103 ])
104104 ),
105105 api.app.html.progressNotifier(),
styles/main-window.mcssView
@@ -140,8 +140,20 @@
140140 background: #deffde;
141141 transition: color 0.2s, background-color 0.2s;
142142 color: #217720;
143143
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 +
144156 :hover {
145157 text-decoration: none
146158 background: #c0ffae
147159 }

Built with git-ssb-web