git ssb

16+

Dominic / patchbay



Tree: 3003c7f2e378ab411b09eaa11adef56245af1868

Files: 3003c7f2e378ab411b09eaa11adef56245af1868 / modules_basic / public.js

1353 bytesRaw
1var h = require('hyperscript')
2var u = require('../util')
3var pull = require('pull-stream')
4var 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
11exports.needs = {
12 message_render: 'first',
13 message_compose: 'first',
14 sbot_log: 'first',
15}
16
17exports.gives = {
18 builtin_tabs: true, screen_view: true
19}
20
21exports.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