Files: 43df95c4d63b7a5a52000171ed8ae86b874f3b5a / modules_basic / public.js
1136 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 | builtin_tabs: true, screen_view: true |
14 | } |
15 | |
16 | exports.create = function (api) { |
17 | |
18 | return { |
19 | builtin_tabs: function () { |
20 | return ['/public'] |
21 | }, |
22 | |
23 | screen_view: function (path, sbot) { |
24 | if(path === '/public') { |
25 | |
26 | var content = h('div.column.scroller__content') |
27 | var div = h('div.column.scroller', |
28 | {style: {'overflow':'auto'}}, |
29 | h('div.scroller__wrapper', |
30 | api.message_compose({type: 'post'}, {placeholder: 'Write a public message'}), |
31 | content |
32 | ) |
33 | ) |
34 | |
35 | pull( |
36 | u.next(api.sbot_log, {old: false, limit: 100}), |
37 | Scroller(div, content, api.message_render, true, false) |
38 | ) |
39 | |
40 | pull( |
41 | u.next(api.sbot_log, {reverse: true, limit: 100, live: false}), |
42 | Scroller(div, content, api.message_render, false, false) |
43 | ) |
44 | |
45 | return div |
46 | } |
47 | } |
48 | } |
49 | } |
50 |
Built with git-ssb-web