git ssb

2+

mixmix / ticktack



Tree: 162122b46e57bbd1cb6ff6774e6b40502586e89b

Files: 162122b46e57bbd1cb6ff6774e6b40502586e89b / app / page / blogShow.js

2082 bytesRaw
1const nest = require('depnest')
2const { h, computed, when } = require('mutant')
3const { title: getTitle } = require('markdown-summary')
4const last = require('lodash/last')
5const get = require('lodash/get')
6
7exports.gives = nest('app.page.blogShow')
8
9exports.needs = nest({
10 'about.html.avatar': 'first',
11 'about.obs.name': 'first',
12 'app.html.blogNav': 'first',
13 'app.html.comments': 'first',
14 'app.html.context': 'first',
15 'contact.html.follow': 'first',
16 'message.html.channel': 'first',
17 'message.html.likes': 'first',
18 'message.html.markdown': 'first',
19 'message.html.timeago': 'first',
20 'feed.obs.thread': 'first',
21
22 'blog.html.title': 'first',
23 'blog.html.content': 'first',
24
25})
26
27exports.create = (api) => {
28 return nest('app.page.blogShow', blogShow)
29
30 function blogShow (blogMsg) {
31 // blogMsg = a thread (message, may be decorated with replies)
32
33 const { author, content } = blogMsg.value
34
35 const blog = api.blog.html.content(blogMsg)
36 const title = api.blog.html.title(blogMsg)
37
38 const comments = api.app.html.comments(blogMsg.key)
39
40 const { lastId: branch } = api.feed.obs.thread(blogMsg.key)
41
42 const { timeago, channel, markdown, compose } = api.message.html
43
44 return h('Page -blogShow', [
45 api.app.html.context({ page: 'discover' }), // HACK to highlight discover
46 h('div.content', [
47 h('section.top', [
48 api.app.html.blogNav(location)
49 ]),
50 h('section.content', [
51 h('header', [
52 h('div.blog', [
53 h('h1', title),
54 timeago(blogMsg),
55 channel(blogMsg),
56 api.message.html.likes(blogMsg)
57 ]),
58 h('div.author', [
59 h('div.leftCol', api.about.html.avatar(author, 'medium')),
60 h('div.rightCol', [
61 h('div.name', api.about.obs.name(author)),
62 api.contact.html.follow(author)
63 ]),
64 ])
65 ]),
66 h('div.break', h('hr')),
67 h('section.blog', blog),
68 comments,
69 ]),
70 ])
71 ])
72 }
73}
74
75
76

Built with git-ssb-web