git ssb

2+

mixmix / ticktack



Tree: c81c05e4658be6e4d6da1fb5db9fd0f50033e6f9

Files: c81c05e4658be6e4d6da1fb5db9fd0f50033e6f9 / app / html / warning.js

935 bytesRaw
1const nest = require('depnest')
2const { h, onceTrue } = require('mutant')
3
4exports.gives = nest('app.html.warning')
5
6exports.needs = nest({
7 'app.html.lightbox': 'first',
8 'app.obs.pluginWarnings': 'first',
9 'translations.sync.strings': 'first'
10})
11
12exports.create = (api) => {
13 var seenWarning = false
14
15 return nest('app.html.warning', function warning () {
16 if (seenWarning) return
17
18 const t = api.translations.sync.strings().pluginWarnings
19
20 const lightbox = api.app.html.lightbox(
21 h('div', [
22 h('h1', t.heading),
23 h('p', t.description),
24 h('p', t.advice),
25 h('Button', {
26 'ev-click': () => {
27 lightbox.close()
28 seenWarning = true
29 }},
30 t.action.ok
31 )
32 ])
33 )
34
35 onceTrue(
36 api.app.obs.pluginWarnings(),
37 shouldWarn => {
38 shouldWarn ? lightbox.open() : null
39 }
40 )
41
42 return lightbox
43 })
44}
45
46

Built with git-ssb-web