git ssb

1+

Daan Patchwork / patchwork



Tree: 3451510316992d414ec76ba5b29681fe359b7428

Files: 3451510316992d414ec76ba5b29681fe359b7428 / lib / depject / feed / html / follow-warning.js

1116 bytesRaw
1const nest = require('depnest')
2const { 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 const 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/get-started'
33 }, 'https://scuttlebutt.nz/get-started')
34 ])
35 ]))
36
37 return when(condition, content)
38 }
39}
40

Built with git-ssb-web