git ssb

16+

Dominic / patchbay



Tree: 16d4fed8035a33d71d29eb20773bfe59fa2100f0

Files: 16d4fed8035a33d71d29eb20773bfe59fa2100f0 / app / html / page / notifications.js

1307 bytesRaw
1const nest = require('depnest')
2const { h } = require('mutant')
3const pull = require('pull-stream')
4const Scroller = require('pull-scroll')
5const next = require('../../../junk/next-stepper')
6
7exports.gives = nest({
8 'app.html': {
9 page: true,
10 menuItem: true
11 }
12})
13
14exports.needs = nest({
15 'feed.pull': {
16 mentions: 'first',
17 public: 'first'
18 },
19 'keys.sync.id': 'first',
20 'app.html.scroller': 'first',
21 'message.html.render': 'first'
22})
23
24exports.create = function (api) {
25 const route = '/notifications'
26
27 return nest({
28 'app.html': {
29 page: notificationsPage,
30 menuItem: menuItem
31 }
32 })
33
34 function menuItem (handleClick) {
35 return h('a', {
36 style: { order: 3 },
37 'ev-click': () => handleClick(route)
38 }, route)
39 }
40
41 function notificationsPage (path) {
42 if (path !== route) return
43 const id = api.keys.sync.id()
44 const mentions = api.feed.pull.mentions(id)
45
46 const { container, content } = api.app.html.scroller({})
47
48 pull(
49 next(mentions, {old: false, limit: 100}),
50 Scroller(container, content, api.message.html.render, true, false)
51 )
52
53 pull(
54 next(mentions, {reverse: true, limit: 100, live: false}),
55 Scroller(container, content, api.message.html.render, false, false)
56 )
57 return container
58 }
59}
60
61

Built with git-ssb-web