From 72c4b0804d9268a87e9e87f935ed6cd4da339bf4 Mon Sep 17 00:00:00 2001 From: John Livingston Date: Wed, 12 Jun 2024 10:27:28 +0200 Subject: [PATCH] Better UI for channel configuration pages. --- assets/styles/configuration.scss | 22 +- .../elements/channel-configuration.ts | 297 ++++++++---------- .../configuration/elements/channel-emojis.ts | 90 +++--- .../common/lib/elements/configuration-row.ts | 7 +- .../common/lib/elements/dynamic-table-form.ts | 2 +- 5 files changed, 203 insertions(+), 215 deletions(-) diff --git a/assets/styles/configuration.scss b/assets/styles/configuration.scss index f73e8ca8..42158745 100644 --- a/assets/styles/configuration.scss +++ b/assets/styles/configuration.scss @@ -22,6 +22,19 @@ $grey-background-color: var(--greyBackgroundColor); $sub-menu-margin-bottom: 30px; $small-view: 800px; +livechat-help-button { + a { + height: 18px !important; + margin: 2px !important; + padding: 1px !important; + } + + svg { + display: block; + height: auto; + } +} + /* These are styles to apply for the channel configuration pages. */ @@ -232,6 +245,7 @@ $small-view: 800px; } .peertube-plugin-livechat-configuration-actions { + margin-bottom: 1rem; text-align: right; } } @@ -275,10 +289,6 @@ livechat-dynamic-table-form { } } - button { - padding: 2px !important; - } - .dynamic-table-add-row { background-color: var(--bs-green); @@ -462,3 +472,7 @@ livechat-image-file-input { max-height: 3em !important; // and no max-width } } + +livechat-configuration-row { + margin-top: 3rem; +} diff --git a/client/common/configuration/elements/channel-configuration.ts b/client/common/configuration/elements/channel-configuration.ts index 2dfe5426..3d669cb2 100644 --- a/client/common/configuration/elements/channel-configuration.ts +++ b/client/common/configuration/elements/channel-configuration.ts @@ -251,178 +251,151 @@ export class ChannelConfigurationElement extends LivechatElement {

-
-
- - -
-
-
- - ${this._renderFeedback('peertube-livechat-slowmode-duration-feedback', 'slowMode.duration')} -
-
-
-
-
- - -
-
-
- -
- ${this._channelConfiguration?.configuration.bot.enabled - ? html`
- - { - if (event?.target && this._channelConfiguration) { - this._channelConfiguration.configuration.bot.nickname = - (event.target as HTMLInputElement).value - } - this.requestUpdate('_channelConfiguration') + + +
+
` - : '' - } -
+ } + value="${this._channelConfiguration?.configuration.slowMode.duration ?? ''}" + /> + + ${this._renderFeedback('peertube-livechat-slowmode-duration-feedback', 'slowMode.duration')}
+ + + +
+ +
+ ${!this._channelConfiguration?.configuration.bot.enabled - ? '' - : html` -
-
- - -
-
- { - if (this._channelConfiguration) { - this._channelConfiguration.configuration.bot.forbiddenWords = e.detail - this.requestUpdate('_channelConfiguration') - } + ? '' + : html`
+ + { + if (event?.target && this._channelConfiguration) { + this._channelConfiguration.configuration.bot.nickname = + (event.target as HTMLInputElement).value } + this.requestUpdate('_channelConfiguration') } - .formName=${'forbidden-words'}> - -
+ } + value="${this._channelConfiguration?.configuration.bot.nickname ?? ''}" + /> + ${this._renderFeedback('peertube-livechat-bot-nickname-feedback', 'bot.nickname')}
-
-
- - -
-
- { - if (this._channelConfiguration) { - this._channelConfiguration.configuration.bot.quotes = e.detail - this.requestUpdate('_channelConfiguration') - } - } + + + + { + if (this._channelConfiguration) { + this._channelConfiguration.configuration.bot.forbiddenWords = e.detail + this.requestUpdate('_channelConfiguration') } - .formName=${'quote'}> - -
-
-
-
- - -
-
- { - if (this._channelConfiguration) { - this._channelConfiguration.configuration.bot.commands = e.detail - this.requestUpdate('_channelConfiguration') - } - } + } + } + .formName=${'forbidden-words'} + > + + + + { + if (this._channelConfiguration) { + this._channelConfiguration.configuration.bot.quotes = e.detail + this.requestUpdate('_channelConfiguration') } - .formName=${'command'}> - -
-
+ } + } + .formName=${'quote'} + > + + + + { + if (this._channelConfiguration) { + this._channelConfiguration.configuration.bot.commands = e.detail + this.requestUpdate('_channelConfiguration') + } + } + } + .formName=${'command'} + > `} +
` - : '' - } - ${ - (this._channelEmojisConfiguration?.emojis?.customEmojis?.length ?? 0) < maxEmojisPerChannel - ? html` - ` - : '' - } -
- + -
- { - if (this._channelEmojisConfiguration) { - this._channelEmojisConfiguration.emojis.customEmojis = e.detail - // Fixing missing ':' for shortnames: - for (const desc of this._channelEmojisConfiguration.emojis.customEmojis) { - if (desc.sn === '') { continue } - if (!desc.sn.startsWith(':')) { desc.sn = ':' + desc.sn } - if (!desc.sn.endsWith(':')) { desc.sn += ':' } - } - this.requestUpdate('_channelEmojisConfiguration') +
+ ${ + this._channelEmojisConfiguration?.emojis?.customEmojis?.length + ? html` + ` + : '' + } + ${ + (this._channelEmojisConfiguration?.emojis?.customEmojis?.length ?? 0) < maxEmojisPerChannel + ? html` + ` + : '' + } +
+ + { + if (this._channelEmojisConfiguration) { + this._channelEmojisConfiguration.emojis.customEmojis = e.detail + // Fixing missing ':' for shortnames: + for (const desc of this._channelEmojisConfiguration.emojis.customEmojis) { + if (desc.sn === '') { continue } + if (!desc.sn.startsWith(':')) { desc.sn = ':' + desc.sn } + if (!desc.sn.endsWith(':')) { desc.sn += ':' } } + this.requestUpdate('_channelEmojisConfiguration') } } - > -
+ } + > +