Commit 00b7dc676f3599b4be16806c7ce93abbd9c724c5
add compose (WIP) and use flexbox
Dominic Tarr committed on 5/14/2016, 12:06:14 PMParent: 251a4d7b1477eafd58a6093249e659cf49f23e0c
Files changed
modules/feed.js | changed |
modules/main.js | changed |
modules/message.js | changed |
modules/tabs.js | changed |
modules/thread.js | changed |
modules/feed.js | ||
---|---|---|
@@ -1,13 +1,15 @@ | ||
1 | 1 | var ref = require('ssb-ref') |
2 | 2 | var ui = require('../ui') |
3 | - | |
3 | +var Scroller = require('pull-scroll') | |
4 | 4 | exports.screen_view = function (id, sbot) { |
5 | - if(ref.isFeed(id)) | |
5 | + if(ref.isFeed(id)) { | |
6 | + | |
6 | 7 | return ui.createStream( |
7 | - sbot.createUserStream({id: id, limit: 100, reverse: true}), | |
8 | + sbot.createUserStream({id: id, reverse: true}), | |
8 | 9 | ui.createRenderers(exports.message_render, sbot) |
9 | 10 | ) |
11 | + } | |
10 | 12 | } |
11 | 13 | |
12 | 14 | exports.message_render = [] |
13 | 15 |
modules/main.js | ||
---|---|---|
@@ -1,18 +1,33 @@ | ||
1 | - | |
1 | +var h = require('hyperscript') | |
2 | 2 | var ui = require('../ui') |
3 | +var u = require('../util') | |
4 | +var pull = require('pull-stream') | |
5 | +var Scroller = require('pull-scroll') | |
3 | 6 | |
4 | 7 | exports.screen_view = function (path, sbot) { |
5 | - if(path === '/') | |
6 | - return ui.createStream( | |
7 | - sbot.createLogStream({limit: 100, reverse: true}), | |
8 | - ui.createRenderers(exports.message_render, sbot) | |
8 | + if(path === '/') { | |
9 | + | |
10 | + var content = h('div.column') | |
11 | + var div = h('div.column', {style: {'overflow':'auto'}}, | |
12 | + u.decorate(exports.message_compose, {}, function (d, e, v) { | |
13 | + return d(e, v, sbot) | |
14 | + }), | |
15 | + content | |
9 | 16 | ) |
17 | + var render = ui.createRenderers(exports.message_render, sbot) | |
18 | + | |
19 | + pull( | |
20 | + sbot.createLogStream({reverse: true}), | |
21 | + Scroller(div, content, render, false, false) | |
22 | + ) | |
23 | + | |
24 | + return div | |
25 | + } | |
10 | 26 | } |
11 | 27 | |
12 | 28 | exports.message_render = [] |
29 | +exports.message_compose = [] | |
13 | 30 | |
14 | 31 | |
15 | 32 | |
16 | 33 | |
17 | - | |
18 | - |
modules/message.js | ||
---|---|---|
@@ -29,15 +29,15 @@ | ||
29 | 29 | }) |
30 | 30 | ) |
31 | 31 | |
32 | 32 | if(el) |
33 | - return h('div.message', | |
34 | - h('div.title', | |
33 | + return h('div.message.column', | |
34 | + h('div.title.row', | |
35 | 35 | h('div.avatar', map(exports.avatar, msg.value.author)), |
36 | - h('div.metadata', map(exports.message_meta, msg)) | |
36 | + h('div.message_meta.row', map(exports.message_meta, msg)) | |
37 | 37 | ), |
38 | - h('div.content', el), | |
39 | - h('div.footer', | |
38 | + h('div.message_content', el), | |
39 | + h('div.message_actions.row', | |
40 | 40 | h('div.actions', map(exports.message_action)) |
41 | 41 | ), |
42 | 42 | backlinks |
43 | 43 | ) |
modules/tabs.js | ||
---|---|---|
@@ -17,8 +17,9 @@ | ||
17 | 17 | }) |
18 | 18 | } |
19 | 19 | |
20 | 20 | var tabs = Tabs() |
21 | + tabs.classList.add('screen') | |
21 | 22 | var main = screen('/') |
22 | 23 | if(main) tabs.add('main', main, true) |
23 | 24 | |
24 | 25 | tabs.onclick = function (ev) { |
@@ -40,11 +41,4 @@ | ||
40 | 41 | |
41 | 42 | exports.message_render = [] |
42 | 43 | exports.screen_view = [] |
43 | 44 | |
44 | - | |
45 | - | |
46 | - | |
47 | - | |
48 | - | |
49 | - | |
50 | - |
modules/thread.js | ||
---|---|---|
@@ -2,8 +2,11 @@ | ||
2 | 2 | var pull = require('pull-stream') |
3 | 3 | var Cat = require('pull-cat') |
4 | 4 | var Sort = require('pull-sort') |
5 | 5 | var ref = require('ssb-ref') |
6 | +var h = require('hyperscript') | |
7 | +var u = require('../util') | |
8 | +var Scroller = require('pull-scroll') | |
6 | 9 | |
7 | 10 | function once (cont) { |
8 | 11 | var ended = false |
9 | 12 | return function (abort, cb) { |
@@ -39,15 +42,37 @@ | ||
39 | 42 | ) |
40 | 43 | } |
41 | 44 | |
42 | 45 | exports.screen_view = function (id, sbot) { |
43 | - if(ref.isMsg(id)) | |
46 | + if(ref.isMsg(id)) { | |
47 | + var content = h('div.column') | |
48 | + var div = h('div.column', {style: {'overflow':'auto'}}, | |
49 | + h('div', content), | |
50 | + u.decorate(exports.message_compose, {root: id}, function (d, e, v) { | |
51 | + return d(e, v, sbot) | |
52 | + }) | |
53 | + ) | |
54 | + var render = ui.createRenderers(exports.message_render, sbot) | |
55 | + | |
56 | + pull( | |
57 | + threadStream(id, sbot), | |
58 | + Scroller(div, content, render, false, false) | |
59 | + ) | |
60 | + | |
61 | + return div | |
62 | + } | |
63 | + | |
44 | 64 | return ui.createStream( |
45 | - threadStream(id, sbot), | |
46 | 65 | ui.createRenderers(exports.message_render, sbot) |
47 | 66 | ) |
48 | 67 | } |
49 | 68 | |
50 | 69 | exports.message_render = [] |
70 | +exports.message_compose = [] | |
51 | 71 | |
52 | 72 | |
53 | 73 | |
74 | + | |
75 | + | |
76 | + | |
77 | + | |
78 | + |
Built with git-ssb-web