git ssb

2+

mixmix / ticktack



Tree: e82f383b2cc56a63e4afa6eb79a83f8b874713f6

Files: e82f383b2cc56a63e4afa6eb79a83f8b874713f6 / app / page / blogShow.js

2166 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.commentsCount': 'first',
15 'message.html.likes': 'first',
16 'message.html.webshares': 'first',
17 // 'message.html.shares': 'first', // disabled until more design done
18 'message.html.timeago': 'first',
19 'feed.obs.thread': 'first',
20 'blog.html.title': 'first',
21 'blog.html.content': 'first'
22})
23
24exports.create = (api) => {
25 return nest('app.page.blogShow', blogShow)
26
27 function blogShow (blogMsg) {
28 // blogMsg = a thread (message, may be decorated with replies)
29
30 const { author } = blogMsg.value
31
32 const blog = api.blog.html.content(blogMsg)
33 const title = api.blog.html.title(blogMsg)
34
35 const thread = api.feed.obs.thread(blogMsg.key)
36 const comments = api.app.html.comments(thread)
37
38 const { timeago, channel } = api.message.html
39
40 return h('Page -blogShow', [
41 api.app.html.sideNav({ page: 'blogShow' }), // HACK to highlight discover
42 h('Scroller.content', [
43 h('section.top', [
44 api.app.html.topNav(blogMsg)
45 ]),
46 h('section.content', [
47 h('header', [
48 h('div.blog-details', [
49 h('h1', title),
50 timeago(blogMsg),
51 channel(blogMsg),
52 api.message.html.commentsCount(thread),
53 api.message.html.likes(blogMsg),
54 // api.message.html.shares(blogMsg),
55 api.message.html.webshares(blogMsg)
56 ]),
57 h('div.author', [
58 h('div.leftCol', api.about.html.avatar(author, 'medium')),
59 h('div.rightCol', [
60 h('div.name', api.about.obs.name(author)),
61 api.contact.html.follow(author)
62 ])
63 ])
64 ]),
65 h('div.break', h('hr')),
66 h('section.blog', blog),
67 comments
68 ])
69 ])
70 ])
71 }
72}
73

Built with git-ssb-web