git ssb

2+

mixmix / ticktack



Tree: 3b308f9cde787a78b0a7c44eb1acdc645be0a63b

Files: 3b308f9cde787a78b0a7c44eb1acdc645be0a63b / message / html / channel.js

820 bytesRaw
1const nest = require('depnest')
2const { h, resolve } = require('mutant')
3
4exports.gives = nest('message.html.channel')
5
6exports.needs = nest({
7 'history.sync.push': 'first'
8})
9
10exports.create = function (api) {
11 return nest('message.html.channel', channel)
12
13 function channel (msgOrChannel, opts = {}) {
14 var channel = typeof msgOrChannel === 'string'
15 ? msgOrChannel
16 : msgOrChannel.value.content.channel
17 if (!channel) return
18
19 channel = channel.replace(/^#/, '')
20 if (!channel) return
21
22 const {
23 classList = [],
24 location = { page: 'channelShow', channel }
25 } = opts
26
27 const goToChannel = (e) => {
28 e.stopPropagation()
29
30 api.history.sync.push(location)
31 }
32
33 return h('Button -channel', {
34 'ev-click': goToChannel,
35 classList
36 }, channel)
37 }
38}
39

Built with git-ssb-web