add delay for shared note true unmount

This commit is contained in:
Tainan Felipe 2022-11-30 17:47:49 +01:00
parent 4a713f433a
commit 4022d4a0f6
4 changed files with 24 additions and 9 deletions

View File

@ -1,4 +1,4 @@
import React, { useEffect } from 'react'; import React, { useEffect, useState } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { defineMessages, injectIntl } from 'react-intl'; import { defineMessages, injectIntl } from 'react-intl';
import injectWbResizeEvent from '/imports/ui/components/presentation/resize-wrapper/component'; 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 CHAT_CONFIG = Meteor.settings.public.chat;
const PUBLIC_CHAT_ID = CHAT_CONFIG.public_id; 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({ const intlMessages = defineMessages({
hide: { hide: {
id: 'app.notes.hide', id: 'app.notes.hide',
@ -47,6 +48,8 @@ const defaultProps = {
layoutType: null, layoutType: null,
}; };
let timoutRef = null;
const Notes = ({ const Notes = ({
hasPermission, hasPermission,
intl, intl,
@ -58,18 +61,31 @@ const Notes = ({
sidebarContent, sidebarContent,
sharedNotesOutput, sharedNotesOutput,
amIPresenter, amIPresenter,
isToSharedNotesBeShow,
}) => { }) => {
useEffect(() => () => Service.setLastRev(), []); useEffect(() => () => Service.setLastRev(), []);
const [shouldRenderNotes, setShouldRenderNotes] = useState(false);
const { isChrome } = browserInfo; const { isChrome } = browserInfo;
const isOnMediaArea = area === 'media'; const isOnMediaArea = area === 'media';
const style = isOnMediaArea ? { const style = isOnMediaArea ? {
position: 'absolute', position: 'absolute',
...sharedNotesOutput, ...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; 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(() => { useEffect(() => {
if ( if (
isOnMediaArea isOnMediaArea
@ -128,7 +144,7 @@ const Notes = ({
) : null; ) : null;
}; };
return ( return shouldRenderNotes && (
<Styled.Notes data-test="notes" isChrome={isChrome} style={style}> <Styled.Notes data-test="notes" isChrome={isChrome} style={style}>
{!isOnMediaArea ? ( {!isOnMediaArea ? (
<Header <Header

View File

@ -134,10 +134,10 @@ const SidebarContent = (props) => {
<ErrorBoundary <ErrorBoundary
Fallback={FallbackView} Fallback={FallbackView}
> >
<ChatContainer width={width}/> <ChatContainer width={width} />
</ErrorBoundary> </ErrorBoundary>
)} )}
{sidebarContentPanel === PANELS.SHARED_NOTES && <NotesContainer />} <NotesContainer isToSharedNotesBeShow={sidebarContentPanel === PANELS.SHARED_NOTES} />
{sidebarContentPanel === PANELS.CAPTIONS && <CaptionsContainer />} {sidebarContentPanel === PANELS.CAPTIONS && <CaptionsContainer />}
{sidebarContentPanel === PANELS.BREAKOUT && <BreakoutRoomContainer />} {sidebarContentPanel === PANELS.BREAKOUT && <BreakoutRoomContainer />}
{sidebarContentPanel === PANELS.WAITING_USERS && <WaitingUsersPanel />} {sidebarContentPanel === PANELS.WAITING_USERS && <WaitingUsersPanel />}

View File

@ -13,8 +13,6 @@ const SidebarContentContainer = () => {
const { users } = usingUsersContext; const { users } = usingUsersContext;
const amIPresenter = users[Auth.meetingID][Auth.userID].presenter; const amIPresenter = users[Auth.meetingID][Auth.userID].presenter;
if (sidebarContentOutput.display === false) return null;
return ( return (
<SidebarContent <SidebarContent
{...sidebarContentOutput} {...sidebarContentOutput}

View File

@ -33,6 +33,7 @@ public:
copyright: '©2023 BigBlueButton Inc.' copyright: '©2023 BigBlueButton Inc.'
html5ClientBuild: HTML5_CLIENT_VERSION html5ClientBuild: HTML5_CLIENT_VERSION
helpLink: https://bigbluebutton.org/html5/ helpLink: https://bigbluebutton.org/html5/
delayForUnmountOfSharedNote: 120000
bbbTabletApp: bbbTabletApp:
enabled: false enabled: false
iosAppStoreUrl: 'https://apps.apple.com/us/app/bigbluebutton-tablet/id1641156756' iosAppStoreUrl: 'https://apps.apple.com/us/app/bigbluebutton-tablet/id1641156756'