git ssb

2+

mixmix / ticktack



Commit 87346349dd7d0ff160bde53ada8894333856c461

Merge branch 'master' into feature-keys-export

mix irving committed on 6/1/2018, 1:31:34 AM
Parent: f80524e4e4d9ee8b39654228746a0afe58778971
Parent: 163f917c5a149c2eb8ef299013a1b7e234ada49f

Files changed

app/html/comments.jschanged
app/index.jschanged
app/page/blogShow.jschanged
app/page/blogShow.mcsschanged
message/html/likes.mcsschanged
message/html/shares.mcsschanged
message/html/webshares.mcsschanged
message/html/commentsCount.jsadded
message/html/commentsCount.mcssadded
message/index.jschanged
app/html/comments.jsView
@@ -17,9 +17,9 @@
1717 const strings = api.translations.sync.strings()
1818 const { messages, channel, lastId: branch } = thread
1919
2020 // TODO - move this up into Patchcore
21- const messagesTree = computed(throttle(messages, 200), msgs => {
21+ const messagesTree = computed(throttle(messages, 500), msgs => {
2222 return msgs
2323 .filter(msg => forkOf(msg) === undefined) // exclude nested replies / forks
2424 .filter(msg => msg.value.content.root) // exclude root message / blog
2525 .map(comment => {
app/index.jsView
@@ -5,9 +5,9 @@
55 html: {
66 app: require('./html/app'),
77 comments: require('./html/comments'),
88 header: require('./html/header'),
9- thread: require('./html/thread'),
9+ thread: require('./html/thread'), // TODO rename threadPrivate
1010 link: require('./html/link'),
1111 lightbox: require('./html/lightbox'),
1212 blogCard: require('./html/blogCard'),
1313 channelCard: require('./html/channelCard'),
@@ -34,9 +34,9 @@
3434 blogSearch: require('./page/blogSearch'),
3535 blogShow: require('./page/blogShow'),
3636 channelShow: require('./page/channelShow'),
3737 channelSubscriptions: require('./page/channelSubscriptions'),
38- // channel: require('./page/channel'),
38+ // channel: require('./page/channel'), // TODO delete all these files
3939 // image: require('./page/image'),
4040 // groupFind: require('./page/groupFind'),
4141 // groupIndex: require('./page/groupIndex'),
4242 // groupNew: require('./page/groupNew'),
app/page/blogShow.jsView
@@ -10,11 +10,12 @@
1010 'app.html.comments': 'first',
1111 'app.html.sideNav': 'first',
1212 'contact.html.follow': 'first',
1313 'message.html.channel': 'first',
14+ 'message.html.commentsCount': 'first',
1415 'message.html.likes': 'first',
1516 'message.html.webshares': 'first',
16- 'message.html.shares': 'first',
17+ // 'message.html.shares': 'first', // disabled until more design done
1718 'message.html.timeago': 'first',
1819 'feed.obs.thread': 'first',
1920 'blog.html.title': 'first',
2021 'blog.html.content': 'first'
@@ -22,9 +23,9 @@
2223
2324 exports.create = (api) => {
2425 return nest('app.page.blogShow', blogShow)
2526
26- function blogShow(blogMsg) {
27+ function blogShow (blogMsg) {
2728 // blogMsg = a thread (message, may be decorated with replies)
2829
2930 const { author } = blogMsg.value
3031
@@ -47,10 +48,11 @@
4748 h('div.blog-details', [
4849 h('h1', title),
4950 timeago(blogMsg),
5051 channel(blogMsg),
52+ api.message.html.commentsCount(thread),
5153 api.message.html.likes(blogMsg),
52- api.message.html.shares(blogMsg),
54+ // api.message.html.shares(blogMsg),
5355 api.message.html.webshares(blogMsg)
5456 ]),
5557 h('div.author', [
5658 h('div.leftCol', api.about.html.avatar(author, 'medium')),
app/page/blogShow.mcssView
@@ -45,8 +45,11 @@
4545
4646 div.Button.-channel {
4747 margin-right: 1rem
4848 }
49+ div.CommentsCount {
50+ margin-right: 2rem
51+ }
4952 div.Likes {
5053 margin-right: 2rem
5154 }
5255 div.Shares {
message/html/likes.mcssView
@@ -1,7 +1,8 @@
11 Likes {
22 cursor: pointer
33 min-width: 2.5rem
4+ min-hieght: 1.2rem
45
56 display: flex
67 align-items: baseline
78
message/html/shares.mcssView
@@ -1,7 +1,8 @@
11 Shares {
22 cursor: pointer
33 min-width: 2.5rem
4+ min-hieght: 1.2rem
45
56 display: flex
67 align-items: baseline
78
message/html/webshares.mcssView
@@ -1,7 +1,8 @@
11 WebShares {
22 cursor: pointer
33 min-width: 2.5rem
4+ min-hieght: 1.2rem
45
56 display: flex
67 align-items: baseline
78
message/html/commentsCount.jsView
@@ -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.mcssView
@@ -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.jsView
@@ -4,8 +4,9 @@
44 },
55 html: {
66 channel: require('./html/channel'),
77 comment: require('./html/comment'),
8+ commentsCount: require('./html/commentsCount'),
89 compose: require('./html/compose'),
910 likes: require('./html/likes'),
1011 notification: require('./html/notification'),
1112 shares: require('./html/shares'),

Built with git-ssb-web