Files: c4e6d69c2cdcc875fc3ac222471b3c5d55810b77 / modules / feed.js
1217 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 | var userstream = require('./scuttlebot').userstream |
7 | |
8 | exports.needs = { |
9 | message_render: 'first', |
10 | avatar_profile: 'first' |
11 | } |
12 | |
13 | exports.gives = 'screen_view' |
14 | |
15 | exports.create = function (api) { |
16 | |
17 | return function (id) { |
18 | if(ref.isFeed(id)) { |
19 | |
20 | var content = h('div.column.scroller__content') |
21 | var div = h('div.column.scroller', |
22 | {style: {'overflow':'auto'}}, |
23 | h('div.scroller__wrapper', |
24 | h('div.scroller__content', api.avatar_profile(id)), |
25 | content |
26 | ) |
27 | ) |
28 | |
29 | /*api.signifier(id, function (_, names) { |
30 | if(names.length) div.title = names[0].name |
31 | })*/ |
32 | |
33 | pull( |
34 | userstream({id: id, old: false, live: true}), |
35 | Scroller(div, content, api.message_render, true, false) |
36 | ) |
37 | |
38 | pull( |
39 | u.next(userstream, { |
40 | id: id, reverse: true, |
41 | limit: 50, live: false |
42 | }, ['value', 'sequence']), |
43 | //pull.through(console.log.bind(console)), |
44 | Scroller(div, content, api.message_render, false, false) |
45 | ) |
46 | |
47 | return div |
48 | } |
49 | } |
50 | } |
51 | |
52 |
Built with git-ssb-web