Files: 0132c055406a2cc025989cea9154fea161b776c9 / modules_extra / git-ssb.js
1136 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 | exports.needs = { |
7 | build_scroller: 'first', |
8 | message_render: 'first', |
9 | message_compose: 'first', |
10 | sbot_log: 'first' |
11 | } |
12 | |
13 | exports.gives = { |
14 | menu_items: true, |
15 | screen_view: true |
16 | } |
17 | |
18 | exports.create = function (api) { |
19 | return { |
20 | menu_items: function () { |
21 | return h('a', {href: '#/git-ssb'}, '/git-ssb') |
22 | }, |
23 | |
24 | screen_view: function (path, sbot) { |
25 | if(path === '/git-ssb') { |
26 | |
27 | var { container, content } = api.build_scroller() |
28 | |
29 | pull( |
30 | u.next(api.sbot_log, {old: false, limit: 100}), |
31 | Scroller(container, content, api.message_render, true, false) |
32 | ) |
33 | |
34 | pull( |
35 | u.next(api.sbot_log, {reverse: true, limit: 100, live: false}), |
36 | pull.filter(function(msg) { return msg.value.content.type }), |
37 | pull.filter(function(msg) { |
38 | return msg.value.content.type.match(/^git/) |
39 | }), |
40 | Scroller(container, content, api.message_render, false, false) |
41 | ) |
42 | |
43 | return container |
44 | } |
45 | } |
46 | } |
47 | } |
48 |
Built with git-ssb-web