git ssb

0+

Josiah / patchbay-tags



Tree: 085a3a243377487682b151255dac37aefd134985

Files: 085a3a243377487682b151255dac37aefd134985 / app / page / tag.js

811 bytesRaw
1const nest = require('depnest')
2const { computed, map, h } = require('mutant')
3
4exports.gives = nest({
5 'app.page.tag': true
6})
7
8exports.needs = nest({
9 'keys.sync.id': 'first',
10 'message.html.render': 'first',
11 'tag.obs.taggedMessages': 'first'
12})
13
14exports.create = function(api) {
15 return nest({ 'app.page.tag': tagPage })
16
17 function tagPage(path) {
18 const tagId = path
19 const tag = api.tag.async.get(tagId)
20 if (!tag) return
21
22 const myId = api.keys.sync.id()
23 const tagMessages = api.tag.obs.taggedMessages(myId, tagId)
24
25 return h('Page', [
26 h('section', [
27 map(tagMessages, msg => {
28 return computed(msg, msg => {
29 if (msg && !msg.value.missing) {
30 api.message.html.render(msg)
31 }
32 })
33 })
34 ])
35 ])
36 }
37}
38

Built with git-ssb-web