Share chat: default tab is embed.

This commit is contained in:
John Livingston 2024-06-19 11:31:22 +02:00
parent 8a2d556d4e
commit 9f4a92609b
No known key found for this signature in database
GPG Key ID: B17B5640CE66CDBC
2 changed files with 7 additions and 6 deletions

View File

@ -13,7 +13,8 @@ import { isAutoColorsAvailable } from 'shared/lib/autocolors'
import { getIframeUri, getXMPPAddr, UriOptions } from '../uri'
import { isAnonymousUser } from '../../../utils/user'
const validTabNames = ['peertube', 'embed', 'dock', 'xmpp'] as const
// First is default tab.
const validTabNames = ['embed', 'dock', 'peertube', 'xmpp'] as const
type ValidTabNames = typeof validTabNames[number]
@ -54,7 +55,7 @@ export class ShareChatElement extends LivechatElement {
* The current tab.
*/
@property({ attribute: false })
public currentTab: ValidTabNames = 'peertube'
public currentTab: ValidTabNames = validTabNames[0]
/**
* Should we render the XMPP tab?
@ -169,10 +170,10 @@ export class ShareChatElement extends LivechatElement {
// Some sanity checks, to not be in an impossible state.
if (!this.xmppUriEnabled && this.currentTab === 'xmpp') {
this.currentTab = 'peertube'
this.currentTab = validTabNames[0]
}
if (!this.dockEnabled && this.currentTab === 'dock') {
this.currentTab = 'peertube'
this.currentTab = validTabNames[0]
}
}
@ -195,9 +196,9 @@ export class ShareChatElement extends LivechatElement {
public computeUrl (): ComputedUrl {
switch (this.currentTab) {
case 'peertube': return this._computeUrlPeertube()
case 'embed': return this._computeUrlEmbed()
case 'dock': return this._computeUrlDock()
case 'peertube': return this._computeUrlPeertube()
case 'xmpp': return this._computeUrlXMPP()
default:
return {

View File

@ -62,13 +62,13 @@ function _tplShareChatTab (
export function tplShareChatTabs (el: ShareChatElement): TemplateResult {
return html`
${_tplShareChatTab(el, 'peertube', LOC_WEB)}
${_tplShareChatTab(el, 'embed', LOC_SHARE_CHAT_EMBED)}
${
el.dockEnabled
? _tplShareChatTab(el, 'dock', LOC_SHARE_CHAT_DOCK)
: ''
}
${_tplShareChatTab(el, 'peertube', LOC_WEB)}
${
el.xmppUriEnabled
? _tplShareChatTab(el, 'xmpp', LOC_CONNECT_USING_XMPP)