Files
Flowise/packages/ui/src/ui-component/dialog/SpeechToTextDialog.jsx
T
Henry Heng 77ceeb9a3e Bugfix/Credential Filter (#5553)
* update credential filter by name

* update FlowListMenu and dialog components with refresh functionality
2025-12-05 13:09:25 +00:00

57 lines
1.7 KiB
React

import { createPortal } from 'react-dom'
import { useDispatch } from 'react-redux'
import { useEffect } from 'react'
import PropTypes from 'prop-types'
// material-ui
import { Dialog, DialogContent, DialogTitle } from '@mui/material'
// store
import { HIDE_CANVAS_DIALOG, SHOW_CANVAS_DIALOG } from '@/store/actions'
import useNotifier from '@/utils/useNotifier'
// Project imports
import SpeechToText from '@/ui-component/extended/SpeechToText'
const SpeechToTextDialog = ({ show, dialogProps, onCancel, onConfirm }) => {
const portalElement = document.getElementById('portal')
const dispatch = useDispatch()
useNotifier()
useEffect(() => {
if (show) dispatch({ type: SHOW_CANVAS_DIALOG })
else dispatch({ type: HIDE_CANVAS_DIALOG })
return () => dispatch({ type: HIDE_CANVAS_DIALOG })
}, [show, dispatch])
const component = show ? (
<Dialog
onClose={onCancel}
open={show}
fullWidth
maxWidth='sm'
aria-labelledby='alert-dialog-title'
aria-describedby='alert-dialog-description'
>
<DialogTitle sx={{ fontSize: '1rem' }} id='alert-dialog-title'>
{dialogProps.title || 'Allowed Domains'}
</DialogTitle>
<DialogContent>
<SpeechToText dialogProps={dialogProps} onConfirm={onConfirm} />
</DialogContent>
</Dialog>
) : null
return createPortal(component, portalElement)
}
SpeechToTextDialog.propTypes = {
show: PropTypes.bool,
dialogProps: PropTypes.object,
onCancel: PropTypes.func,
onConfirm: PropTypes.func
}
export default SpeechToTextDialog