bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/settings/submenus/notification/component.jsx

265 lines
11 KiB
React
Raw Normal View History

2020-03-19 22:19:40 +08:00
import React from 'react';
2022-02-15 23:58:28 +08:00
import Toggle from '/imports/ui/components/common/switch/component';
2020-03-19 22:19:40 +08:00
import { defineMessages, injectIntl } from 'react-intl';
import BaseMenu from '../base/component';
import Styled from './styles';
2020-03-19 22:19:40 +08:00
const intlMessages = defineMessages({
notificationSectionTitle: {
id: 'app.submenu.notification.SectionTitle',
description: 'Notification section title',
},
notificationSectionDesc: {
id: 'app.submenu.notification.Desc',
description: 'provides extra info for notification section',
},
audioAlertLabel: {
id: 'app.submenu.notification.audioAlertLabel',
description: 'audio notification label',
},
pushAlertLabel: {
id: 'app.submenu.notification.pushAlertLabel',
description: 'push notification label',
2020-03-19 22:19:40 +08:00
},
messagesLabel: {
id: 'app.submenu.notification.messagesLabel',
description: 'label for chat messages',
},
userJoinLabel: {
id: 'app.submenu.notification.userJoinLabel',
description: 'label for chat messages',
},
2021-08-21 01:15:29 +08:00
userLeaveLabel: {
id: 'app.submenu.notification.userLeaveLabel',
description: 'label for user leave notifications',
},
guestWaitingLabel: {
id: 'app.submenu.notification.guestWaitingLabel',
description: 'label for guests waiting for approval',
},
2020-03-19 22:19:40 +08:00
raiseHandLabel: {
id: 'app.submenu.notification.raiseHandLabel',
description: 'label for raise hand emoji notifications',
},
});
class NotificationMenu extends BaseMenu {
constructor(props) {
super(props);
this.state = {
settingsName: 'notification',
settings: props.settings,
};
}
render() {
2021-05-01 03:06:28 +08:00
const {
intl,
isModerator,
showGuestNotification,
showToggleLabel,
displaySettingsStatus,
2024-06-14 21:30:48 +08:00
isChatEnabled,
2021-05-01 03:06:28 +08:00
} = this.props;
2020-03-19 22:19:40 +08:00
const { settings } = this.state;
return (
<div>
<div>
<Styled.Title>
2020-03-19 22:19:40 +08:00
{intl.formatMessage(intlMessages.notificationSectionTitle)}
</Styled.Title>
<Styled.SubTitle>
{intl.formatMessage(intlMessages.notificationSectionDesc)}
</Styled.SubTitle>
2020-03-19 22:19:40 +08:00
</div>
<Styled.Form>
<Styled.Row aria-hidden>
<Styled.Col />
<Styled.ColHeading>
2020-03-19 22:19:40 +08:00
{intl.formatMessage(intlMessages.audioAlertLabel)}
</Styled.ColHeading>
<Styled.ColHeading>
2020-03-19 22:19:40 +08:00
{intl.formatMessage(intlMessages.pushAlertLabel)}
</Styled.ColHeading>
</Styled.Row>
2020-03-19 22:19:40 +08:00
2024-06-14 21:30:48 +08:00
{isChatEnabled ? (
<Styled.Row>
<Styled.Col>
<Styled.Label aria-hidden>
2020-03-19 22:19:40 +08:00
{intl.formatMessage(intlMessages.messagesLabel)}
</Styled.Label>
</Styled.Col>
<Styled.Col>
<Styled.FormElementCenter>
2021-05-01 03:06:28 +08:00
{displaySettingsStatus(settings.chatAudioAlerts)}
2020-03-19 22:19:40 +08:00
<Toggle
icons={false}
defaultChecked={settings.chatAudioAlerts}
onChange={() => this.handleToggle('chatAudioAlerts')}
ariaLabel={`${intl.formatMessage(intlMessages.messagesLabel)} ${intl.formatMessage(intlMessages.audioAlertLabel)} - ${displaySettingsStatus(settings.chatAudioAlerts, true)}`}
2021-05-01 03:06:28 +08:00
showToggleLabel={showToggleLabel}
2020-03-19 22:19:40 +08:00
/>
</Styled.FormElementCenter>
</Styled.Col>
<Styled.Col>
<Styled.FormElementCenter>
2021-05-01 03:06:28 +08:00
{displaySettingsStatus(settings.chatPushAlerts)}
2020-03-19 22:19:40 +08:00
<Toggle
icons={false}
defaultChecked={settings.chatPushAlerts}
onChange={() => this.handleToggle('chatPushAlerts')}
ariaLabel={`${intl.formatMessage(intlMessages.messagesLabel)} ${intl.formatMessage(intlMessages.pushAlertLabel)} - ${displaySettingsStatus(settings.chatPushAlerts, true)}`}
2021-05-01 03:06:28 +08:00
showToggleLabel={showToggleLabel}
2022-01-20 21:03:18 +08:00
data-test="chatPopupAlertsBtn"
2020-03-19 22:19:40 +08:00
/>
</Styled.FormElementCenter>
</Styled.Col>
</Styled.Row>
) : null}
2020-03-19 22:19:40 +08:00
<Styled.Row>
<Styled.Col>
<Styled.Label aria-hidden>
2020-03-19 22:19:40 +08:00
{intl.formatMessage(intlMessages.userJoinLabel)}
</Styled.Label>
</Styled.Col>
<Styled.Col>
<Styled.FormElementCenter>
2021-05-01 03:06:28 +08:00
{displaySettingsStatus(settings.userJoinAudioAlerts)}
2020-03-19 22:19:40 +08:00
<Toggle
icons={false}
defaultChecked={settings.userJoinAudioAlerts}
onChange={() => this.handleToggle('userJoinAudioAlerts')}
ariaLabel={`${intl.formatMessage(intlMessages.userJoinLabel)} ${intl.formatMessage(intlMessages.audioAlertLabel)} - ${displaySettingsStatus(settings.userJoinAudioAlerts, true)}`}
2021-05-01 03:06:28 +08:00
showToggleLabel={showToggleLabel}
2020-03-19 22:19:40 +08:00
/>
</Styled.FormElementCenter>
</Styled.Col>
<Styled.Col>
<Styled.FormElementCenter>
2021-05-01 03:06:28 +08:00
{displaySettingsStatus(settings.userJoinPushAlerts)}
2020-03-19 22:19:40 +08:00
<Toggle
icons={false}
defaultChecked={settings.userJoinPushAlerts}
onChange={() => this.handleToggle('userJoinPushAlerts')}
ariaLabel={`${intl.formatMessage(intlMessages.userJoinLabel)} ${intl.formatMessage(intlMessages.pushAlertLabel)} - ${displaySettingsStatus(settings.userJoinPushAlerts, true)}`}
2021-05-01 03:06:28 +08:00
showToggleLabel={showToggleLabel}
2022-01-20 21:03:18 +08:00
data-test="userJoinPopupAlerts"
2020-03-19 22:19:40 +08:00
/>
</Styled.FormElementCenter>
</Styled.Col>
</Styled.Row>
2020-03-19 22:19:40 +08:00
<Styled.Row>
<Styled.Col>
<Styled.Label aria-hidden>
2021-08-21 01:15:29 +08:00
{intl.formatMessage(intlMessages.userLeaveLabel)}
</Styled.Label>
</Styled.Col>
<Styled.Col>
<Styled.FormElementCenter>
2021-08-21 01:15:29 +08:00
{displaySettingsStatus(settings.userLeaveAudioAlerts)}
<Toggle
icons={false}
defaultChecked={settings.userLeaveAudioAlerts}
onChange={() => this.handleToggle('userLeaveAudioAlerts')}
ariaLabel={`${intl.formatMessage(intlMessages.userLeaveLabel)} ${intl.formatMessage(intlMessages.audioAlertLabel)} - ${displaySettingsStatus(settings.userLeaveAudioAlerts, true)}`}
2021-08-21 01:15:29 +08:00
showToggleLabel={showToggleLabel}
/>
</Styled.FormElementCenter>
</Styled.Col>
<Styled.Col>
<Styled.FormElementCenter>
2021-08-21 01:15:29 +08:00
{displaySettingsStatus(settings.userLeavePushAlerts)}
<Toggle
icons={false}
defaultChecked={settings.userLeavePushAlerts}
onChange={() => this.handleToggle('userLeavePushAlerts')}
ariaLabel={`${intl.formatMessage(intlMessages.userLeaveLabel)} ${intl.formatMessage(intlMessages.pushAlertLabel)} - ${displaySettingsStatus(settings.userLeavePushAlerts, true)}`}
2021-08-21 01:15:29 +08:00
showToggleLabel={showToggleLabel}
/>
</Styled.FormElementCenter>
</Styled.Col>
</Styled.Row>
2021-08-21 01:15:29 +08:00
{isModerator && showGuestNotification ? (
<Styled.Row>
<Styled.Col>
<Styled.Label aria-hidden>
{intl.formatMessage(intlMessages.guestWaitingLabel)}
</Styled.Label>
</Styled.Col>
<Styled.Col>
<Styled.FormElementCenter>
2021-05-01 03:06:28 +08:00
{displaySettingsStatus(settings.guestWaitingAudioAlerts)}
<Toggle
icons={false}
defaultChecked={settings.guestWaitingAudioAlerts}
onChange={() => this.handleToggle('guestWaitingAudioAlerts')}
ariaLabel={`${intl.formatMessage(intlMessages.guestWaitingLabel)} ${intl.formatMessage(intlMessages.audioAlertLabel)} - ${displaySettingsStatus(settings.guestWaitingAudioAlerts, true)}`}
2021-05-01 03:06:28 +08:00
showToggleLabel={showToggleLabel}
/>
</Styled.FormElementCenter>
</Styled.Col>
<Styled.Col>
<Styled.FormElementCenter>
2021-05-01 03:06:28 +08:00
{displaySettingsStatus(settings.guestWaitingPushAlerts)}
<Toggle
icons={false}
defaultChecked={settings.guestWaitingPushAlerts}
onChange={() => this.handleToggle('guestWaitingPushAlerts')}
ariaLabel={`${intl.formatMessage(intlMessages.guestWaitingLabel)} ${intl.formatMessage(intlMessages.pushAlertLabel)} - ${displaySettingsStatus(settings.guestWaitingPushAlerts, true)}`}
2021-05-01 03:06:28 +08:00
showToggleLabel={showToggleLabel}
/>
</Styled.FormElementCenter>
</Styled.Col>
</Styled.Row>
) : null}
{isModerator ? (
<Styled.Row>
<Styled.Col>
<Styled.Label aria-hidden>
{intl.formatMessage(intlMessages.raiseHandLabel)}
</Styled.Label>
</Styled.Col>
<Styled.Col>
<Styled.FormElementCenter>
2021-05-01 03:06:28 +08:00
{displaySettingsStatus(settings.raiseHandAudioAlerts)}
<Toggle
icons={false}
defaultChecked={settings.raiseHandAudioAlerts}
onChange={() => this.handleToggle('raiseHandAudioAlerts')}
ariaLabel={`${intl.formatMessage(intlMessages.raiseHandLabel)} ${intl.formatMessage(intlMessages.audioAlertLabel)} - ${displaySettingsStatus(settings.raiseHandAudioAlerts, true)}`}
2021-05-01 03:06:28 +08:00
showToggleLabel={showToggleLabel}
/>
</Styled.FormElementCenter>
</Styled.Col>
<Styled.Col>
<Styled.FormElementCenter>
2021-05-01 03:06:28 +08:00
{displaySettingsStatus(settings.raiseHandPushAlerts)}
<Toggle
icons={false}
defaultChecked={settings.raiseHandPushAlerts}
onChange={() => this.handleToggle('raiseHandPushAlerts')}
ariaLabel={`${intl.formatMessage(intlMessages.raiseHandLabel)} ${intl.formatMessage(intlMessages.pushAlertLabel)} - ${displaySettingsStatus(settings.raiseHandPushAlerts, true)}`}
2021-05-01 03:06:28 +08:00
showToggleLabel={showToggleLabel}
/>
</Styled.FormElementCenter>
</Styled.Col>
</Styled.Row>
) : null}
2020-03-19 22:19:40 +08:00
</Styled.Form>
2020-03-19 22:19:40 +08:00
</div>
);
}
}
export default injectIntl(NotificationMenu);