Skip to content

Commit

Permalink
fix: error showing for state update
Browse files Browse the repository at this point in the history
  • Loading branch information
jibon57 committed Sep 28, 2023
1 parent 0a45b18 commit 122511e
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions src/components/main-area/mainComponents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ const activateSpeechServiceSelector = createSelector(
(is_enabled) => is_enabled,
);

const isActiveSharedNotepadSelector = createSelector(
(state: RootState) =>
state.session.currentRoom.metadata?.room_features.shared_note_pad_features
.is_active,
(is_active) => is_active,
);

const MainComponents = ({
currentConnection,
isActiveWhiteboard,
Expand All @@ -52,6 +59,7 @@ const MainComponents = ({

const activateWebcamsView = useAppSelector(activateWebcamsViewSelector);
const activateSpeechService = useAppSelector(activateSpeechServiceSelector);
const isActiveSharedNotepad = useAppSelector(isActiveSharedNotepadSelector);

const [showVerticalVideoView, setShowVerticalVideoView] =
useState<boolean>(false);
Expand Down Expand Up @@ -134,8 +142,10 @@ const MainComponents = ({
classNames = 'hidden';
} else if (isActiveExternalMediaPlayer) {
if (!isRecorder) {
dispatch(updateIsActiveChatPanel(false));
dispatch(updateIsActiveParticipantsPanel(false));
setTimeout(() => {
dispatch(updateIsActiveChatPanel(false));
dispatch(updateIsActiveParticipantsPanel(false));
}, 200);
}
classNames =
'Div-external-media-player w-full flex items-center justify-center';
Expand Down Expand Up @@ -164,8 +174,10 @@ const MainComponents = ({
classNames = 'hidden';
} else if (isActiveDisplayExternalLink) {
if (!isRecorder) {
dispatch(updateIsActiveChatPanel(false));
dispatch(updateIsActiveParticipantsPanel(false));
setTimeout(() => {
dispatch(updateIsActiveChatPanel(false));
dispatch(updateIsActiveParticipantsPanel(false));
}, 200);
}
classNames = 'w-full';
}
Expand All @@ -184,6 +196,14 @@ const MainComponents = ({
isActiveDisplayExternalLink,
]);

// this will help to reset position, if something went wrong
const sharedNotepadElm = useMemo(() => {
if (isActiveSharedNotepad) {
return <SharedNotepadElement />;
}
return null;
}, [isActiveSharedNotepad]);

const cssClasses = useMemo(() => {
const cssClasses: Array<string> = [];
if (isActiveScreenSharingView && isActiveScreenShare) {
Expand Down Expand Up @@ -215,7 +235,7 @@ const MainComponents = ({
return (
<>
<div className={cssClasses}>
<SharedNotepadElement />
{sharedNotepadElm}
{activateWebcamsView ? (
<VideosComponent
currentConnection={currentConnection}
Expand Down

0 comments on commit 122511e

Please sign in to comment.