git ssb

2+

mixmix / ticktack



Tree: aa4c25f3c365e275c42b08f8e34ef4e6c2b66d93

Files: aa4c25f3c365e275c42b08f8e34ef4e6c2b66d93 / app / page / blogShow.js

2096 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.topNav': 'first',
13 'app.html.comments': 'first',
14 'app.html.sideNav': '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.sideNav({ page: 'discover' }), // HACK to highlight discover
44 h('div.content', [
45 h('section.top', [
46 api.app.html.topNav(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