Cleaning more stuff.
This commit is contained in:
parent
b72b23d6ae
commit
1d14bbbda0
@ -1,6 +1,6 @@
|
|||||||
import type { RegisterClientOptions } from '@peertube/peertube-types/client'
|
import type { RegisterClientOptions } from '@peertube/peertube-types/client'
|
||||||
import type { ChannelConfiguration } from 'shared/lib/types'
|
import type { ChannelConfiguration } from 'shared/lib/types'
|
||||||
import { html, LitElement } from 'lit'
|
import { html } from 'lit'
|
||||||
import { customElement, property, state } from 'lit/decorators.js'
|
import { customElement, property, state } from 'lit/decorators.js'
|
||||||
import { ptTr } from '../../lib/directives/translation'
|
import { ptTr } from '../../lib/directives/translation'
|
||||||
import { Task } from '@lit/task'
|
import { Task } from '@lit/task'
|
||||||
@ -8,9 +8,10 @@ import { ChannelDetailsService } from '../services/channel-details'
|
|||||||
import { provide } from '@lit/context'
|
import { provide } from '@lit/context'
|
||||||
import { channelConfigurationContext, channelDetailsServiceContext } from '../contexts/channel'
|
import { channelConfigurationContext, channelDetailsServiceContext } from '../contexts/channel'
|
||||||
import { registerClientOptionsContext } from '../../lib/contexts/peertube'
|
import { registerClientOptionsContext } from '../../lib/contexts/peertube'
|
||||||
|
import { LivechatElement } from '../../lib/elements/livechat'
|
||||||
|
|
||||||
@customElement('livechat-channel-configuration')
|
@customElement('livechat-channel-configuration')
|
||||||
export class ChannelConfigurationElement extends LitElement {
|
export class ChannelConfigurationElement extends LivechatElement {
|
||||||
|
|
||||||
@provide({ context: registerClientOptionsContext })
|
@provide({ context: registerClientOptionsContext })
|
||||||
@property({ attribute: false })
|
@property({ attribute: false })
|
||||||
@ -26,10 +27,6 @@ export class ChannelConfigurationElement extends LitElement {
|
|||||||
@provide({ context: channelDetailsServiceContext })
|
@provide({ context: channelDetailsServiceContext })
|
||||||
private _channelDetailsService: ChannelDetailsService | undefined
|
private _channelDetailsService: ChannelDetailsService | undefined
|
||||||
|
|
||||||
protected createRenderRoot = (): HTMLElement | DocumentFragment => {
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
|
|
||||||
@state()
|
@state()
|
||||||
public _formStatus: boolean | any = undefined
|
public _formStatus: boolean | any = undefined
|
||||||
|
|
||||||
|
@ -8,9 +8,10 @@ import { ChannelDetailsService } from '../services/channel-details'
|
|||||||
import { provide } from '@lit/context'
|
import { provide } from '@lit/context'
|
||||||
import { channelDetailsServiceContext } from '../contexts/channel'
|
import { channelDetailsServiceContext } from '../contexts/channel'
|
||||||
import { registerClientOptionsContext } from '../../lib/contexts/peertube'
|
import { registerClientOptionsContext } from '../../lib/contexts/peertube'
|
||||||
|
import { LivechatElement } from '../../lib/elements/livechat'
|
||||||
|
|
||||||
@customElement('livechat-channel-home')
|
@customElement('livechat-channel-home')
|
||||||
export class ChannelHomeElement extends LitElement {
|
export class ChannelHomeElement extends LivechatElement {
|
||||||
|
|
||||||
@provide({ context: registerClientOptionsContext })
|
@provide({ context: registerClientOptionsContext })
|
||||||
@property({ attribute: false })
|
@property({ attribute: false })
|
||||||
@ -22,10 +23,6 @@ export class ChannelHomeElement extends LitElement {
|
|||||||
@provide({ context: channelDetailsServiceContext })
|
@provide({ context: channelDetailsServiceContext })
|
||||||
private _channelDetailsService: ChannelDetailsService | undefined
|
private _channelDetailsService: ChannelDetailsService | undefined
|
||||||
|
|
||||||
protected createRenderRoot = (): HTMLElement | DocumentFragment => {
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
|
|
||||||
@state()
|
@state()
|
||||||
public _formStatus: boolean | any = undefined
|
public _formStatus: boolean | any = undefined
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import { html, LitElement } from 'lit'
|
import { html } from 'lit'
|
||||||
import { customElement, property } from 'lit/decorators.js'
|
import { customElement, property } from 'lit/decorators.js'
|
||||||
|
import { LivechatElement } from '../../lib/elements/livechat'
|
||||||
|
|
||||||
@customElement('livechat-configuration-row')
|
@customElement('livechat-configuration-row')
|
||||||
export class ConfigurationRowElement extends LitElement {
|
export class ConfigurationRowElement extends LivechatElement {
|
||||||
|
|
||||||
@property({ attribute: false })
|
@property({ attribute: false })
|
||||||
public title: string = `title`
|
public title: string = `title`
|
||||||
@ -13,10 +14,6 @@ export class ConfigurationRowElement extends LitElement {
|
|||||||
@property({ attribute: false })
|
@property({ attribute: false })
|
||||||
public helpPage: string = 'documentation'
|
public helpPage: string = 'documentation'
|
||||||
|
|
||||||
protected createRenderRoot = (): HTMLElement | DocumentFragment => {
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return html`
|
return html`
|
||||||
<h2>${this.title}</h2>
|
<h2>${this.title}</h2>
|
||||||
|
@ -57,6 +57,7 @@ interface CellDataSchema {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@customElement('livechat-dynamic-table-form')
|
@customElement('livechat-dynamic-table-form')
|
||||||
|
// FIXME: use LivechatElement instead of LitElement? If so, be carefull about createRenderRoot
|
||||||
export class DynamicTableFormElement extends LitElement {
|
export class DynamicTableFormElement extends LitElement {
|
||||||
|
|
||||||
@property({ attribute: false })
|
@property({ attribute: false })
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { html, LitElement } from 'lit'
|
import { html } from 'lit'
|
||||||
import { customElement, property, state } from 'lit/decorators.js'
|
import { customElement, property, state } from 'lit/decorators.js'
|
||||||
import { unsafeHTML } from 'lit/directives/unsafe-html.js'
|
import { unsafeHTML } from 'lit/directives/unsafe-html.js'
|
||||||
import { helpButtonSVG } from '../../../videowatch/buttons'
|
import { helpButtonSVG } from '../../../videowatch/buttons'
|
||||||
@ -9,9 +9,10 @@ import { Task } from '@lit/task'
|
|||||||
import { localizedHelpUrl } from '../../../utils/help'
|
import { localizedHelpUrl } from '../../../utils/help'
|
||||||
import { ptTr } from '../directives/translation'
|
import { ptTr } from '../directives/translation'
|
||||||
import { DirectiveResult } from 'lit/directive'
|
import { DirectiveResult } from 'lit/directive'
|
||||||
|
import { LivechatElement } from './livechat'
|
||||||
|
|
||||||
@customElement('livechat-help-button')
|
@customElement('livechat-help-button')
|
||||||
export class HelpButtonElement extends LitElement {
|
export class HelpButtonElement extends LivechatElement {
|
||||||
|
|
||||||
@consume({ context: registerClientOptionsContext, subscribe: true })
|
@consume({ context: registerClientOptionsContext, subscribe: true })
|
||||||
public registerClientOptions: RegisterClientOptions | undefined
|
public registerClientOptions: RegisterClientOptions | undefined
|
||||||
@ -25,10 +26,6 @@ export class HelpButtonElement extends LitElement {
|
|||||||
@state()
|
@state()
|
||||||
public url: URL = new URL('https://lmddgtfy.net/')
|
public url: URL = new URL('https://lmddgtfy.net/')
|
||||||
|
|
||||||
protected createRenderRoot = (): HTMLElement | DocumentFragment => {
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
|
|
||||||
private _asyncTaskRender = new Task(this, {
|
private _asyncTaskRender = new Task(this, {
|
||||||
task: async ([registerClientOptions], {signal}) => {
|
task: async ([registerClientOptions], {signal}) => {
|
||||||
this.url = new URL(registerClientOptions ? await localizedHelpUrl(registerClientOptions, { page: this.page }) : '')
|
this.url = new URL(registerClientOptions ? await localizedHelpUrl(registerClientOptions, { page: this.page }) : '')
|
||||||
|
10
client/common/lib/elements/livechat.ts
Normal file
10
client/common/lib/elements/livechat.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import { LitElement } from 'lit'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class for all Custom Elements.
|
||||||
|
*/
|
||||||
|
export class LivechatElement extends LitElement {
|
||||||
|
protected createRenderRoot = (): HTMLElement | DocumentFragment => {
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user