Some styling and html fixes.
This commit is contained in:
parent
612a9f622d
commit
610040b253
@ -1,10 +1,12 @@
|
|||||||
#peertube-plugin-livechat-container {
|
#peertube-plugin-livechat-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
|
||||||
|
|
||||||
#plugin-placeholder-player-next #peertube-plugin-livechat-container {
|
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
||||||
|
// Bigger occupants sidebar when embedded near a video.
|
||||||
|
.chatroom .box-flyout .chatroom-body .occupants {
|
||||||
|
min-width: min(200px, 50%);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.peertube-plugin-livechat-buttons {
|
.peertube-plugin-livechat-buttons {
|
||||||
@ -68,9 +70,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#peertube-plugin-livechat-container converse-root {
|
#peertube-plugin-livechat-container converse-root {
|
||||||
|
display: block;
|
||||||
border: 1px solid black;
|
border: 1px solid black;
|
||||||
min-height: 30vh;
|
min-height: max(30vh, 200px);
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
||||||
|
converse-muc {
|
||||||
|
min-height: max(30vh, 200px);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.peertube-plugin-livechat-experimental,
|
.peertube-plugin-livechat-experimental,
|
||||||
@ -179,7 +186,9 @@ table.peertube-plugin-livechat-prosody-list-rooms td {
|
|||||||
width: 48px;
|
width: 48px;
|
||||||
height: 48px;
|
height: 48px;
|
||||||
margin: 20px;
|
margin: 20px;
|
||||||
|
/* stylelint-disable-next-line custom-property-pattern */
|
||||||
border: 5px solid var(--greyBackgroundColor);
|
border: 5px solid var(--greyBackgroundColor);
|
||||||
|
/* stylelint-disable-next-line custom-property-pattern */
|
||||||
border-bottom-color: var(--mainColor);
|
border-bottom-color: var(--mainColor);
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
@ -125,17 +125,17 @@ async function displayConverseJS (
|
|||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const peertubeHelpers = clientOptions.peertubeHelpers
|
const peertubeHelpers = clientOptions.peertubeHelpers
|
||||||
|
|
||||||
const converseRoot = document.createElement('converse-root')
|
|
||||||
converseRoot.classList.add('theme-peertube')
|
|
||||||
container.append(converseRoot)
|
|
||||||
|
|
||||||
const spinner = document.createElement('div')
|
const spinner = document.createElement('div')
|
||||||
spinner.classList.add('livechat-spinner')
|
spinner.classList.add('livechat-spinner')
|
||||||
spinner.setAttribute('id', 'livechat-loading-spinner')
|
spinner.setAttribute('id', 'livechat-loading-spinner')
|
||||||
spinner.innerHTML = '<div></div>'
|
spinner.innerHTML = '<div></div>'
|
||||||
container.prepend(spinner)
|
container.append(spinner)
|
||||||
// spinner will be removed by a converse plugin
|
// spinner will be removed by a converse plugin
|
||||||
|
|
||||||
|
const converseRoot = document.createElement('converse-root')
|
||||||
|
converseRoot.classList.add('theme-peertube')
|
||||||
|
container.append(converseRoot)
|
||||||
|
|
||||||
const authHeader = peertubeHelpers.getAuthHeader()
|
const authHeader = peertubeHelpers.getAuthHeader()
|
||||||
|
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
|
@ -198,7 +198,7 @@ function register (registerOptions: RegisterClientOptions): void {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (container.querySelector('converse-root')) {
|
if (container.getElementsByTagName('converse-root').length) {
|
||||||
logger.error('Seems that there is already a ConverseJS in the container.')
|
logger.error('Seems that there is already a ConverseJS in the container.')
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -221,7 +221,7 @@ function register (registerOptions: RegisterClientOptions): void {
|
|||||||
function closeChat (): void {
|
function closeChat (): void {
|
||||||
const container = document.getElementById('peertube-plugin-livechat-container')
|
const container = document.getElementById('peertube-plugin-livechat-container')
|
||||||
if (!container) {
|
if (!container) {
|
||||||
logger.error('Cant close livechat, container not found.')
|
logger.error('Can\'t close livechat, container not found.')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,7 +229,7 @@ function register (registerOptions: RegisterClientOptions): void {
|
|||||||
if (window.converse?.livechatDisconnect) { window.converse.livechatDisconnect() }
|
if (window.converse?.livechatDisconnect) { window.converse.livechatDisconnect() }
|
||||||
|
|
||||||
// Removing from the DOM
|
// Removing from the DOM
|
||||||
container.childNodes.forEach(dom => dom.remove())
|
container.querySelectorAll('converse-root, .livechat-spinner').forEach(dom => dom.remove())
|
||||||
|
|
||||||
container.setAttribute('peertube-plugin-livechat-state', 'closed')
|
container.setAttribute('peertube-plugin-livechat-state', 'closed')
|
||||||
|
|
||||||
|
@ -86,7 +86,11 @@ async function initConverse (
|
|||||||
|
|
||||||
const isInIframe = inIframe()
|
const isInIframe = inIframe()
|
||||||
initDom(initConverseParams, isInIframe)
|
initDom(initConverseParams, isInIframe)
|
||||||
const params = defaultConverseParams(initConverseParams, isInIframe)
|
if (!isInIframe) { initConverseParams.autofocus = true }
|
||||||
|
if (isInIframe || chatIncludeMode === 'peertube-video') {
|
||||||
|
initConverseParams.forceDefaultHideMucParticipants = true
|
||||||
|
}
|
||||||
|
const params = defaultConverseParams(initConverseParams)
|
||||||
params.view_mode = chatIncludeMode === 'chat-only' ? 'fullscreen' : 'embedded'
|
params.view_mode = chatIncludeMode === 'chat-only' ? 'fullscreen' : 'embedded'
|
||||||
params.allow_url_history_change = chatIncludeMode === 'chat-only'
|
params.allow_url_history_change = chatIncludeMode === 'chat-only'
|
||||||
|
|
||||||
|
@ -148,6 +148,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// hidding avatars when screen width is not big enough.
|
// hidding avatars when screen width is not big enough.
|
||||||
|
// FIXME: how to apply this when the chat is beside video without iframe? (2024-04-02)
|
||||||
@media screen and (max-width: 250px) {
|
@media screen and (max-width: 250px) {
|
||||||
.message {
|
.message {
|
||||||
&.chat-msg {
|
&.chat-msg {
|
||||||
@ -176,14 +177,8 @@
|
|||||||
|
|
||||||
// Bigger occupants sidebar when width is not big enough.
|
// Bigger occupants sidebar when width is not big enough.
|
||||||
@media screen and (max-width: 576px) {
|
@media screen and (max-width: 576px) {
|
||||||
.chatroom {
|
.chatroom .box-flyout .chatroom-body .occupants {
|
||||||
.box-flyout {
|
|
||||||
.chatroom-body {
|
|
||||||
.occupants {
|
|
||||||
min-width: 50%;
|
min-width: 50%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
@import "shared/styles/index";
|
@import "shared/styles/index";
|
||||||
@import "./peertubetheme";
|
@import "./peertubetheme";
|
||||||
|
|
||||||
peertube-plugin-livechat-container,
|
body.livechat-iframe,
|
||||||
body.livechat-iframe {
|
#peertube-plugin-livechat-container {
|
||||||
#conversejs .chat-head {
|
#conversejs .chat-head {
|
||||||
// Hidding the chat-head when the plugin is displayed in an iframe or besides a video.
|
// Hidding the chat-head when the plugin is displayed in an iframe or besides a video.
|
||||||
display: none;
|
display: none;
|
||||||
@ -21,6 +21,7 @@ body.livechat-iframe {
|
|||||||
|
|
||||||
// Readonly mode
|
// Readonly mode
|
||||||
body.livechat-readonly #conversejs {
|
body.livechat-readonly #conversejs {
|
||||||
|
/* stylelint-disable-next-line no-descending-specificity */
|
||||||
.chat-head,
|
.chat-head,
|
||||||
.bottom-panel,
|
.bottom-panel,
|
||||||
converse-message-actions,
|
converse-message-actions,
|
||||||
@ -113,7 +114,10 @@ body.converse-embedded {
|
|||||||
height: 90vh;
|
height: 90vh;
|
||||||
min-height: 400px;
|
min-height: 400px;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.livechat-embed-fullpage,
|
||||||
|
#peertube-plugin-livechat-container {
|
||||||
converse-muc-message-form {
|
converse-muc-message-form {
|
||||||
// For an unknown reason, message field in truncated... so adding a bottom margin.
|
// For an unknown reason, message field in truncated... so adding a bottom margin.
|
||||||
margin-bottom: 6px;
|
margin-bottom: 6px;
|
||||||
|
@ -5,12 +5,10 @@ import type { AuthentInfos } from './auth'
|
|||||||
* Instanciate defaults params to use for ConverseJS.
|
* Instanciate defaults params to use for ConverseJS.
|
||||||
* Note: these parameters must be completed with one of the other function present in this module.
|
* Note: these parameters must be completed with one of the other function present in this module.
|
||||||
* @param param0 global parameters
|
* @param param0 global parameters
|
||||||
* @param isInIframe true if we are in iframe mode (inside Peertube, beside video)
|
|
||||||
* @returns default parameters to provide to ConverseJS.
|
* @returns default parameters to provide to ConverseJS.
|
||||||
*/
|
*/
|
||||||
function defaultConverseParams (
|
function defaultConverseParams (
|
||||||
{ forceReadonly, theme, assetsPath, room, forceDefaultHideMucParticipants }: InitConverseJSParams,
|
{ forceReadonly, theme, assetsPath, room, forceDefaultHideMucParticipants, autofocus }: InitConverseJSParams
|
||||||
isInIframe: boolean
|
|
||||||
): any {
|
): any {
|
||||||
const mucShowInfoMessages = forceReadonly
|
const mucShowInfoMessages = forceReadonly
|
||||||
? [
|
? [
|
||||||
@ -48,9 +46,8 @@ function defaultConverseParams (
|
|||||||
show_desktop_notifications: false,
|
show_desktop_notifications: false,
|
||||||
show_tab_notifications: false,
|
show_tab_notifications: false,
|
||||||
singleton: true,
|
singleton: true,
|
||||||
auto_focus: !isInIframe,
|
auto_focus: autofocus === true,
|
||||||
// forceDefaultHideMucParticipants is for testing purpose
|
hide_muc_participants: forceDefaultHideMucParticipants === true,
|
||||||
hide_muc_participants: isInIframe || forceDefaultHideMucParticipants === true,
|
|
||||||
play_sounds: false,
|
play_sounds: false,
|
||||||
muc_mention_autocomplete_min_chars: 2,
|
muc_mention_autocomplete_min_chars: 2,
|
||||||
muc_mention_autocomplete_filter: 'contains',
|
muc_mention_autocomplete_filter: 'contains',
|
||||||
|
@ -33,6 +33,7 @@ export const livechatSpecificsPlugin = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update other settings
|
// update other settings
|
||||||
|
params.blacklisted_plugins ??= []
|
||||||
for (const k of ['hide_muc_participants', 'blacklisted_plugins']) {
|
for (const k of ['hide_muc_participants', 'blacklisted_plugins']) {
|
||||||
_converse.api.settings.set(k, params[k])
|
_converse.api.settings.set(k, params[k])
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ interface InitConverseJSParams {
|
|||||||
theme: ConverseJSTheme
|
theme: ConverseJSTheme
|
||||||
transparent: boolean
|
transparent: boolean
|
||||||
forceDefaultHideMucParticipants?: boolean
|
forceDefaultHideMucParticipants?: boolean
|
||||||
|
autofocus?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
interface InitConverseJSParamsError {
|
interface InitConverseJSParamsError {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user