add member counter on palantir button

pull/5426/head
Thibault Duplessis 2019-08-13 10:08:18 +02:00
parent 61decea753
commit b6ed449d35
2 changed files with 28 additions and 18 deletions

View File

@ -23,4 +23,11 @@
color: $c-bad-over !important;
}
}
&::after {
top: 1px;
left: 0;
right: auto;
background: none;
box-shadow: none;
}
}

View File

@ -173,24 +173,27 @@ export function palantir(opts: PalantirOpts) {
}, 3000);
return {
render: h =>
devices ? h('div.mchat__tab.palantir.palantir-' + state, {
attrs: {
'data-icon': '',
title: `Voice chat: ${state}`
},
hook: {
insert(vnode) {
(vnode.elm as HTMLElement).addEventListener('click', () => peer ? stop() : start());
render: h => {
const connections = allOpenConnections();
return devices ? h('div.mchat__tab.palantir.data-count.palantir-' + state, {
attrs: {
'data-icon': '',
title: `Voice chat: ${state}`,
'data-count': state == 'on' ? connections.length + 1 : 0
},
hook: {
insert(vnode) {
(vnode.elm as HTMLElement).addEventListener('click', () => peer ? stop() : start());
}
}
}
}, state == 'on' ?
allOpenConnections().map(c =>
h('audio.palantir__audio.' + c.peer, {
attrs: { autoplay: true },
hook: { insert(vnode) { (vnode.elm as HTMLAudioElement).srcObject = c.remoteStream } }
})
) : []
) : null
}, state == 'on' ?
connections.map(c =>
h('audio.palantir__audio.' + c.peer, {
attrs: { autoplay: true },
hook: { insert(vnode) { (vnode.elm as HTMLAudioElement).srcObject = c.remoteStream } }
})
) : []
) : null;
}
}
}