Merge pull request #16719 from danielpetri1/closing-toast

fix: Duration toast refers to main meeting as 'Breakout'
This commit is contained in:
Anton Georgiev 2023-02-23 09:50:05 -05:00 committed by GitHub
commit 48b242fb51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 31 additions and 25 deletions

View File

@ -1,11 +0,0 @@
import React from 'react';
const BreakoutRemainingTime = props => (
<span data-test="timeRemaining">
{props.children}
</span>
);
export default BreakoutRemainingTime;

View File

@ -5,7 +5,7 @@ import { Session } from 'meteor/session';
import logger from '/imports/startup/client/logger';
import Styled from './styles';
import Service from './service';
import BreakoutRoomContainer from './breakout-remaining-time/container';
import MeetingRemainingTime from '../notifications-bar/meeting-remaining-time/container';
import MessageFormContainer from './message-form/container';
import VideoService from '/imports/ui/components/video-provider/service';
import { PANELS, ACTIONS } from '../layout/enums';
@ -495,7 +495,7 @@ class BreakoutRoom extends PureComponent {
ref={(ref) => this.durationContainerRef = ref}
>
<Styled.Duration>
<BreakoutRoomContainer
<MeetingRemainingTime
messageDuration={intlMessages.breakoutDuration}
breakoutRoom={breakoutRooms[0]}
fromBreakoutPanel

View File

@ -6,7 +6,7 @@ import _ from 'lodash';
import Auth from '/imports/ui/services/auth';
import { MeetingTimeRemaining } from '/imports/api/meetings';
import Meetings from '/imports/api/meetings';
import BreakoutRemainingTime from '/imports/ui/components/breakout-room/breakout-remaining-time/container';
import MeetingRemainingTime from './meeting-remaining-time/container';
import Styled from './styles';
import { layoutSelectInput, layoutDispatch } from '../layout/context';
import { ACTIONS } from '../layout/enums';
@ -176,7 +176,7 @@ export default injectIntl(withTracker(({ intl }) => {
if (currentBreakout) {
data.message = (
<BreakoutRemainingTime
<MeetingRemainingTime
breakoutRoom={currentBreakout}
messageDuration={intlMessages.breakoutTimeRemaining}
timeEndedMessage={intlMessages.breakoutWillClose}
@ -197,7 +197,7 @@ export default injectIntl(withTracker(({ intl }) => {
if (underThirtyMin && !isBreakout) {
data.message = (
<BreakoutRemainingTime
<MeetingRemainingTime
breakoutRoom={meetingTimeRemaining}
messageDuration={intlMessages.meetingTimeRemaining}
timeEndedMessage={intlMessages.meetingWillClose}

View File

@ -0,0 +1,9 @@
import React from 'react';
const MeetingRemainingTime = (props) => (
<span data-test="timeRemaining">
{ props.children }
</span>
);
export default MeetingRemainingTime;

View File

@ -4,9 +4,10 @@ import { defineMessages, injectIntl } from 'react-intl';
import injectNotify from '/imports/ui/components/common/toast/inject-notify/component';
import humanizeSeconds from '/imports/utils/humanizeSeconds';
import _ from 'lodash';
import BreakoutRemainingTimeComponent from './component';
import MeetingRemainingTimeComponent from './component';
import BreakoutService from '/imports/ui/components/breakout-room/service';
import { Text, Time } from './styles';
import { meetingIsBreakout } from '/imports/ui/components/app/service';
const intlMessages = defineMessages({
failedMessage: {
@ -37,6 +38,10 @@ const intlMessages = defineMessages({
id: 'app.meeting.alertBreakoutEndsUnderMinutes',
description: 'Alert that tells that the breakout ends under x minutes',
},
alertMeetingEndsUnderMinutes: {
id: 'app.meeting.alertMeetingEndsUnderMinutes',
description: 'Alert that tells that the meeting ends under x minutes',
},
});
let timeRemaining = 0;
@ -66,17 +71,17 @@ class breakoutRemainingTimeContainer extends React.Component {
const time = words.pop();
const text = words.join(' ');
return (
<BreakoutRemainingTimeComponent>
<MeetingRemainingTimeComponent>
<Text>{text}</Text>
<br />
<Time data-test="breakoutRemainingTime">{time}</Time>
</BreakoutRemainingTimeComponent>
</MeetingRemainingTimeComponent>
);
}
return (
<BreakoutRemainingTimeComponent>
<MeetingRemainingTimeComponent>
{message}
</BreakoutRemainingTimeComponent>
</MeetingRemainingTimeComponent>
);
}
}
@ -137,8 +142,11 @@ export default injectNotify(injectIntl(withTracker(({
if (alertsInSeconds.includes(time) && time !== lastAlertTime && displayAlerts) {
const timeInMinutes = time / 60;
const msg = { id: `${intlMessages.alertBreakoutEndsUnderMinutes.id}${timeInMinutes === 1 ? 'Singular' : 'Plural'}` };
const alertMessage = intl.formatMessage(msg, { 0: timeInMinutes })
const message = meetingIsBreakout()
? intlMessages.alertBreakoutEndsUnderMinutes
: intlMessages.alertMeetingEndsUnderMinutes;
const msg = { id: `${message.id}${timeInMinutes === 1 ? 'Singular' : 'Plural'}` };
const alertMessage = intl.formatMessage(msg, { 0: timeInMinutes });
lastAlertTime = time;
notify(alertMessage, 'info', 'rooms');

View File

@ -4,7 +4,7 @@ import { defineMessages, injectIntl } from 'react-intl';
import Icon from '/imports/ui/components/common/icon/component';
import Styled from './styles';
import { ACTIONS, PANELS } from '../../../layout/enums';
import BreakoutRemainingTime from '/imports/ui/components/breakout-room/breakout-remaining-time/container';
import MeetingRemainingTime from '../../../notifications-bar/meeting-remaining-time/container';
const intlMessages = defineMessages({
breakoutTitle: {
@ -66,7 +66,7 @@ const BreakoutRoomItem = ({
{intl.formatMessage(intlMessages.breakoutTitle)}
</Styled.BreakoutTitle>
<Styled.BreakoutDuration>
<BreakoutRemainingTime
<MeetingRemainingTime
messageDuration={intlMessages.breakoutTimeRemaining}
breakoutRoom={breakoutRoom}
/>