-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NEW][ENTERPRISE] Introducing dial pad component into sidebar, calls …
…table, contextual bar (#26081) Co-authored-by: Guilherme Gazzo <5263975+ggazzo@users.noreply.github.com> Co-authored-by: Kevin Aleman <11577696+KevLehman@users.noreply.github.com>
- Loading branch information
1 parent
58e32cf
commit 0bc25a0
Showing
37 changed files
with
6,021 additions
and
5,568 deletions.
There are no files selected for viewing
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
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
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
This file was deleted.
Oops, something went wrong.
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,44 @@ | ||
import { useSetModal, useTranslation } from '@rocket.chat/ui-contexts'; | ||
import React, { useCallback, useMemo } from 'react'; | ||
|
||
import DialPadModal from '../../ee/client/voip/modal/DialPad/DialPadModal'; | ||
import { useIsVoipEnterprise } from '../contexts/CallContext'; | ||
import { dispatchToastMessage } from '../lib/toast'; | ||
|
||
type DialModalProps = { | ||
initialValue?: string; | ||
errorMessage?: string; | ||
}; | ||
|
||
type DialModalControls = { | ||
openDialModal: (props?: DialModalProps) => void; | ||
closeDialModal: () => void; | ||
}; | ||
|
||
export const useDialModal = (): DialModalControls => { | ||
const setModal = useSetModal(); | ||
const isEnterprise = useIsVoipEnterprise(); | ||
const t = useTranslation(); | ||
|
||
const closeDialModal = useCallback(() => setModal(null), [setModal]); | ||
|
||
const openDialModal = useCallback( | ||
({ initialValue, errorMessage }: DialModalProps = {}) => { | ||
if (!isEnterprise) { | ||
dispatchToastMessage({ type: 'error', message: t('You_do_not_have_permission_to_do_this') }); | ||
return; | ||
} | ||
|
||
setModal(<DialPadModal initialValue={initialValue} errorMessage={errorMessage} handleClose={closeDialModal} />); | ||
}, | ||
[setModal, isEnterprise, t, closeDialModal], | ||
); | ||
|
||
return useMemo( | ||
() => ({ | ||
openDialModal, | ||
closeDialModal, | ||
}), | ||
[openDialModal, closeDialModal], | ||
); | ||
}; |
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.