Files: 05199c5427b6df72e01ba59a2d57db4d6d610c2b / modules / feed / html / follow-warning.js
1128 bytesRaw
1 | var nest = require('depnest') |
2 | var { when, h } = require('mutant') |
3 | |
4 | exports.needs = nest({ |
5 | 'intl.sync.i18n': 'first' |
6 | }) |
7 | |
8 | exports.gives = nest({ |
9 | 'feed.html.followWarning': true, |
10 | 'feed.html.followerWarning': true |
11 | }) |
12 | |
13 | exports.create = function (api) { |
14 | const i18n = api.intl.sync.i18n |
15 | return nest('feed.html', { |
16 | followWarning: function followWarning (condition, explanation) { |
17 | return renderWarningBox(condition, i18n('You are not following anyone'), explanation) |
18 | }, |
19 | followerWarning: function followerWarning (condition, explanation) { |
20 | return renderWarningBox(condition, i18n('You have no followers'), explanation) |
21 | } |
22 | }) |
23 | |
24 | function renderWarningBox (condition, header, explanation) { |
25 | var content = h('div', { |
26 | classList: 'NotFollowingAnyoneWarning' |
27 | }, h('section', [ |
28 | h('h1', header), |
29 | h('p', explanation), |
30 | h('p', [i18n('For help getting started, see the guide at '), |
31 | h('a', { |
32 | href: 'https://scuttlebutt.nz/getting-started.html' |
33 | }, 'https://scuttlebutt.nz/getting-started.html') |
34 | ]) |
35 | ])) |
36 | |
37 | return when(condition, content) |
38 | } |
39 | } |
40 |
Built with git-ssb-web