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