git ssb

10+

Matt McKegg / patchwork



Commit 6751afc5d0191f821b49e0ccfa83176f9218b282

add conditional card rendering for blogs

mix irving committed on 4/10/2018, 6:54:27 AM
Parent: 8c0ec0ef2379cec8464e0a4637c321576ef87cf5

Files changed

modules/feed/html/rollup.jschanged
plugs/message/html/render/blog.jschanged
modules/feed/html/rollup.jsView
@@ -243,8 +243,9 @@
243243
244244 var renderedMessage = api.message.html.render(item, {
245245 compact: compactFilter(item),
246246 includeForks: false, // this is a root message, so forks are already displayed as replies
247+ renderAsCard: true,
247248 priority: getPriority(item)
248249 })
249250
250251 unreadIds.delete(item.key)
plugs/message/html/render/blog.jsView
@@ -6,8 +6,9 @@
66 exports.gives = nest('message.html.render')
77
88 exports.needs = nest({
99 'about.obs.color': 'first',
10+ 'app.navigate': 'first',
1011 'blob.sync.url': 'first',
1112 'message.html.decorate': 'reduce',
1213 'message.html.layout': 'first',
1314 'message.html.markdown': 'first',
@@ -20,22 +21,19 @@
2021 function blogRenderer (msg, opts) {
2122 if (!isBlog(msg)) return
2223
2324 var blog = Blog(api.sbot.obs.connection).obs.get(msg)
24- var showBlog = Value(false)
25- // var showBlog = Value(true)
25+ var content = opts.renderAsCard
26+ ? BlogCard({
27+ blog,
28+ onClick: () => api.app.navigate(msg.key),
29+ color: api.about.obs.color,
30+ blobUrl: api.blob.sync.url
31+ })
32+ : BlogFull(blog, api.message.html.markdown)
2633
2734 const element = api.message.html.layout(msg, Object.assign({}, {
28- content: when(showBlog,
29- BlogFull(blog, api.message.html.markdown),
30- BlogCard({
31- blog,
32- onClick: () => showBlog.set(true),
33- color: api.about.obs.color,
34- blobUrl: api.blob.sync.url
35- })
36- // Sample(blog, api.blob.sync.url, showBlog)
37- ),
35+ content,
3836 layout: 'default'
3937 }, opts))
4038
4139 return api.message.html.decorate(element, { msg })

Built with git-ssb-web