git ssb

2+

mixmix / ticktack



Commit e39763f409d19a3fb6f6c9052dccd36946f8be25

show whether a thread is unread or read via css

Dominic Tarr committed on 11/19/2017, 11:38:14 PM
Parent: 6db39bb005b3d30740a91c3d6ba3a16619d9a48f

Files changed

app/html/blog-card.jschanged
app/html/blog-card.mcsschanged
app/html/thread.jschanged
app/page/threadShow.jschanged
app/page/userShow.jschanged
package-lock.jsonchanged
app/html/blog-card.jsView
@@ -127,4 +127,5 @@
127127 ])
128128 })
129129 }
130130
131+
app/html/blog-card.mcssView
@@ -61,17 +61,15 @@
6161 flex-basis: 100%
6262 }
6363 }
6464 }
65+ background-color: #f8f8f8
6566
6667 -unread {
6768 div.content {
68- background-color: #fff
69-
70- div.subject {
71- $markdownBold
72- }
69+ font-weight: bold
7370 }
71+ background-color: #fff
7472 }
7573 }
7674
7775 Thumbnail {
@@ -81,4 +79,7 @@
8179 width: 8rem
8280 height: 6rem
8381 }
8482
83+
84+
85+
app/html/thread.jsView
@@ -48,10 +48,11 @@
4848 )
4949
5050 function message (msg) {
5151 const raw = get(msg, 'value.content.text')
52- var unread = api.unread.sync.isUnread(msg) ? ' -unread' : ' -read'
53- api.unread.sync.markRead(msg)
52+ var unread = api.unread.sync.isUnread(msg) ? ' -unread' : ''
53+ console.log('unread?', unread, msg)
54+// api.unread.sync.markRead(msg)
5455 return h('div.msg'+unread, api.message.html.markdown(raw))
5556 }
5657
5758 threadView.subject = computed(thread.messages, msgs => {
@@ -96,11 +97,4 @@
9697 // TODO (mix) use lodash/get
9798 return msgA.value.author === msgB.value.author
9899 }
99100
100-
101-
102-
103-
104-
105-
106-
app/page/threadShow.jsView
@@ -20,14 +20,11 @@
2020 const { key, value } = location
2121 const root = get(value, 'content.root', key)
2222 const channel = get(value, 'content.channel')
2323
24+ //unread state is set in here...
2425 const thread = api.app.html.thread(root)
2526
26- //mark the thread as read, as it's being displayed.
27- api.unread.sync.markRead(location)
28- location.replies.forEach(api.unread.sync.markRead)
29-
3027 const meta = {
3128 type: 'post',
3229 root,
3330 //XXX incorrect branch
@@ -50,4 +47,7 @@
5047 }
5148
5249
5350
51+
52+
53+
app/page/userShow.jsView
@@ -17,11 +17,13 @@
1717 'feed.pull.rollup': 'first',
1818 'keys.sync.id': 'first',
1919 'state.obs.threads': 'first',
2020 'translations.sync.strings': 'first',
21+ 'unread.sync.isUnread': 'first'
2122 })
2223
2324 exports.create = (api) => {
25+ var isUnread = api.unread.sync.isUnread
2426 return nest('app.page.userShow', userShow)
2527
2628 function userShow (location) {
2729
@@ -71,8 +73,17 @@
7173 .map(r => typeof r === 'object' ? r.link : r)
7274 .includes(feed)
7375 }),
7476 api.feed.pull.rollup(),
77+ //unread state should not be in this file...
78+ pull.through(function (thread) {
79+ if(isUnread(thread))
80+ thread.unread = true
81+ thread.replies.forEach(function (data) {
82+ if(isUnread(data))
83+ thread.unread = data.unread = true
84+ })
85+ }),
7586 pull.drain(threads.push)
7687 // Scroller(content, scrollerContent, render, false, false)
7788 )
7889
@@ -98,5 +109,4 @@
98109 ])
99110 }
100111 }
101112
102-
package-lock.jsonView
The diff is too large to show. Use a local git client to view these changes.
Old file size: 201691 bytes
New file size: 200327 bytes

Built with git-ssb-web