git ssb

2+

mixmix / ticktack



Tree: f1d5a7c472bb8e838a7fd395f59be8d473f8a872

Files: f1d5a7c472bb8e838a7fd395f59be8d473f8a872 / app / page / blogShow.js

2014 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.markdown': 'first',
18 'message.html.timeago': 'first',
19 'feed.obs.thread': 'first',
20
21 'message.html.title': 'first',
22 'message.html.content': 'first',
23
24})
25
26exports.create = (api) => {
27 return nest('app.page.blogShow', blogShow)
28
29 function blogShow (blogMsg) {
30 // blogMsg = a thread (message, may be decorated with replies)
31
32 const { author, content } = blogMsg.value
33
34 const blog = api.message.html.content(blogMsg)
35 const title = api.message.html.title(blogMsg)
36
37 const comments = api.app.html.comments(blogMsg.key)
38
39 const { lastId: branch } = api.feed.obs.thread(blogMsg.key)
40
41 const { timeago, channel, markdown, compose } = api.message.html
42
43 return h('Page -blogShow', [
44 api.app.html.context({ page: 'discover' }), // HACK to highlight discover
45 h('div.content', [
46 h('section.top', [
47 api.app.html.blogNav(location)
48 ]),
49 h('section.content', [
50 h('header', [
51 h('div.blog', [
52 h('h1', title),
53 timeago(blogMsg),
54 channel(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

Built with git-ssb-web