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