4d6f4b3ded
* Refactor: Make bundle using webpack * Fix: restore after install codes and a few settings * Fix: build script folder permission * Refactor: Remove support to async import on audio bridges * Upgrade npm using nvm * Avoid questions on npm ci execution * Let npm ci install dev dependencies (as we need the build tools here) * Fix: enconding * Fix: old lock files * Remove: bbb-config dependency to bbb-html5 service, bbb-html5 isn't a service anymore * Fix: TS errors * Fix: eslint * Fix: chat styles * npm install with "lockfileVersion": 3 (newer npm) * build: allow nodejs 22 * node 22; drop meteor from CI and bbb-conf * TEMP: use bbb-install without mongo but with node 22 and newer image * build: relax nodejs condition to not trip 22.6 * build: ensure dir /usr/share/bigbluebutton/nginx exists * init sites-available/bbb; drop disable-transparent- * nginx complaining of missing file and ; * TMP: print status of services * WIP: tweak nginx location to debug * Fix: webcam widgets alignments * akka-apps -- update location of settings.yml * build: add locales path for nginx * docs and config changes for removal of meteor * Fix: build encoding and locales enpoint folder path * build: set wss url for media * Add: Enable minimizer and modify to Terser * Fix: TS errors --------- Co-authored-by: Tiago Jacobs <tiago.jacobs@gmail.com> Co-authored-by: Anton Georgiev <anto.georgiev@gmail.com> Co-authored-by: Anton Georgiev <antobinary@users.noreply.github.com>
115 lines
3.3 KiB
TypeScript
115 lines
3.3 KiB
TypeScript
import React, { Component } from 'react';
|
|
import { IntlShape, defineMessages, injectIntl } from 'react-intl';
|
|
import { notify } from '/imports/ui/services/notification';
|
|
import { toast } from 'react-toastify';
|
|
import Styled from './styles';
|
|
|
|
const intlMessages = defineMessages({
|
|
suggestLockTitle: {
|
|
id: 'app.video.suggestWebcamLock',
|
|
description: 'Label for notification title',
|
|
},
|
|
suggestLockReason: {
|
|
id: 'app.video.suggestWebcamLockReason',
|
|
description: 'Reason for activate the webcams\'s lock',
|
|
},
|
|
enable: {
|
|
id: 'app.video.enable',
|
|
description: 'Enable button label',
|
|
},
|
|
cancel: {
|
|
id: 'app.video.cancel',
|
|
description: 'Cancel button label',
|
|
},
|
|
});
|
|
|
|
const REPEAT_INTERVAL = 120000;
|
|
|
|
interface LockViewersNotifyComponentProps {
|
|
toggleWebcamsOnlyForModerator: () => void;
|
|
currentUserIsModerator: boolean;
|
|
viewersInWebcam: number;
|
|
limitOfViewersInWebcam: number;
|
|
limitOfViewersInWebcamIsEnable: boolean;
|
|
lockSettingsDisableCam: boolean;
|
|
webcamOnlyForModerator: boolean;
|
|
intl: IntlShape;
|
|
}
|
|
|
|
class LockViewersNotifyComponent extends Component<LockViewersNotifyComponentProps, object> {
|
|
private interval: ReturnType<typeof setInterval> | null;
|
|
|
|
constructor(props: LockViewersNotifyComponentProps) {
|
|
super(props);
|
|
this.interval = null;
|
|
this.intervalCallback = this.intervalCallback.bind(this);
|
|
}
|
|
|
|
componentDidUpdate() {
|
|
const {
|
|
viewersInWebcam,
|
|
lockSettingsDisableCam,
|
|
limitOfViewersInWebcam,
|
|
webcamOnlyForModerator,
|
|
currentUserIsModerator,
|
|
limitOfViewersInWebcamIsEnable,
|
|
} = this.props;
|
|
const viwerersInWebcamGreaterThatLimit = (viewersInWebcam >= limitOfViewersInWebcam)
|
|
&& limitOfViewersInWebcamIsEnable;
|
|
const webcamForViewersIsLocked = lockSettingsDisableCam || webcamOnlyForModerator;
|
|
|
|
if (viwerersInWebcamGreaterThatLimit
|
|
&& !webcamForViewersIsLocked
|
|
&& currentUserIsModerator
|
|
&& !this.interval) {
|
|
this.interval = setInterval(this.intervalCallback, REPEAT_INTERVAL);
|
|
this.intervalCallback();
|
|
}
|
|
if (webcamForViewersIsLocked || (!viwerersInWebcamGreaterThatLimit && this.interval)) {
|
|
if (this.interval) clearInterval(this.interval);
|
|
this.interval = null;
|
|
}
|
|
}
|
|
|
|
intervalCallback() {
|
|
const {
|
|
toggleWebcamsOnlyForModerator,
|
|
intl,
|
|
} = this.props;
|
|
const lockToastId = `suggestLock-${new Date().getTime()}`;
|
|
|
|
notify(
|
|
(
|
|
<>
|
|
<Styled.Info>{intl.formatMessage(intlMessages.suggestLockTitle)}</Styled.Info>
|
|
<Styled.ButtonWrapper>
|
|
<Styled.ManyUsersButton
|
|
label={intl.formatMessage(intlMessages.enable)}
|
|
aria-label={intl.formatMessage(intlMessages.enable)}
|
|
onClick={toggleWebcamsOnlyForModerator}
|
|
/>
|
|
|
|
|
<Styled.ManyUsersButton
|
|
label={intl.formatMessage(intlMessages.cancel)}
|
|
aria-label={intl.formatMessage(intlMessages.cancel)}
|
|
onClick={() => toast.dismiss(lockToastId)}
|
|
/>
|
|
</Styled.ButtonWrapper>
|
|
<Styled.Info>{intl.formatMessage(intlMessages.suggestLockReason)}</Styled.Info>
|
|
</>
|
|
),
|
|
'info',
|
|
'rooms',
|
|
{
|
|
toastId: lockToastId,
|
|
},
|
|
);
|
|
}
|
|
|
|
render() {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
export default injectIntl(LockViewersNotifyComponent);
|