Cleaning some stuff.
This commit is contained in:
parent
0491539dfd
commit
b72b23d6ae
@ -6,6 +6,7 @@ import type { RegisterClientOptions } from '@peertube/peertube-types/client'
|
||||
import type { RegisterClientFormFieldOptions } from '@peertube/peertube-types'
|
||||
import { registerConfiguration } from './common/configuration/register'
|
||||
import { registerRoom } from './common/room/register'
|
||||
import './common/lib/elements' // Import shared elements.
|
||||
|
||||
async function register (clientOptions: RegisterClientOptions): Promise<void> {
|
||||
const { peertubeHelpers, registerHook, registerVideoField } = clientOptions
|
||||
|
@ -1,8 +1,6 @@
|
||||
import { createContext } from "@lit/context";
|
||||
import type { RegisterClientOptions } from "@peertube/peertube-types/client/types";
|
||||
import type { ChannelConfiguration } from "shared/lib/types";
|
||||
import { ChannelDetailsService } from "../services/channel-details";
|
||||
import type { ChannelConfiguration } from 'shared/lib/types'
|
||||
import { createContext } from '@lit/context'
|
||||
import { ChannelDetailsService } from '../services/channel-details'
|
||||
|
||||
export const registerClientOptionsContext = createContext<RegisterClientOptions | undefined>(Symbol('register-client-options'));
|
||||
export const channelConfigurationContext = createContext<ChannelConfiguration | undefined>(Symbol('channel-configuration'));
|
||||
export const channelDetailsServiceContext = createContext<ChannelDetailsService | undefined>(Symbol('channel-configuration-service'));
|
||||
export const channelConfigurationContext = createContext<ChannelConfiguration | undefined>(Symbol('channel-configuration'))
|
||||
export const channelDetailsServiceContext = createContext<ChannelDetailsService | undefined>(Symbol('channel-configuration-service'))
|
||||
|
@ -1,15 +1,13 @@
|
||||
import type { RegisterClientOptions } from '@peertube/peertube-types/client'
|
||||
import type { ChannelConfiguration } from 'shared/lib/types'
|
||||
import { html, LitElement } from 'lit'
|
||||
import { customElement, property, state } from 'lit/decorators.js'
|
||||
import { ptTr } from '../directives/translation'
|
||||
import './dynamic-table-form'
|
||||
import './configuration-row'
|
||||
import './help-button'
|
||||
import { Task } from '@lit/task';
|
||||
import type { ChannelConfiguration } from 'shared/lib/types'
|
||||
import { ptTr } from '../../lib/directives/translation'
|
||||
import { Task } from '@lit/task'
|
||||
import { ChannelDetailsService } from '../services/channel-details'
|
||||
import { provide } from '@lit/context'
|
||||
import { channelConfigurationContext, channelDetailsServiceContext, registerClientOptionsContext } from '../contexts/channel'
|
||||
import { channelConfigurationContext, channelDetailsServiceContext } from '../contexts/channel'
|
||||
import { registerClientOptionsContext } from '../../lib/contexts/peertube'
|
||||
|
||||
@customElement('livechat-channel-configuration')
|
||||
export class ChannelConfigurationElement extends LitElement {
|
||||
|
@ -1,13 +1,13 @@
|
||||
import type { RegisterClientOptions } from '@peertube/peertube-types/client'
|
||||
import { html, LitElement } from 'lit'
|
||||
import { customElement, property, state } from 'lit/decorators.js'
|
||||
import { ptTr } from '../directives/translation'
|
||||
import './help-button'
|
||||
import { ptTr } from '../../lib/directives/translation'
|
||||
import { Task } from '@lit/task';
|
||||
import type { ChannelLiveChatInfos } from 'shared/lib/types'
|
||||
import { ChannelDetailsService } from '../services/channel-details'
|
||||
import { provide } from '@lit/context'
|
||||
import { channelDetailsServiceContext, registerClientOptionsContext } from '../contexts/channel'
|
||||
import { channelDetailsServiceContext } from '../contexts/channel'
|
||||
import { registerClientOptionsContext } from '../../lib/contexts/peertube'
|
||||
|
||||
@customElement('livechat-channel-home')
|
||||
export class ChannelHomeElement extends LitElement {
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { html, LitElement } from 'lit'
|
||||
import { customElement, property } from 'lit/decorators.js'
|
||||
import './help-button'
|
||||
|
||||
@customElement('livechat-configuration-row')
|
||||
export class ConfigurationRowElement extends LitElement {
|
||||
|
4
client/common/configuration/elements/index.js
Normal file
4
client/common/configuration/elements/index.js
Normal file
@ -0,0 +1,4 @@
|
||||
// Add here all your elements, the main JS file will import them all.
|
||||
import './channel-configuration'
|
||||
import './channel-home'
|
||||
import './configuration-row'
|
@ -3,9 +3,8 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import type { RegisterClientOptions } from '@peertube/peertube-types/client'
|
||||
import './elements/channel-home'
|
||||
import './elements/channel-configuration'
|
||||
import { html, render } from 'lit'
|
||||
import './elements' // Import all needed elements.
|
||||
|
||||
/**
|
||||
* Registers stuff related to the user's configuration pages.
|
||||
|
@ -1,5 +1,5 @@
|
||||
import type { RegisterClientOptions } from "@peertube/peertube-types/client"
|
||||
import { ChannelLiveChatInfos, ChannelConfiguration, ChannelConfigurationOptions } from "shared/lib/types"
|
||||
import type { RegisterClientOptions } from '@peertube/peertube-types/client'
|
||||
import { ChannelLiveChatInfos, ChannelConfiguration, ChannelConfigurationOptions } from 'shared/lib/types'
|
||||
import { getBaseRoute } from "../../../utils/uri"
|
||||
|
||||
|
||||
|
4
client/common/lib/contexts/peertube.ts
Normal file
4
client/common/lib/contexts/peertube.ts
Normal file
@ -0,0 +1,4 @@
|
||||
import type { RegisterClientOptions } from '@peertube/peertube-types/client/types'
|
||||
import { createContext } from '@lit/context'
|
||||
|
||||
export const registerClientOptionsContext = createContext<RegisterClientOptions | undefined>(Symbol('register-client-options'))
|
@ -155,7 +155,7 @@ export class DynamicTableFormElement extends LitElement {
|
||||
}
|
||||
|
||||
render = () => {
|
||||
const inputId = `peertube-livechat-${this.formName.replaceAll('_', '-')}-table`
|
||||
const inputId = `peertube-livechat-${this.formName.replace(/_/g, '-')}-table`
|
||||
|
||||
this._updateLastRowId()
|
||||
|
||||
@ -200,7 +200,7 @@ export class DynamicTableFormElement extends LitElement {
|
||||
}
|
||||
|
||||
private _renderDataRow = (rowData: { _id: number; row: {[key: string]: DynamicTableAcceptedTypes} }) => {
|
||||
const inputId = `peertube-livechat-${this.formName.replaceAll('_', '-')}-row-${rowData._id}`
|
||||
const inputId = `peertube-livechat-${this.formName.replace(/_/g, '-')}-row-${rowData._id}`
|
||||
|
||||
return html`<tr id=${inputId}>
|
||||
${Object.entries(rowData.row).filter(([k, v]) => k != '_id')
|
||||
@ -226,8 +226,8 @@ export class DynamicTableFormElement extends LitElement {
|
||||
|
||||
let formElement
|
||||
|
||||
const inputName = `${this.formName.replaceAll('-', '_')}_${propertyName.toString().replaceAll('-', '_')}_${rowId}`
|
||||
const inputId = `peertube-livechat-${this.formName.replaceAll('_', '-')}-${propertyName.toString().replaceAll('_', '-')}-${rowId}`
|
||||
const inputName = `${this.formName.replace(/-/g, '_')}_${propertyName.toString().replace(/-/g, '_')}_${rowId}`
|
||||
const inputId = `peertube-livechat-${this.formName.replace(/_/g, '-')}-${propertyName.toString().replace(/_/g, '-')}-${rowId}`
|
||||
|
||||
switch (propertyValue.constructor) {
|
||||
case String:
|
@ -3,7 +3,7 @@ import { customElement, property, state } from 'lit/decorators.js'
|
||||
import { unsafeHTML } from 'lit/directives/unsafe-html.js'
|
||||
import { helpButtonSVG } from '../../../videowatch/buttons'
|
||||
import { consume } from '@lit/context'
|
||||
import { registerClientOptionsContext } from '../contexts/channel'
|
||||
import { registerClientOptionsContext } from '../contexts/peertube'
|
||||
import type { RegisterClientOptions } from '@peertube/peertube-types/client'
|
||||
import { Task } from '@lit/task'
|
||||
import { localizedHelpUrl } from '../../../utils/help'
|
3
client/common/lib/elements/index.js
Normal file
3
client/common/lib/elements/index.js
Normal file
@ -0,0 +1,3 @@
|
||||
// Add here all your elements, the main JS file will import them all.
|
||||
import './help-button'
|
||||
import './dynamic-table-form'
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"experimentalDecorators": true,
|
||||
"module": "es2022",
|
||||
"module": "es6",
|
||||
"moduleResolution": "node",
|
||||
"target": "es2022",
|
||||
"target": "es5",
|
||||
"allowJs": true,
|
||||
"sourceMap": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
|
@ -56,7 +56,6 @@
|
||||
"@types/express": "^4.17.13",
|
||||
"@types/got": "^9.6.12",
|
||||
"@types/http-proxy": "^1.17.9",
|
||||
"@types/mustache": "^4.2.2",
|
||||
"@types/node": "^16.11.6",
|
||||
"@types/winston": "^2.4.4",
|
||||
"@types/xmpp__jid": "^1.3.5",
|
||||
@ -71,7 +70,6 @@
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-plugin-promise": "^5.1.1",
|
||||
"eslint-plugin-standard": "^5.0.0",
|
||||
"mustache": "^4.2.0",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"sass": "^1.43.4",
|
||||
"sharp": "^0.33.2",
|
||||
|
Loading…
x
Reference in New Issue
Block a user