git ssb

16+

Dominic / patchbay



Commit 29997160555aa9df4541f65ba3ca7b58d4a8c9c4

Add channel message_meta and screen_view

Charles Lehner committed on 6/28/2016, 3:08:02 AM
Parent: ae12a05c8bad934d6e90d7b524a9a16e76ed5b98

Files changed

modules/index.jschanged
modules/channel.jsadded
modules/index.jsView
@@ -2,8 +2,9 @@
22 require('./about.js'),
33 require('./avatar-image.js'),
44 require('./avatar-profile.js'),
55 require('./avatar.js'),
6+ require('./channel.js'),
67 require('./compose.js'),
78 require('./crypto.js'),
89 require('./feed.js'),
910 require('./file-input.js'),
modules/channel.jsView
@@ -1,0 +1,55 @@
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.message_meta = function (msg) {
12+ var chan = msg.value.content.channel
13+ if (chan)
14+ return h('a', {href: '##'+chan}, '#'+chan)
15+}
16+
17+exports.screen_view = function (path) {
18+ if(path[0] === '#') {
19+ var channel = path.substr(1)
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+ message_compose({type: 'post'}), //header
26+ content
27+ )
28+ )
29+
30+ function matchesChannel(msg) {
31+ if (msg.sync) console.error('SYNC', msg)
32+ var c = msg && msg.value && msg.value.content
33+ return c && c.channel === channel
34+ }
35+
36+ pull(
37+ sbot_log({old: false}),
38+ pull.filter(matchesChannel),
39+ Scroller(div, content, message_render, true, false)
40+ )
41+
42+ pull(
43+ /*
44+ sbot_query({query: [
45+ {$filter: {value: {content: {channel: channel}}}}
46+ ]}),
47+ */
48+ u.next(sbot_log, {reverse: true, limit: 100, live: false}),
49+ pull.filter(matchesChannel),
50+ Scroller(div, content, message_render, false, false)
51+ )
52+
53+ return div
54+ }
55+}

Built with git-ssb-web