Files: 20ca678297eeb06a01e494ce64b4cca29323879d / modules_extra / git-ssb.js
1443 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 | menu_items: true, screen_view: true |
19 | } |
20 | |
21 | exports.create = function (api) { |
22 | return { |
23 | menu_items: function () { |
24 | return h('a', {href: '#/git-ssb'}, '/git-ssb') |
25 | }, |
26 | |
27 | screen_view: function (path, sbot) { |
28 | if(path === '/git-ssb') { |
29 | |
30 | var content = h('div.column.scroller__content') |
31 | var div = h('div.column.scroller', |
32 | {style: {'overflow':'auto'}}, |
33 | h('div.scroller__wrapper', content) |
34 | ) |
35 | |
36 | pull( |
37 | u.next(api.sbot_log, {old: false, limit: 100}), |
38 | Scroller(div, content, api.message_render, true, false) |
39 | ) |
40 | |
41 | pull( |
42 | u.next(api.sbot_log, {reverse: true, limit: 100, live: false}), |
43 | pull.filter(function(msg) { return msg.value.content.type }), |
44 | pull.filter(function(msg) { |
45 | return msg.value.content.type.match(/^git/) |
46 | }), |
47 | Scroller(div, content, api.message_render, false, false) |
48 | ) |
49 | |
50 | return div |
51 | } |
52 | } |
53 | } |
54 | } |
55 |
Built with git-ssb-web