// SPDX-FileCopyrightText: 2024 John Livingston // // SPDX-License-Identifier: AGPL-3.0-only 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 */ }} />
` } 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 let tips: TemplateResult | undefined switch (el.currentTab) { case 'peertube': label = LOC_SHARE_CHAT_PEERTUBE_TIPS break case 'embed': label = LOC_TIPS_FOR_STREAMERS tips = html`` break case 'xmpp': label = LOC_CONNECT_USING_XMPP_HELP break } if (!label) { return html`` } return html`
${ptTr(label)}${tips}
` } function _tplShareChatPeertubeOptions (_el: ShareChatElement): TemplateResult { return html`` } function _tplShareChatEmbedOptions (el: ShareChatElement): TemplateResult { return html`
${ el.autocolorsAvailable ? html` ` : '' } ` } 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}
` }