Commit e39763f409d19a3fb6f6c9052dccd36946f8be25
show whether a thread is unread or read via css
Dominic Tarr committed on 11/19/2017, 11:38:14 PMParent: 6db39bb005b3d30740a91c3d6ba3a16619d9a48f
Files changed
app/html/blog-card.js | changed |
app/html/blog-card.mcss | changed |
app/html/thread.js | changed |
app/page/threadShow.js | changed |
app/page/userShow.js | changed |
package-lock.json | changed |
app/html/blog-card.mcss | ||
---|---|---|
@@ -61,17 +61,15 @@ | ||
61 | 61 | flex-basis: 100% |
62 | 62 | } |
63 | 63 | } |
64 | 64 | } |
65 | + background-color: #f8f8f8 | |
65 | 66 | |
66 | 67 | -unread { |
67 | 68 | div.content { |
68 | - background-color: #fff | |
69 | - | |
70 | - div.subject { | |
71 | - $markdownBold | |
72 | - } | |
69 | + font-weight: bold | |
73 | 70 | } |
71 | + background-color: #fff | |
74 | 72 | } |
75 | 73 | } |
76 | 74 | |
77 | 75 | Thumbnail { |
@@ -81,4 +79,7 @@ | ||
81 | 79 | width: 8rem |
82 | 80 | height: 6rem |
83 | 81 | } |
84 | 82 | |
83 | + | |
84 | + | |
85 | + |
app/html/thread.js | ||
---|---|---|
@@ -48,10 +48,11 @@ | ||
48 | 48 | ) |
49 | 49 | |
50 | 50 | function message (msg) { |
51 | 51 | 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) | |
54 | 55 | return h('div.msg'+unread, api.message.html.markdown(raw)) |
55 | 56 | } |
56 | 57 | |
57 | 58 | threadView.subject = computed(thread.messages, msgs => { |
@@ -96,11 +97,4 @@ | ||
96 | 97 | // TODO (mix) use lodash/get |
97 | 98 | return msgA.value.author === msgB.value.author |
98 | 99 | } |
99 | 100 | |
100 | - | |
101 | - | |
102 | - | |
103 | - | |
104 | - | |
105 | - | |
106 | - |
app/page/threadShow.js | ||
---|---|---|
@@ -20,14 +20,11 @@ | ||
20 | 20 | const { key, value } = location |
21 | 21 | const root = get(value, 'content.root', key) |
22 | 22 | const channel = get(value, 'content.channel') |
23 | 23 | |
24 | + //unread state is set in here... | |
24 | 25 | const thread = api.app.html.thread(root) |
25 | 26 | |
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 | - | |
30 | 27 | const meta = { |
31 | 28 | type: 'post', |
32 | 29 | root, |
33 | 30 | //XXX incorrect branch |
@@ -50,4 +47,7 @@ | ||
50 | 47 | } |
51 | 48 | |
52 | 49 | |
53 | 50 | |
51 | + | |
52 | + | |
53 | + |
app/page/userShow.js | ||
---|---|---|
@@ -17,11 +17,13 @@ | ||
17 | 17 | 'feed.pull.rollup': 'first', |
18 | 18 | 'keys.sync.id': 'first', |
19 | 19 | 'state.obs.threads': 'first', |
20 | 20 | 'translations.sync.strings': 'first', |
21 | + 'unread.sync.isUnread': 'first' | |
21 | 22 | }) |
22 | 23 | |
23 | 24 | exports.create = (api) => { |
25 | + var isUnread = api.unread.sync.isUnread | |
24 | 26 | return nest('app.page.userShow', userShow) |
25 | 27 | |
26 | 28 | function userShow (location) { |
27 | 29 | |
@@ -71,8 +73,17 @@ | ||
71 | 73 | .map(r => typeof r === 'object' ? r.link : r) |
72 | 74 | .includes(feed) |
73 | 75 | }), |
74 | 76 | 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 | + }), | |
75 | 86 | pull.drain(threads.push) |
76 | 87 | // Scroller(content, scrollerContent, render, false, false) |
77 | 88 | ) |
78 | 89 | |
@@ -98,5 +109,4 @@ | ||
98 | 109 | ]) |
99 | 110 | } |
100 | 111 | } |
101 | 112 | |
102 | - |
package-lock.json | ||
---|---|---|
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