import type { ShareChatElement } from '../share-chat'
import { html, TemplateResult } from 'lit'
import { ptTr } from '../../../lib/directives/translation'
import { classMap } from 'lit/directives/class-map.js'
export function tplShareChatCopy (el: ShareChatElement): TemplateResult {
const computedUrl = el.computeUrl()
return html`
{
const input = ev.target as HTMLInputElement
// Select the whole value when entering the input.
input.select()
input.setSelectionRange(0, 99999) /* For mobile devices */
}}
/>
${ptTr(LOC_COPY)}
${ptTr(LOC_OPEN)}
`
}
function _tplShareChatTab (
el: ShareChatElement,
tabName: ShareChatElement['currentTab'],
label: string
): TemplateResult {
return html`
{
ev.preventDefault()
el.switchTab(tabName)
}}
>
${ptTr(label)}
`
}
export function tplShareChatTabs (el: ShareChatElement): TemplateResult {
return html`
${_tplShareChatTab(el, 'peertube', LOC_WEB)}
${_tplShareChatTab(el, 'embed', LOC_SHARE_CHAT_EMBED)}
${
el.xmppUriEnabled
? _tplShareChatTab(el, 'xmpp', LOC_CONNECT_USING_XMPP)
: ''
}
`
}
export function tplShareChatTips (el: ShareChatElement): TemplateResult {
let label: string | undefined
switch (el.currentTab) {
case 'peertube':
label = LOC_SHARE_CHAT_PEERTUBE_TIPS
break
case 'embed':
label = LOC_TIPS_FOR_STREAMERS
break
case 'xmpp':
label = LOC_CONNECT_USING_XMPP_HELP
break
}
if (!label) {
return html``
}
return html`${ptTr(label)}
`
}
function _tplShareChatPeertubeOptions (_el: ShareChatElement): TemplateResult {
return html``
}
function _tplShareChatEmbedOptions (el: ShareChatElement): TemplateResult {
return html`
{ el.embedIFrame = !el.embedIFrame }}
/>
${ptTr(LOC_GENERATE_IFRAME)}
{ el.embedReadOnly = !el.embedReadOnly }}
/>
${ptTr(LOC_READ_ONLY)}
{ el.embedReadOnlyScrollbar = !el.embedReadOnlyScrollbar }}
/>
${ptTr(LOC_SHOW_SCROLLBARR)}
{ el.embedReadOnlyTransparentBackground = !el.embedReadOnlyTransparentBackground }}
/>
${ptTr(LOC_TRANSPARENT_BACKGROUND)}
${
el.autocolorsAvailable
? html`
{ el.embedAutocolors = !el.embedAutocolors }}
/>
${ptTr(LOC_USE_CURRENT_THEME_COLOR)}
`
: ''
}
`
}
function _tplShareChatXMPPOptions (_el: ShareChatElement): TemplateResult {
return html``
}
export function tplShareChatOptions (el: ShareChatElement): TemplateResult {
let tpl: TemplateResult
switch (el.currentTab) {
case 'peertube':
tpl = _tplShareChatPeertubeOptions(el)
break
case 'embed':
tpl = _tplShareChatEmbedOptions(el)
break
case 'xmpp':
tpl = _tplShareChatXMPPOptions(el)
break
default:
tpl = html``
}
return html`${tpl}
`
}