-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMPROVE] VideoConf Miss Config Modal (#27153)
Co-authored-by: Guilherme Gazzo <guilhermegazzo@gmail.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
- Loading branch information
1 parent
59724b0
commit fd086f6
Showing
4 changed files
with
241 additions
and
68 deletions.
There are no files selected for viewing
72 changes: 72 additions & 0 deletions
72
apps/meteor/client/views/room/contextualBar/VideoConference/VideoConfConfigModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
72 changes: 9 additions & 63 deletions
72
apps/meteor/client/views/room/contextualBar/VideoConference/useVideoConfWarning.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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], | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.