peertube-plugin-livechat/conversejs/custom/templates/muc-bottom-panel.js

39 lines
1.3 KiB
JavaScript
Raw Normal View History

2022-01-07 18:20:28 +00:00
import { __ } from 'i18n'
import { _converse, api } from '@converse/headless/core'
import { html } from 'lit'
import tplMucBottomPanel from '../../src/plugins/muc-views/templates/muc-bottom-panel.js'
async function setNickname (ev, model) {
ev.preventDefault()
const nick = ev.target.nick.value.trim()
nick && await model.setNickname(nick)
_converse.api.trigger('livechatViewerModeSetNickname')
}
export default (o) => {
if (api.settings.get('livechat_viewer_mode')) {
const model = o.model
const i18nNickname = __('Nickname')
const i18nJoin = __('Enter groupchat')
return html`
2022-01-07 18:57:42 +00:00
<div class="livechat-viewer-mode-nick chatroom-form-container"
2022-01-07 18:20:28 +00:00
@submit=${ev => setNickname(ev, model)}>
2022-01-07 18:57:42 +00:00
<form class="converse-form chatroom-form">
2022-01-07 18:20:28 +00:00
<fieldset class="form-group">
<input type="text"
required="required"
name="nick"
value=""
class="form-control"
placeholder="${i18nNickname}"/>
</fieldset>
<fieldset class="form-group">
<input type="submit" class="btn btn-primary" name="join" value="${i18nJoin}"/>
</fieldset>
</form>
</div>
2022-01-07 18:28:07 +00:00
${tplMucBottomPanel(o)}`
2022-01-07 18:20:28 +00:00
}
return tplMucBottomPanel(o)
}