git ssb

16+

Dominic / patchbay



Tree: 4cda013d06b86a002895df3cbed747f6baf1085c

Files: 4cda013d06b86a002895df3cbed747f6baf1085c / modules_basic / feed.js

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

Built with git-ssb-web