git ssb

2+

mixmix / ticktack



Tree: 8c68dbb9a3b69a0cf0e0dd503ef059a873189cd5

Files: 8c68dbb9a3b69a0cf0e0dd503ef059a873189cd5 / app / html / channelCard.js

1109 bytesRaw
1const nest = require('depnest')
2const { h, when } = require('mutant')
3
4exports.gives = nest('app.html.channelCard')
5
6exports.needs = nest({
7 'keys.sync.id': 'first',
8 'history.sync.push': 'first',
9 'translations.sync.strings': 'first',
10 'channel.obs.subscribed': 'first',
11 'channel.obs.isSubscribedTo': 'first',
12 'channel.async.subscribe': 'first',
13 'channel.async.unsubscribe': 'first',
14 'channel.html.subscribe': 'first',
15})
16
17exports.create = function (api) {
18
19 return nest('app.html.channelCard', (channel) => {
20 const strings = api.translations.sync.strings()
21 const myId = api.keys.sync.id()
22 const { subscribe, unsubscribe } = api.channel.async
23 const { isSubscribedTo } = api.channel.obs
24 const youSubscribe = isSubscribedTo(channel, myId)
25
26 const goToChannel = () => {
27 api.history.sync.push({ page: 'channelShow', channel: channel })
28 }
29
30 return h('ChannelCard', [
31 h('div.content', [
32 h('div.text', [
33 h('h2', {'ev-click': goToChannel}, channel),
34 api.channel.html.subscribe(channel)
35 ])
36 ])
37 ])
38 })
39}
40
41

Built with git-ssb-web