Files: b65df85068d01bbc7fd6b0ba8686cccbae6928ee / modules / public.js
1045 bytesRaw
1 | var h = require('hyperscript') |
2 | var u = require('../util') |
3 | var pull = require('pull-stream') |
4 | var Scroller = require('pull-scroll') |
5 | |
6 | exports.needs = { |
7 | message_render: 'first', |
8 | message_compose: 'first', |
9 | sbot_log: 'first', |
10 | } |
11 | |
12 | exports.gives = { |
13 | screen_view: true |
14 | } |
15 | |
16 | exports.create = function (api) { |
17 | return { |
18 | screen_view: function (path, sbot) { |
19 | if(path === 'Public') { |
20 | |
21 | var content = h('div.column.scroller__content') |
22 | var div = h('div.column.scroller', |
23 | {style: {'overflow':'auto'}}, |
24 | h('div.scroller__wrapper', |
25 | api.message_compose({type: 'post'}, {placeholder: 'What\'s the scuttle?'}), |
26 | content |
27 | ) |
28 | ) |
29 | |
30 | pull( |
31 | u.next(api.sbot_log, {old: false, limit: 100}), |
32 | Scroller(div, content, api.message_render, true, false) |
33 | ) |
34 | |
35 | pull( |
36 | u.next(api.sbot_log, {reverse: true, limit: 100, live: false}), |
37 | Scroller(div, content, api.message_render, false, false) |
38 | ) |
39 | |
40 | return div |
41 | } |
42 | } |
43 | } |
44 | } |
45 |
Built with git-ssb-web