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