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