2021-07-08 13:42:07 +00:00
|
|
|
// @flow
|
2018-06-19 16:43:33 +00:00
|
|
|
|
2021-07-08 13:42:07 +00:00
|
|
|
import { createToolbarEvent, sendAnalytics } from '../../analytics';
|
|
|
|
import { openDialog } from '../../base/dialog';
|
2018-06-19 16:43:33 +00:00
|
|
|
import { translate } from '../../base/i18n';
|
2019-08-30 16:39:06 +00:00
|
|
|
import { IconRec } from '../../base/icons';
|
2021-07-08 13:42:07 +00:00
|
|
|
import { connect } from '../../base/redux';
|
|
|
|
import { AbstractButton, type AbstractButtonProps } from '../../base/toolbox/components';
|
|
|
|
|
|
|
|
import LocalRecordingInfoDialog from './LocalRecordingInfoDialog';
|
2018-06-19 16:43:33 +00:00
|
|
|
|
|
|
|
/**
|
2021-07-08 13:42:07 +00:00
|
|
|
* The type of the React {@code Component} props of {@link LocalRecording}.
|
2018-06-19 16:43:33 +00:00
|
|
|
*/
|
2021-07-08 13:42:07 +00:00
|
|
|
type Props = AbstractButtonProps & {
|
2018-06-19 16:43:33 +00:00
|
|
|
|
|
|
|
/**
|
2021-07-08 13:42:07 +00:00
|
|
|
* The redux {@code dispatch} function.
|
2018-06-19 16:43:33 +00:00
|
|
|
*/
|
2021-07-08 13:42:07 +00:00
|
|
|
dispatch: Function
|
|
|
|
};
|
2018-06-19 16:43:33 +00:00
|
|
|
|
|
|
|
/**
|
2021-07-08 13:42:07 +00:00
|
|
|
* Implementation of a button for opening local recording dialog.
|
2018-06-19 16:43:33 +00:00
|
|
|
*/
|
2021-07-08 13:42:07 +00:00
|
|
|
class LocalRecording extends AbstractButton<Props, *> {
|
|
|
|
accessibilityLabel = 'toolbar.accessibilityLabel.localRecording';
|
|
|
|
icon = IconRec;
|
|
|
|
label = 'localRecording.dialogTitle';
|
|
|
|
tooltip = 'localRecording.dialogTitle';
|
2018-06-19 16:43:33 +00:00
|
|
|
|
|
|
|
/**
|
2021-07-08 13:42:07 +00:00
|
|
|
* Handles clicking / pressing the button, and opens the appropriate dialog.
|
2018-06-19 16:43:33 +00:00
|
|
|
*
|
2021-07-08 13:42:07 +00:00
|
|
|
* @protected
|
2018-06-19 16:43:33 +00:00
|
|
|
* @returns {void}
|
|
|
|
*/
|
2021-07-08 13:42:07 +00:00
|
|
|
_handleClick() {
|
2021-09-14 07:07:20 +00:00
|
|
|
const { dispatch, handleClick } = this.props;
|
|
|
|
|
|
|
|
if (handleClick) {
|
|
|
|
handleClick();
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
2021-07-08 13:42:07 +00:00
|
|
|
|
|
|
|
sendAnalytics(createToolbarEvent('local.recording'));
|
|
|
|
dispatch(openDialog(LocalRecordingInfoDialog));
|
2018-06-19 16:43:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-08 13:42:07 +00:00
|
|
|
export default translate(connect()(LocalRecording));
|