git ssb

1+

Daan Patchwork / patchwork



Tree: 3451510316992d414ec76ba5b29681fe359b7428

Files: 3451510316992d414ec76ba5b29681fe359b7428 / lib / depject / page / html / render / your-posts.js

1380 bytesRaw
1const nest = require('depnest')
2const { h } = require('mutant')
3
4exports.needs = nest({
5 'sbot.pull.resumeStream': 'first',
6 'sbot.pull.stream': 'first',
7 'feed.html.rollup': 'first',
8 'keys.sync.id': 'first',
9 'intl.sync.i18n': 'first'
10})
11
12exports.gives = nest({
13 'page.html.render': true
14})
15
16exports.create = function (api) {
17 const i18n = api.intl.sync.i18n
18 return nest('page.html.render', page)
19
20 function page (path) {
21 if (path !== '/your-posts') return // "/" is a sigil for "page"
22
23 const prepend = [
24 h('PageHeading', [
25 h('h1', [
26 i18n('Threads Started By You')
27 ])
28 ])
29 ]
30
31 const getStream = api.sbot.pull.resumeStream((sbot, opts) => {
32 return sbot.patchwork.participatingFeed.roots(opts)
33 }, { limit: 10, reverse: true, onlyStarted: true })
34
35 const yourId = api.keys.sync.id()
36
37 const feedView = api.feed.html.rollup(getStream, {
38 prepend,
39 searchSpinner: true,
40 groupSummaries: false,
41 compactFilter: (msg) => msg.value.author === yourId, // condense your messages
42 updateStream: api.sbot.pull.stream(sbot => sbot.patchwork.participatingFeed.latest({ onlyStarted: true }))
43 })
44
45 const result = h('div.SplitView', [
46 h('div.main', feedView)
47 ])
48
49 result.pendingUpdates = feedView.pendingUpdates
50 result.reload = feedView.reload
51
52 return result
53 }
54}
55

Built with git-ssb-web