git ssb

16+

Dominic / patchbay



Tree: b1da73e22bda6761baeced6c02888d038c2f9ace

Files: b1da73e22bda6761baeced6c02888d038c2f9ace / modules_basic / feed.js

1332 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 content
30 )
31 )
32
33 api.signifier(id, function (_, names) {
34 if(names.length) div.title = names[0].name
35 })
36
37
38 pull(
39 api.sbot_user_feed({id: id, old: false, live: true}),
40 Scroller(div, content, api.message_render, true, false)
41 )
42
43 //how to handle when have scrolled past the start???
44
45 pull(
46 u.next(api.sbot_user_feed, {
47 id: id, reverse: true,
48 limit: 50, live: false
49 }, ['value', 'sequence']),
50 // pull.through(console.log.bind(console)),
51 Scroller(div, content, api.message_render, false, false)
52 )
53
54 return div
55
56 }
57 }
58
59}
60
61

Built with git-ssb-web