git ssb

2+

mixmix / ticktack



Tree: 0a4073c00a2da5c212e6f7ecf45ad96cc8818d14

Files: 0a4073c00a2da5c212e6f7ecf45ad96cc8818d14 / app / page / blogShow.js

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

Built with git-ssb-web