git ssb

16+

Dominic / patchbay



Tree: 436b95d0f731a04c71b5f4a1ffcdba5961a2fd92

Files: 436b95d0f731a04c71b5f4a1ffcdba5961a2fd92 / app / page / notifications.js

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

Built with git-ssb-web