mirror of https://github.com/jitsi/jitsi-meet
Fixes: https://github.com/jitsi/jitsi-meet/issues/10486pull/10499/head jitsi-meet_6674
parent
991a0e22a8
commit
8393118330
@ -0,0 +1,65 @@ |
||||
// @flow
|
||||
|
||||
import { createToolbarEvent, sendAnalytics } from '../../analytics'; |
||||
import { translate } from '../../base/i18n'; |
||||
import { IconShareDoc } from '../../base/icons'; |
||||
import { connect } from '../../base/redux'; |
||||
import { AbstractButton, type AbstractButtonProps } from '../../base/toolbox/components'; |
||||
import { navigate } from '../../conference/components/native/ConferenceNavigationContainerRef'; |
||||
import { screen } from '../../conference/components/native/routes'; |
||||
|
||||
|
||||
type Props = AbstractButtonProps; |
||||
|
||||
/** |
||||
* Implements an {@link AbstractButton} to open the chat screen on mobile. |
||||
*/ |
||||
class SharedDocumentButton extends AbstractButton<Props, *> { |
||||
accessibilityLabel = 'toolbar.accessibilityLabel.document'; |
||||
icon = IconShareDoc; |
||||
label = 'toolbar.documentOpen'; |
||||
tooltip = 'toolbar.documentOpen'; |
||||
|
||||
/** |
||||
* Handles clicking / pressing the button, and opens / closes the appropriate dialog. |
||||
* |
||||
* @private |
||||
* @returns {void} |
||||
*/ |
||||
_handleClick() { |
||||
const { handleClick } = this.props; |
||||
|
||||
if (handleClick) { |
||||
handleClick(); |
||||
|
||||
return; |
||||
} |
||||
|
||||
sendAnalytics(createToolbarEvent( |
||||
'toggle.etherpad', |
||||
{ |
||||
enable: true |
||||
})); |
||||
|
||||
navigate(screen.conference.sharedDocument); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 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} |
||||
*/ |
||||
function _mapStateToProps(state: Object, ownProps: Object) { |
||||
const { documentUrl } = state['features/etherpad']; |
||||
const { visible = Boolean(documentUrl) } = ownProps; |
||||
|
||||
return { |
||||
visible |
||||
}; |
||||
} |
||||
|
||||
export default translate(connect(_mapStateToProps)(SharedDocumentButton)); |
@ -1,2 +1,2 @@ |
||||
export { default as SharedDocument } from './native/SharedDocument'; |
||||
export { default as SharedDocumentButton } from './SharedDocumentButton'; |
||||
export { default as SharedDocumentButton } from './SharedDocumentButton.native'; |
||||
|
@ -1 +1 @@ |
||||
export { default as SharedDocumentButton } from './SharedDocumentButton'; |
||||
export { default as SharedDocumentButton } from './SharedDocumentButton.web'; |
||||
|
Loading…
Reference in new issue