From d33544ef1ec437e8ae085556229132519ac253d8 Mon Sep 17 00:00:00 2001 From: Anton B Date: Mon, 22 Jan 2024 16:10:47 -0300 Subject: [PATCH] fix: use service file for meteor data consumption, useRef instead of let variable, add error log --- .../component.tsx | 27 +++++++++---------- .../meeting-remaining-time-graphql/service.ts | 7 +++++ 2 files changed, 20 insertions(+), 14 deletions(-) create mode 100644 bigbluebutton-html5/imports/ui/components/common/meeting-remaining-time-graphql/service.ts diff --git a/bigbluebutton-html5/imports/ui/components/common/meeting-remaining-time-graphql/component.tsx b/bigbluebutton-html5/imports/ui/components/common/meeting-remaining-time-graphql/component.tsx index 32b21d4188..8e6b8e39d3 100644 --- a/bigbluebutton-html5/imports/ui/components/common/meeting-remaining-time-graphql/component.tsx +++ b/bigbluebutton-html5/imports/ui/components/common/meeting-remaining-time-graphql/component.tsx @@ -1,7 +1,7 @@ import React, { useEffect, useState } from 'react'; import { defineMessages, useIntl } from 'react-intl'; import humanizeSeconds from '/imports/utils/humanizeSeconds'; -import BreakoutService from '/imports/ui/components/breakout-room/service'; +import { setCapturedContentUploading } from './service'; import { Text, Time } from './styles'; import useMeeting from '/imports/ui/core/hooks/useMeeting'; import { useSubscription } from '@apollo/client'; @@ -9,6 +9,7 @@ import { FIRST_BREAKOUT_DURATION_DATA_SUBSCRIPTION, breakoutDataResponse } from import { notify } from '/imports/ui/services/notification'; import { Meteor } from 'meteor/meteor'; import useTimeSync from '/imports/ui/core/local-states/useTimeSync'; +import logger from '/imports/startup/client/logger'; const intlMessages = defineMessages({ breakoutTimeRemaining: { @@ -51,12 +52,9 @@ interface MeetingRemainingTimeContainerProps { displayAlerts: boolean; } -interface MeetingRemainingTimeProps { +interface MeetingRemainingTimeProps extends MeetingRemainingTimeContainerProps { durationInSeconds: number; referenceStartedTime: number; - isBreakoutDuration: boolean; - fromBreakoutPanel: boolean | false; - displayAlerts: boolean; isBreakout: boolean | false; } @@ -110,8 +108,8 @@ const MeetingRemainingTime: React.FC = (props) => { }; }, [remainingTime, durationInSeconds]); - let meetingTimeMessage: string = ''; - let boldText: boolean = false; + const meetingTimeMessage = React.useRef(''); + const boldText = React.useRef(false); if (remainingTime >= 0 && timeRemainingInterval) { if (remainingTime > 0) { @@ -142,21 +140,21 @@ const MeetingRemainingTime: React.FC = (props) => { ); } - if (fromBreakoutPanel) boldText = true; - meetingTimeMessage = intl.formatMessage(fromBreakoutPanel || isBreakoutDuration + if (fromBreakoutPanel) boldText.current = true; + meetingTimeMessage.current = intl.formatMessage(fromBreakoutPanel || isBreakoutDuration ? intlMessages.breakoutDuration : intlMessages.meetingTimeRemaining, { 0: humanizeSeconds(remainingTime) }); } else { clearInterval(timeRemainingInterval.current); - BreakoutService.setCapturedContentUploading(); - meetingTimeMessage = intl.formatMessage(isBreakoutDuration + setCapturedContentUploading(); + meetingTimeMessage.current = intl.formatMessage(isBreakoutDuration ? intlMessages.breakoutWillClose : intlMessages.meetingWillClose); } } - if (boldText) { - const words = meetingTimeMessage.split(' '); + if (boldText.current) { + const words = meetingTimeMessage.current.split(' '); const time = words.pop(); const text = words.join(' '); @@ -171,7 +169,7 @@ const MeetingRemainingTime: React.FC = (props) => { return ( - {meetingTimeMessage} + {meetingTimeMessage.current} ); }; @@ -200,6 +198,7 @@ const MeetingRemainingTimeContainer: React.FC Error: diff --git a/bigbluebutton-html5/imports/ui/components/common/meeting-remaining-time-graphql/service.ts b/bigbluebutton-html5/imports/ui/components/common/meeting-remaining-time-graphql/service.ts new file mode 100644 index 0000000000..bb63556602 --- /dev/null +++ b/bigbluebutton-html5/imports/ui/components/common/meeting-remaining-time-graphql/service.ts @@ -0,0 +1,7 @@ +import BreakoutService from '/imports/ui/components/breakout-room/service'; + +export const setCapturedContentUploading = () => BreakoutService.setCapturedContentUploading(); + +export default { + setCapturedContentUploading, +};