git ssb

2+

mixmix / ticktack



Tree: f53d4720c0fe90f6e4f8f94d0f986812e6ca896b

Files: f53d4720c0fe90f6e4f8f94d0f986812e6ca896b / app / page / blogShow.js

2098 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 'blog.html.title': 'first',
22 'blog.html.content': 'first',
23})
24
25exports.create = (api) => {
26 return nest('app.page.blogShow', blogShow)
27
28 function blogShow (blogMsg) {
29 // blogMsg = a thread (message, may be decorated with replies)
30
31 const { author, content } = blogMsg.value
32
33 const blog = api.blog.html.content(blogMsg)
34 const title = api.blog.html.title(blogMsg)
35
36 const thread = api.feed.obs.thread(blogMsg.key)
37 const comments = api.app.html.comments(thread)
38 const branch = thread.lastId
39
40 const { timeago, channel, markdown, compose } = api.message.html
41
42 return h('Page -blogShow', [
43 api.app.html.context({ page: 'discover' }), // HACK to highlight discover
44 h('div.content', [
45 h('section.top', [
46 api.app.html.blogNav(location)
47 ]),
48 h('section.content', [
49 h('header', [
50 h('div.blog', [
51 h('h1', title),
52 timeago(blogMsg),
53 channel(blogMsg),
54 api.message.html.likes(blogMsg)
55 ]),
56 h('div.author', [
57 h('div.leftCol', api.about.html.avatar(author, 'medium')),
58 h('div.rightCol', [
59 h('div.name', api.about.obs.name(author)),
60 api.contact.html.follow(author)
61 ]),
62 ])
63 ]),
64 h('div.break', h('hr')),
65 h('section.blog', blog),
66 comments,
67 ]),
68 ])
69 ])
70 }
71}
72
73
74
75
76
77

Built with git-ssb-web