Files: 437facf41d277081453b193b5e9cc808704399ef / modules / feed.js
1256 bytesRaw
1 | var ref = require('ssb-ref') |
2 | var ui = require('../ui') |
3 | var Scroller = require('pull-scroll') |
4 | var h = require('hyperscript') |
5 | var pull = require('pull-stream') |
6 | var u = require('../util') |
7 | var keyscroll = require('../keyscroll') |
8 | |
9 | var plugs = require('../plugs') |
10 | var sbot_user_feed = plugs.first(exports.sbot_user_feed = []) |
11 | var message_render = plugs.first(exports.message_render = []) |
12 | var avatar_profile = plugs.first(exports.avatar_profile = []) |
13 | |
14 | exports.screen_view = function (id, sbot) { |
15 | //TODO: header of user info, avatars, names, follows. |
16 | |
17 | if(ref.isFeed(id)) { |
18 | |
19 | var content = h('div.column.scroller__content') |
20 | var div = h('div.column.scroller', |
21 | {style: {'overflow':'auto'}}, |
22 | h('div.scroller__wrapper', |
23 | h('div', avatar_profile(id)), |
24 | content |
25 | ) |
26 | ) |
27 | |
28 | pull( |
29 | sbot_user_feed({id: id, old: false, live: true}), |
30 | Scroller(div, content, message_render, true, false) |
31 | ) |
32 | |
33 | //how to handle when have scrolled past the start??? |
34 | |
35 | pull( |
36 | u.next(sbot_user_feed, { |
37 | id: id, reverse: true, |
38 | limit: 50, live: false |
39 | }, ['value', 'sequence']), |
40 | Scroller(div, content, message_render, false, false) |
41 | ) |
42 | |
43 | div.scroll = keyscroll(content) |
44 | |
45 | return div |
46 | |
47 | } |
48 | } |
49 | |
50 | |
51 | |
52 | |
53 | |
54 | |
55 | |
56 |
Built with git-ssb-web