2023-03-21 09:47:52 +02:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
|
|
2023-04-03 13:49:19 +03:00
|
|
|
import { createToolbarEvent } from '../../analytics/AnalyticsEvents';
|
|
|
|
|
import { sendAnalytics } from '../../analytics/functions';
|
2023-04-24 14:09:50 +03:00
|
|
|
import { IReduxState } from '../../app/types';
|
2023-04-03 13:49:19 +03:00
|
|
|
import { translate } from '../../base/i18n/functions';
|
|
|
|
|
import { IconShareDoc } from '../../base/icons/svg';
|
|
|
|
|
import AbstractButton, { IProps as AbstractButtonProps } from '../../base/toolbox/components/AbstractButton';
|
2022-01-25 14:55:57 +02:00
|
|
|
import { navigate } from '../../mobile/navigation/components/conference/ConferenceNavigationContainerRef';
|
|
|
|
|
import { screen } from '../../mobile/navigation/routes';
|
2019-10-04 17:10:19 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Implements an {@link AbstractButton} to open the chat screen on mobile.
|
|
|
|
|
*/
|
2023-04-24 14:09:50 +03:00
|
|
|
class SharedDocumentButton extends AbstractButton<AbstractButtonProps> {
|
2025-03-12 10:19:11 -05:00
|
|
|
override accessibilityLabel = 'toolbar.accessibilityLabel.document';
|
|
|
|
|
override icon = IconShareDoc;
|
|
|
|
|
override label = 'toolbar.documentOpen';
|
|
|
|
|
override tooltip = 'toolbar.documentOpen';
|
2021-07-08 16:42:07 +03:00
|
|
|
|
2019-10-04 17:10:19 +02:00
|
|
|
/**
|
|
|
|
|
* Handles clicking / pressing the button, and opens / closes the appropriate dialog.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @returns {void}
|
|
|
|
|
*/
|
2025-03-12 10:19:11 -05:00
|
|
|
override _handleClick() {
|
2021-12-01 14:29:55 +01:00
|
|
|
const { handleClick } = this.props;
|
2021-09-14 10:07:20 +03:00
|
|
|
|
|
|
|
|
if (handleClick) {
|
|
|
|
|
handleClick();
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-04 17:10:19 +02:00
|
|
|
sendAnalytics(createToolbarEvent(
|
|
|
|
|
'toggle.etherpad',
|
|
|
|
|
{
|
2021-12-01 14:29:55 +01:00
|
|
|
enable: true
|
2019-10-04 17:10:19 +02:00
|
|
|
}));
|
2021-10-20 22:29:21 +03:00
|
|
|
|
|
|
|
|
navigate(screen.conference.sharedDocument);
|
2019-10-04 17:10:19 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Maps part of the redux state to the component's props.
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} state - The redux store/state.
|
|
|
|
|
* @param {Object} ownProps - The properties explicitly passed to the component
|
|
|
|
|
* instance.
|
|
|
|
|
* @returns {Object}
|
|
|
|
|
*/
|
2023-04-24 14:09:50 +03:00
|
|
|
function _mapStateToProps(state: IReduxState, ownProps: any) {
|
2021-12-01 14:29:55 +01:00
|
|
|
const { documentUrl } = state['features/etherpad'];
|
2019-10-04 17:10:19 +02:00
|
|
|
const { visible = Boolean(documentUrl) } = ownProps;
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
visible
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default translate(connect(_mapStateToProps)(SharedDocumentButton));
|