Skip to content

Commit

Permalink
[IMPROVE] VideoConf Miss Config Modal (#27153)
Browse files Browse the repository at this point in the history
Co-authored-by: Guilherme Gazzo <guilhermegazzo@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Nov 22, 2022
1 parent 59724b0 commit fd086f6
Show file tree
Hide file tree
Showing 4 changed files with 241 additions and 68 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import { Modal, Button, Box, Callout, Margins } from '@rocket.chat/fuselage';
import { useTranslation } from '@rocket.chat/ui-contexts';
import React, { ReactElement } from 'react';

type VideoConfConfigModalProps = {
onClose: () => void;
onConfirm?: () => void;
isAdmin: boolean;
};

const VideoConfConfigModal = ({ onClose, onConfirm, isAdmin }: VideoConfConfigModalProps): ReactElement => {
const t = useTranslation();

return (
<Modal>
<Modal.Header>
<Modal.HeaderText>
<Modal.Tagline>{isAdmin ? t('Missing_configuration') : t('App_not_enabled')}</Modal.Tagline>
<Modal.Title>{isAdmin ? t('Configure_video_conference') : t('Video_Conference')}</Modal.Title>
</Modal.HeaderText>
<Modal.Close title={t('Close')} onClick={onClose} />
</Modal.Header>
<Modal.Content>
<Modal.HeroImage maxHeight='initial' src='/images/conf-call-config.svg' />
<Box fontScale='h3'>{t('Enterprise_capabilities')}</Box>
<Box withRichContent>
<Box is='ul' pis='x24'>
<li>{t('Ringtones_and_visual_indicators_notify_people_of_incoming_calls')}</li>
<li>{t('Call_history_provides_a_record_of_when_calls_took_place_and_who_joined')}</li>
</Box>
</Box>
<Box fontScale='h3'>{t('Conference_call_apps')}</Box>
<Margins blockStart='x12'>
<Callout icon='team' title={isAdmin ? t('Jitsi_included_with_Community') : 'Jitsi'}>
{t('Open-source_conference_call_solution')}
</Callout>
<Callout icon='lightning' title={t('Pexip_Enterprise_only')}>
{t('A_secure_and_highly_private_self-managed_solution_for_conference_calls')}
</Callout>
<Callout icon='lightning' title={t('Google_Meet_Enterprise_only')}>
{t('Secure_SaaS_solution')} {t('A_cloud-based_platform_for_those_needing_a_plug-and-play_app')}
</Callout>
</Margins>
<Box fontScale='h3' mbs='x24'>
{t('Required_action')}
</Box>
<Callout mbs='x12' mbe='x24' title={t('Missing_configuration')} type='warning'>
{isAdmin
? t('An_app_needs_to_be_installed_and_configured')
: t('A_workspace_admin_needs_to_install_and_configure_a_conference_call_app')}
</Callout>
</Modal.Content>
<Modal.Footer justifyContent='space-between'>
<Modal.FooterAnnotation>
{isAdmin
? t('Configure_video_conference_to_make_it_available_on_this_workspace')
: t('Talk_to_your_workspace_administrator_about_enabling_video_conferencing')}
</Modal.FooterAnnotation>
<Modal.FooterControllers>
<Button onClick={onClose}>{t('Close')}</Button>
{onConfirm && isAdmin && (
<Button primary onClick={onConfirm}>
{t('Open_settings')}
</Button>
)}
</Modal.FooterControllers>
</Modal.Footer>
</Modal>
);
};

export default VideoConfConfigModal;
Original file line number Diff line number Diff line change
@@ -1,78 +1,24 @@
import { useMutableCallback } from '@rocket.chat/fuselage-hooks';
import { useSetModal, useRoute, useSetting, useRole, useTranslation } from '@rocket.chat/ui-contexts';
import { useSetModal, useRoute, useRole } from '@rocket.chat/ui-contexts';
import React, { useMemo } from 'react';

import { availabilityErrors } from '../../../../../lib/videoConference/constants';
import GenericModal from '../../../../components/GenericModal';
import VideoConfConfigModal from './VideoConfConfigModal';

export const useVideoConfWarning = (): ((error: unknown) => void) => {
const t = useTranslation();
const setModal = useSetModal();
const videoConfSettingsRoute = useRoute('admin-settings');
const marketplaceRoute = useRoute('admin-marketplace');
const workspaceRegistered = useSetting('Cloud_Workspace_Client_Id');
const isAdmin = useRole('admin');

const videoConfSettingsRoute = useRoute('admin-settings');
const handleClose = useMutableCallback(() => setModal(null));

const handleRedirectToConfiguration = useMutableCallback((error) => {
const handleRedirectToConfiguration = useMutableCallback(() => {
handleClose();
if (error === availabilityErrors.NOT_CONFIGURED) {
return marketplaceRoute.push({ context: 'installed' });
}

return videoConfSettingsRoute.push({
videoConfSettingsRoute.push({
group: 'Video_Conference',
});
});

const handleOpenMarketplace = useMutableCallback(() => {
handleClose();
marketplaceRoute.push();
});

return useMemo(() => {
if (!isAdmin) {
return (): void =>
setModal(
<GenericModal icon={null} title={t('Video_conference_not_available')} onClose={handleClose} onConfirm={handleClose}>
{t('Video_conference_apps_can_be_installed')}
</GenericModal>,
);
}

return (error): void => {
if (error === availabilityErrors.NOT_CONFIGURED || error === availabilityErrors.NOT_ACTIVE) {
return setModal(
<GenericModal
icon={null}
variant='warning'
title={t('Configure_video_conference')}
onCancel={handleClose}
onClose={handleClose}
onConfirm={(): void => handleRedirectToConfiguration(error)}
confirmText={t('Open_settings')}
>
{t('Configure_video_conference_to_use')}
</GenericModal>,
);
}

if (error === availabilityErrors.NO_APP || !!workspaceRegistered) {
return setModal(
<GenericModal
icon={null}
variant='warning'
title={t('Video_conference_app_required')}
onCancel={handleClose}
onClose={handleClose}
onConfirm={handleOpenMarketplace}
confirmText={t('Explore_marketplace')}
>
{t('Video_conference_apps_available')}
</GenericModal>,
);
}
};
}, [handleClose, handleOpenMarketplace, handleRedirectToConfiguration, isAdmin, setModal, t, workspaceRegistered]);
return useMemo(
() => (): void => setModal(<VideoConfConfigModal onClose={handleClose} onConfirm={handleRedirectToConfiguration} isAdmin={isAdmin} />),
[handleClose, handleRedirectToConfiguration, isAdmin, setModal],
);
};
23 changes: 18 additions & 5 deletions apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@
"2_Erros_Information_and_Debug": "2 - Errors, Information and Debug",
"12_Hour": "12-hour clock",
"24_Hour": "24-hour clock",
"A_cloud-based_platform_for_those_needing_a_plug-and-play_app": "A cloud-based platform for those needing a plug-and-play app.",
"A_new_owner_will_be_assigned_automatically_to__count__rooms": "A new owner will be assigned automatically to <span style=\"font-weight: bold;\">__count__</span> rooms.",
"A_new_owner_will_be_assigned_automatically_to_the__roomName__room": "A new owner will be assigned automatically to the <span style=\"font-weight: bold;\">__roomName__</span> room.",
"A_new_owner_will_be_assigned_automatically_to_those__count__rooms__rooms__": "A new owner will be assigned automatically to those <span style=\"font-weight: bold;\">__count__</span> rooms:<br/> __rooms__.",
"A_secure_and_highly_private_self-managed_solution_for_conference_calls": "A secure and highly private self-managed solution for conference calls.",
"A_workspace_admin_needs_to_install_and_configure_a_conference_call_app": "A workspace admin needs to install and configure a conference call app.",
"An_app_needs_to_be_installed_and_configured": "An app needs to be installed and configured.",
"Accept_Call": "Accept Call",
"Accept": "Accept",
"Accept_incoming_livechat_requests_even_if_there_are_no_online_agents": "Accept incoming omnichannel requests even if there are no online agents",
Expand Down Expand Up @@ -447,6 +451,7 @@
"App_Info": "App Info",
"App_Information": "App Information",
"App_Installation": "App Installation",
"App_not_enabled": "App not enabled",
"App_not_found": "App not found",
"App_status_auto_enabled": "Enabled",
"App_status_constructed": "Constructed",
Expand Down Expand Up @@ -777,6 +782,7 @@
"Calls_in_queue_plural": "__calls__ calls in queue",
"Calls_in_queue_empty": "Queue is empty",
"Call_declined": "Call Declined!",
"Call_history_provides_a_record_of_when_calls_took_place_and_who_joined": "Call history provides a record of when calls took place and who joined.",
"Call_Information": "Call Information",
"Call_provider": "Call Provider",
"Call_Already_Ended": "Call Already Ended",
Expand Down Expand Up @@ -1052,18 +1058,19 @@
"Commit_details": "Commit Details",
"Completed": "Completed",
"Computer": "Computer",
"Conference_call_apps": "Conference call apps",
"Conference_call_has_ended": "_Call has ended._",
"Conference_name": "Conference name",
"Configure_Incoming_Mail_IMAP": "Configure Incoming Mail (IMAP)",
"Configure_Outgoing_Mail_SMTP": "Configure Outgoing Mail (SMTP)",
"Configure_video_conference_to_make_it_available_on_this_workspace": "Configure video conference to make it available on this workspace",
"Confirm": "Confirm",
"Confirm_new_encryption_password": "Confirm new encryption password",
"Confirm_new_password": "Confirm New Password",
"Confirm_New_Password_Placeholder": "Please re-enter new password...",
"Confirm_password": "Confirm your password",
"Confirmation": "Confirmation",
"Configure_video_conference": "Configure conference call",
"Configure_video_conference_to_use": "Configure conference calls in order to make it available on this workspace.",
"Connect": "Connect",
"Connected": "Connected",
"Connect_SSL_TLS": "Connect with SSL/TLS",
Expand Down Expand Up @@ -1815,6 +1822,7 @@
"Enter_to": "Enter to",
"Enter_your_E2E_password": "Enter your E2E password",
"Enterprise": "Enterprise",
"Enterprise_capabilities": "Enterprise capabilities",
"Enterprise_Description": "Manually update your Enterprise license.",
"Enterprise_License": "Enterprise License",
"Enterprise_License_Description": "If your workspace is registered and license is provided by Rocket.Chat Cloud you don't need to manually update the license here.",
Expand Down Expand Up @@ -2293,6 +2301,7 @@
"Global_purge_override_warning": "A global retention policy is in place. If you leave \"Override global retention policy\" off, you can only apply a policy that is stricter than the global policy.",
"Global_Search": "Global search",
"Go_to_your_workspace": "Go to your workspace",
"Google_Meet_Enterprise_only": "Google Meet (Enterprise only)",
"Google_Play": "Google Play",
"Hold_Call": "Hold Call",
"Hold_Call_EE_only": "Hold Call (Enterprise Edition only)",
Expand Down Expand Up @@ -2596,6 +2605,7 @@
"italic": "Italic",
"italics": "italics",
"Items_per_page:": "Items per page:",
"Jitsi_included_with_Community": "Jitsi, included with Community",
"Job_Title": "Job Title",
"Join": "Join",
"Join_with_password": "Join with password",
Expand Down Expand Up @@ -3323,6 +3333,7 @@
"Minimum_balance": "Minimum balance",
"minute": "minute",
"minutes": "minutes",
"Missing_configuration": "Missing configuration",
"Mobex_sms_gateway_address": "Mobex SMS Gateway Address",
"Mobex_sms_gateway_address_desc": "IP or Host of your Mobex service with specified port. E.g. `http://192.168.1.1:1401` or `https://www.example.com:1401`",
"Mobex_sms_gateway_from_number": "From",
Expand Down Expand Up @@ -3598,6 +3609,7 @@
"Open_Livechats": "Chats in Progress",
"Open_menu": "Open_menu",
"Open_settings": "Open settings",
"Open-source_conference_call_solution": "Open-source conference call solution.",
"Open_thread": "Open Thread",
"Open_your_authentication_app_and_enter_the_code": "Open your authentication app and enter the code. You can also use one of your backup codes.",
"Opened": "Opened",
Expand Down Expand Up @@ -3681,6 +3693,7 @@
"Permalink": "Permalink",
"Permissions": "Permissions",
"Personal_Access_Tokens": "Personal Access Tokens",
"Pexip_Enterprise_only": "Pexip (Enterprise only)",
"Phone": "Phone",
"Phone_call": "Phone Call",
"Phone_Number": "Phone Number",
Expand Down Expand Up @@ -4026,8 +4039,10 @@
"Return_to_the_queue": "Return back to the Queue",
"Review_devices": "Review when and where devices are connecting from",
"Ringing": "Ringing",
"Ringtones_and_visual_indicators_notify_people_of_incoming_calls": "Ringtones and visual indicators notify people of incoming calls.",
"Robot_Instructions_File_Content": "Robots.txt File Contents",
"Root": "Root",
"Required_action": "Required action",
"Default_Referrer_Policy": "Default Referrer Policy",
"Default_Referrer_Policy_Description": "This controls the 'referrer' header that's sent when requesting embedded media from other servers. For more information, refer to <a href='https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy'>this link from MDN</a>. Remember, a full page refresh is required for this to take effect",
"No_Referrer": "No Referrer",
Expand Down Expand Up @@ -4232,6 +4247,7 @@
"Seats_usage": "Seats Usage",
"seconds": "seconds",
"Secret_token": "Secret Token",
"Secure_SaaS_solution": "Secure SaaS solution.",
"Security": "Security",
"See_documentation": "See documentation",
"See_Pricing": "See Pricing",
Expand Down Expand Up @@ -4549,6 +4565,7 @@
"Take_rocket_chat_with_you_with_mobile_applications": "Take Rocket.Chat with you with mobile applications.",
"Taken_at": "Taken at",
"Talk_Time": "Talk Time",
"Talk_to_your_workspace_administrator_about_enabling_video_conferencing": "Talk to your workspace administrator about enabling video conferencing",
"Target user not allowed to receive messages": "Target user not allowed to receive messages",
"TargetRoom": "Target Room",
"TargetRoom_Description": "The room where messages will be sent which are a result of this event being fired. Only one target room is allowed and it must exist.",
Expand Down Expand Up @@ -5087,10 +5104,6 @@
"Video_Call_unavailable_for_federation": "Video Call is unavailable for Federated rooms",
"Video_Conferences": "Conference Calls",
"video-conf-provider-not-configured": "**Conference call not enabled**: A workspace admin needs to enable the conference calls feature first.",
"Video_conference_app_required": "Conference call app required",
"Video_conference_apps_available": "Conference call apps are available on the Rocket.Chat marketplace.",
"Video_conference_apps_can_be_installed": "Conference call apps can be installed in the Rocket.Chat marketplace by a workspace admin.",
"Video_conference_not_available": "Conference call not available",
"Video_message": "Video message",
"Videocall_declined": "Video Call Declined.",
"Video_and_Audio_Call": "Video and Audio Call",
Expand Down
Loading

0 comments on commit fd086f6

Please sign in to comment.