Files: f37ef7f30e013104c6e999fbd9ada54421e74c5e / modules / feed.js
1326 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 | |
8 | var plugs = require('../plugs') |
9 | var sbot_user_feed = plugs.first(exports.sbot_user_feed = []) |
10 | var message_render = plugs.first(exports.message_render = []) |
11 | var avatar_profile = plugs.first(exports.avatar_profile = []) |
12 | var signifier = plugs.first(exports.signifier = []) |
13 | |
14 | exports.screen_view = function (id) { |
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 | signifier(id, function (_, names) { |
29 | if(names.length) div.title = names[0].name |
30 | }) |
31 | |
32 | |
33 | pull( |
34 | sbot_user_feed({id: id, old: false, live: true}), |
35 | Scroller(div, content, message_render, true, false) |
36 | ) |
37 | |
38 | //how to handle when have scrolled past the start??? |
39 | |
40 | pull( |
41 | u.next(sbot_user_feed, { |
42 | id: id, reverse: true, |
43 | limit: 50, live: false |
44 | }, ['value', 'sequence']), |
45 | Scroller(div, content, message_render, false, false) |
46 | ) |
47 | |
48 | return div |
49 | |
50 | } |
51 | } |
52 | |
53 | |
54 | |
55 | |
56 | |
57 |
Built with git-ssb-web