Commit 87346349dd7d0ff160bde53ada8894333856c461
Merge branch 'master' into feature-keys-export
mix irving committed on 6/1/2018, 1:31:34 AMParent: f80524e4e4d9ee8b39654228746a0afe58778971
Parent: 163f917c5a149c2eb8ef299013a1b7e234ada49f
Files changed
app/html/comments.js | changed |
app/index.js | changed |
app/page/blogShow.js | changed |
app/page/blogShow.mcss | changed |
message/html/likes.mcss | changed |
message/html/shares.mcss | changed |
message/html/webshares.mcss | changed |
message/html/commentsCount.js | added |
message/html/commentsCount.mcss | added |
message/index.js | changed |
app/html/comments.js | ||
---|---|---|
@@ -17,9 +17,9 @@ | ||
17 | 17 | const strings = api.translations.sync.strings() |
18 | 18 | const { messages, channel, lastId: branch } = thread |
19 | 19 | |
20 | 20 | // TODO - move this up into Patchcore |
21 | - const messagesTree = computed(throttle(messages, 200), msgs => { | |
21 | + const messagesTree = computed(throttle(messages, 500), msgs => { | |
22 | 22 | return msgs |
23 | 23 | .filter(msg => forkOf(msg) === undefined) // exclude nested replies / forks |
24 | 24 | .filter(msg => msg.value.content.root) // exclude root message / blog |
25 | 25 | .map(comment => { |
app/index.js | ||
---|---|---|
@@ -5,9 +5,9 @@ | ||
5 | 5 | html: { |
6 | 6 | app: require('./html/app'), |
7 | 7 | comments: require('./html/comments'), |
8 | 8 | header: require('./html/header'), |
9 | - thread: require('./html/thread'), | |
9 | + thread: require('./html/thread'), // TODO rename threadPrivate | |
10 | 10 | link: require('./html/link'), |
11 | 11 | lightbox: require('./html/lightbox'), |
12 | 12 | blogCard: require('./html/blogCard'), |
13 | 13 | channelCard: require('./html/channelCard'), |
@@ -34,9 +34,9 @@ | ||
34 | 34 | blogSearch: require('./page/blogSearch'), |
35 | 35 | blogShow: require('./page/blogShow'), |
36 | 36 | channelShow: require('./page/channelShow'), |
37 | 37 | channelSubscriptions: require('./page/channelSubscriptions'), |
38 | - // channel: require('./page/channel'), | |
38 | + // channel: require('./page/channel'), // TODO delete all these files | |
39 | 39 | // image: require('./page/image'), |
40 | 40 | // groupFind: require('./page/groupFind'), |
41 | 41 | // groupIndex: require('./page/groupIndex'), |
42 | 42 | // groupNew: require('./page/groupNew'), |
app/page/blogShow.js | ||
---|---|---|
@@ -10,11 +10,12 @@ | ||
10 | 10 | 'app.html.comments': 'first', |
11 | 11 | 'app.html.sideNav': 'first', |
12 | 12 | 'contact.html.follow': 'first', |
13 | 13 | 'message.html.channel': 'first', |
14 | + 'message.html.commentsCount': 'first', | |
14 | 15 | 'message.html.likes': 'first', |
15 | 16 | 'message.html.webshares': 'first', |
16 | - 'message.html.shares': 'first', | |
17 | + // 'message.html.shares': 'first', // disabled until more design done | |
17 | 18 | 'message.html.timeago': 'first', |
18 | 19 | 'feed.obs.thread': 'first', |
19 | 20 | 'blog.html.title': 'first', |
20 | 21 | 'blog.html.content': 'first' |
@@ -22,9 +23,9 @@ | ||
22 | 23 | |
23 | 24 | exports.create = (api) => { |
24 | 25 | return nest('app.page.blogShow', blogShow) |
25 | 26 | |
26 | - function blogShow(blogMsg) { | |
27 | + function blogShow (blogMsg) { | |
27 | 28 | // blogMsg = a thread (message, may be decorated with replies) |
28 | 29 | |
29 | 30 | const { author } = blogMsg.value |
30 | 31 | |
@@ -47,10 +48,11 @@ | ||
47 | 48 | h('div.blog-details', [ |
48 | 49 | h('h1', title), |
49 | 50 | timeago(blogMsg), |
50 | 51 | channel(blogMsg), |
52 | + api.message.html.commentsCount(thread), | |
51 | 53 | api.message.html.likes(blogMsg), |
52 | - api.message.html.shares(blogMsg), | |
54 | + // api.message.html.shares(blogMsg), | |
53 | 55 | api.message.html.webshares(blogMsg) |
54 | 56 | ]), |
55 | 57 | h('div.author', [ |
56 | 58 | h('div.leftCol', api.about.html.avatar(author, 'medium')), |
app/page/blogShow.mcss | ||
---|---|---|
@@ -45,8 +45,11 @@ | ||
45 | 45 | |
46 | 46 | div.Button.-channel { |
47 | 47 | margin-right: 1rem |
48 | 48 | } |
49 | + div.CommentsCount { | |
50 | + margin-right: 2rem | |
51 | + } | |
49 | 52 | div.Likes { |
50 | 53 | margin-right: 2rem |
51 | 54 | } |
52 | 55 | div.Shares { |
message/html/likes.mcss | ||
---|---|---|
@@ -1,7 +1,8 @@ | ||
1 | 1 | Likes { |
2 | 2 | cursor: pointer |
3 | 3 | min-width: 2.5rem |
4 | + min-hieght: 1.2rem | |
4 | 5 | |
5 | 6 | display: flex |
6 | 7 | align-items: baseline |
7 | 8 |
message/html/shares.mcss | ||
---|---|---|
@@ -1,7 +1,8 @@ | ||
1 | 1 | Shares { |
2 | 2 | cursor: pointer |
3 | 3 | min-width: 2.5rem |
4 | + min-hieght: 1.2rem | |
4 | 5 | |
5 | 6 | display: flex |
6 | 7 | align-items: baseline |
7 | 8 |
message/html/webshares.mcss | ||
---|---|---|
@@ -1,7 +1,8 @@ | ||
1 | 1 | WebShares { |
2 | 2 | cursor: pointer |
3 | 3 | min-width: 2.5rem |
4 | + min-hieght: 1.2rem | |
4 | 5 | |
5 | 6 | display: flex |
6 | 7 | align-items: baseline |
7 | 8 |
message/html/commentsCount.js | ||
---|---|---|
@@ -1,0 +1,28 @@ | ||
1 | +var { h, computed, throttle, when } = require('mutant') | |
2 | +var nest = require('depnest') | |
3 | + | |
4 | +exports.needs = nest({ | |
5 | + 'keys.sync.id': 'first', | |
6 | + 'message.obs.likes': 'first' | |
7 | +}) | |
8 | + | |
9 | +exports.gives = nest('message.html.commentsCount') | |
10 | + | |
11 | +exports.create = (api) => { | |
12 | + return nest('message.html.commentsCount', function commentsCount (thread) { | |
13 | + var count = computed(throttle(thread.messages, 500), msgs => { | |
14 | + return msgs | |
15 | + .filter(msg => msg.value.content.root) // exclude root message / blog | |
16 | + .filter(msg => { | |
17 | + if (msg.value.content.type !== 'post') console.log(msg.value.content.type) | |
18 | + return msg.value.content.type === 'post' | |
19 | + }) | |
20 | + .length | |
21 | + }) | |
22 | + | |
23 | + return h('CommentsCount', [ | |
24 | + h('i.fa', { className: 'fa-commenting-o' }), | |
25 | + h('div.count', when(count, count)) | |
26 | + ]) | |
27 | + }) | |
28 | +} |
message/html/commentsCount.mcss | ||
---|---|---|
@@ -1,0 +1,15 @@ | ||
1 | +CommentsCount { | |
2 | + cursor: pointer | |
3 | + min-width: 2.5rem | |
4 | + min-hieght: 1.2rem | |
5 | + | |
6 | + display: flex | |
7 | + align-items: baseline | |
8 | + | |
9 | + i { | |
10 | + margin-right: .4rem | |
11 | + } | |
12 | + i.fa-commenting-o { | |
13 | + } | |
14 | +} | |
15 | + |
message/index.js | ||
---|---|---|
@@ -4,8 +4,9 @@ | ||
4 | 4 | }, |
5 | 5 | html: { |
6 | 6 | channel: require('./html/channel'), |
7 | 7 | comment: require('./html/comment'), |
8 | + commentsCount: require('./html/commentsCount'), | |
8 | 9 | compose: require('./html/compose'), |
9 | 10 | likes: require('./html/likes'), |
10 | 11 | notification: require('./html/notification'), |
11 | 12 | shares: require('./html/shares'), |
Built with git-ssb-web