git ssb

16+

Dominic / patchbay



Tree: 8dfd53f6b3b313f0e6bf9db8230c208c1f91937c

Files: 8dfd53f6b3b313f0e6bf9db8230c208c1f91937c / modules_basic / feed.js

1367 bytesRaw
1var ref = require('ssb-ref')
2var Scroller = require('pull-scroll')
3var h = require('hyperscript')
4var pull = require('pull-stream')
5var u = require('../util')
6
7exports.needs = {
8 sbot_user_feed: 'first',
9 message_render: 'first',
10 avatar_profile: 'first',
11 signifier: 'first'
12}
13
14exports.gives = 'screen_view'
15
16
17exports.create = function (api) {
18
19 return function (id) {
20 //TODO: header of user info, avatars, names, follows.
21
22 if(ref.isFeed(id)) {
23
24 var content = h('div.column.scroller__content')
25 var div = h('div.column.scroller',
26 {style: {'overflow':'auto'}},
27 h('div.scroller__wrapper',
28 h('div', api.avatar_profile(id)),
29 h('header', 'Activity'),
30 content
31 )
32 )
33
34 api.signifier(id, function (_, names) {
35 if(names.length) div.title = names[0].name
36 })
37
38
39 pull(
40 api.sbot_user_feed({id: id, old: false, live: true}),
41 Scroller(div, content, api.message_render, true, false)
42 )
43
44 //how to handle when have scrolled past the start???
45
46 pull(
47 u.next(api.sbot_user_feed, {
48 id: id, reverse: true,
49 limit: 50, live: false
50 }, ['value', 'sequence']),
51 // pull.through(console.log.bind(console)),
52 Scroller(div, content, api.message_render, false, false)
53 )
54
55 return div
56
57 }
58 }
59
60}
61
62

Built with git-ssb-web