git ssb

2+

mixmix / ticktack



Tree: 09b5f547eae3101aadd573367a0f734ce0caf87c

Files: 09b5f547eae3101aadd573367a0f734ce0caf87c / app / page / notifications.js

1202 bytesRaw
1const nest = require('depnest')
2const { h, onceTrue } = require('mutant')
3const defer = require('pull-defer')
4
5exports.gives = nest('app.page.notifications')
6
7exports.needs = nest({
8 'app.html.scroller': 'first',
9 'app.html.sideNav': 'first',
10 'message.html.comment': 'first',
11 'sbot.obs.connection': 'first',
12 'translations.sync.strings': 'first'
13})
14
15exports.create = (api) => {
16 return nest('app.page.notifications', function (location) {
17 // location here can expected to be: { page: 'notifications', section: * }
18
19 var scroller = api.app.html.scroller({
20 classList: ['content'],
21 stream: createBlogCommentStream,
22 render: Comment
23 })
24
25 function createBlogCommentStream (opts) {
26 const source = defer.source()
27 var resolved = false
28
29 onceTrue(api.sbot.obs.connection, server => {
30 if (resolved) return
31
32 source.resolve(server.blogStats.readAllComments(opts))
33 resolved = true
34 })
35
36 return source
37 }
38
39 return h('Page -notifications', [
40 api.app.html.sideNav(location),
41 scroller
42 ])
43
44 function Comment (msg) {
45 return api.message.html.comment({ comment: msg, showRootLink: true })
46 }
47 })
48}
49

Built with git-ssb-web