git ssb

10+

Matt McKegg / patchwork



Tree: abdfdab7259f8f8c62221e7d3e23947e30cb29ed

Files: abdfdab7259f8f8c62221e7d3e23947e30cb29ed / modules / feed / html / follow-warning.js

1128 bytesRaw
1var nest = require('depnest')
2var { when, h } = require('mutant')
3
4exports.needs = nest({
5 'intl.sync.i18n': 'first'
6})
7
8exports.gives = nest({
9 'feed.html.followWarning': true,
10 'feed.html.followerWarning': true
11})
12
13exports.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