From 4022d4a0f6421b1327486f92bd4ce24c5750dc4f Mon Sep 17 00:00:00 2001 From: Tainan Felipe Date: Wed, 30 Nov 2022 17:47:49 +0100 Subject: [PATCH] add delay for shared note true unmount --- .../imports/ui/components/notes/component.jsx | 26 +++++++++++++++---- .../components/sidebar-content/component.jsx | 4 +-- .../components/sidebar-content/container.jsx | 2 -- .../private/config/settings.yml | 1 + 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/bigbluebutton-html5/imports/ui/components/notes/component.jsx b/bigbluebutton-html5/imports/ui/components/notes/component.jsx index 566100d17c..e6f6d5a92f 100644 --- a/bigbluebutton-html5/imports/ui/components/notes/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/notes/component.jsx @@ -1,4 +1,4 @@ -import React, { useEffect } from 'react'; +import React, { useEffect, useState } from 'react'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl } from 'react-intl'; import injectWbResizeEvent from '/imports/ui/components/presentation/resize-wrapper/component'; @@ -12,7 +12,8 @@ import NotesDropdown from '/imports/ui/components/notes/notes-dropdown/container const CHAT_CONFIG = Meteor.settings.public.chat; const PUBLIC_CHAT_ID = CHAT_CONFIG.public_id; - +const DELAY_UNMOUNT_SHARED_NOTES = Meteor.settings.public.app.delayForUnmountOfSharedNote; +console.log(DELAY_UNMOUNT_SHARED_NOTES); const intlMessages = defineMessages({ hide: { id: 'app.notes.hide', @@ -47,6 +48,8 @@ const defaultProps = { layoutType: null, }; +let timoutRef = null; + const Notes = ({ hasPermission, intl, @@ -58,18 +61,31 @@ const Notes = ({ sidebarContent, sharedNotesOutput, amIPresenter, + isToSharedNotesBeShow, }) => { useEffect(() => () => Service.setLastRev(), []); + const [shouldRenderNotes, setShouldRenderNotes] = useState(false); const { isChrome } = browserInfo; const isOnMediaArea = area === 'media'; const style = isOnMediaArea ? { position: 'absolute', ...sharedNotesOutput, } : {}; - const isHidden = isOnMediaArea && (style.width === 0 || style.height === 0); + const isHidden = (isOnMediaArea && (style.width === 0 || style.height === 0)) + || !isToSharedNotesBeShow; if (isHidden) style.padding = 0; - + console.log(); + useEffect(() => { + if (isToSharedNotesBeShow) { + setShouldRenderNotes(true); + clearTimeout(timoutRef); + } else { + timoutRef = setTimeout(() => { + setShouldRenderNotes(false); + }, DELAY_UNMOUNT_SHARED_NOTES); + } + }, [isToSharedNotesBeShow]); useEffect(() => { if ( isOnMediaArea @@ -128,7 +144,7 @@ const Notes = ({ ) : null; }; - return ( + return shouldRenderNotes && ( {!isOnMediaArea ? (
{ - + )} - {sidebarContentPanel === PANELS.SHARED_NOTES && } + {sidebarContentPanel === PANELS.CAPTIONS && } {sidebarContentPanel === PANELS.BREAKOUT && } {sidebarContentPanel === PANELS.WAITING_USERS && } diff --git a/bigbluebutton-html5/imports/ui/components/sidebar-content/container.jsx b/bigbluebutton-html5/imports/ui/components/sidebar-content/container.jsx index c2dd53a70d..f567749b7c 100644 --- a/bigbluebutton-html5/imports/ui/components/sidebar-content/container.jsx +++ b/bigbluebutton-html5/imports/ui/components/sidebar-content/container.jsx @@ -13,8 +13,6 @@ const SidebarContentContainer = () => { const { users } = usingUsersContext; const amIPresenter = users[Auth.meetingID][Auth.userID].presenter; - if (sidebarContentOutput.display === false) return null; - return (