Files: 7b8459c024b593664fa22d32c9b9bcccfe02a2fa / modules / private.js
1095 bytesRaw
1 | var h = require('hyperscript') |
2 | var ui = require('../ui') |
3 | var u = require('../util') |
4 | var pull = require('pull-stream') |
5 | var Scroller = require('pull-scroll') |
6 | |
7 | function unbox () { |
8 | return pull( |
9 | pull.filter(function (msg) { |
10 | return 'string' == typeof msg.value.content |
11 | }), |
12 | pull.map(function (msg) { |
13 | return u.firstPlug(exports.message_unbox, msg) |
14 | }), |
15 | pull.filter(Boolean) |
16 | ) |
17 | } |
18 | |
19 | exports.screen_view = function (path, sbot) { |
20 | if(path === '/private') { |
21 | |
22 | var content = h('div.column') |
23 | |
24 | var div = h('div.column', {style: {'overflow':'auto'}}, content) |
25 | var render = ui.createRenderers(exports.message_render, sbot) |
26 | |
27 | pull( |
28 | sbot.createLogStream({old: false}), |
29 | unbox(), |
30 | Scroller(div, content, render, true, false) |
31 | ) |
32 | |
33 | pull( |
34 | u.next(sbot.createLogStream, {reverse: true, limit: 1000}), |
35 | unbox(), |
36 | Scroller(div, content, render, false, false, function (err) { |
37 | if(err) throw err |
38 | }) |
39 | ) |
40 | |
41 | return div |
42 | } |
43 | } |
44 | |
45 | exports.message_render = [] |
46 | exports.message_compose = [] |
47 | exports.message_unbox = [] |
48 | |
49 | |
50 | |
51 | |
52 | |
53 | |
54 | |
55 | |
56 | |
57 | |
58 | |
59 | |
60 |
Built with git-ssb-web