Files: bc9472388e14fcf3a02a4397b3d69d16bf96390d / app / html / warning.js
908 bytesRaw
1 | const nest = require('depnest') |
2 | const { h, watch } = require('mutant') |
3 | |
4 | exports.gives = nest('app.html.warning') |
5 | |
6 | exports.needs = nest({ |
7 | 'app.html.lightbox': 'first', |
8 | 'app.obs.pluginsOk': 'first', |
9 | 'translations.sync.strings': 'first' |
10 | }) |
11 | |
12 | exports.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().pluginsOk |
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 | watch( |
36 | api.app.obs.pluginsOk(), |
37 | isOk => { |
38 | if (isOk === false) lightbox.open() |
39 | } |
40 | ) |
41 | |
42 | return lightbox |
43 | }) |
44 | } |
45 | |
46 |
Built with git-ssb-web