From 007d60eb6cc838fd9e8053935410feb535cfac8e Mon Sep 17 00:00:00 2001 From: Leonard Kim Date: Sun, 28 Oct 2018 19:10:43 -0700 Subject: [PATCH] ref(toolbox): getter for the recording/streaming disabled tooltip --- .../base/toolbox/components/AbstractButton.js | 12 +++++++- .../LiveStream/web/LiveStreamButton.js | 30 +++++++------------ .../components/Recording/web/RecordButton.js | 20 ++++--------- 3 files changed, 26 insertions(+), 36 deletions(-) diff --git a/react/features/base/toolbox/components/AbstractButton.js b/react/features/base/toolbox/components/AbstractButton.js index de6f1c0e9..f3364ca5d 100644 --- a/react/features/base/toolbox/components/AbstractButton.js +++ b/react/features/base/toolbox/components/AbstractButton.js @@ -206,6 +206,16 @@ export default class AbstractButton extends Component { return buttonStyles; } + /** + * Get the tooltip to display when hovering over the button. + * + * @private + * @returns {string} + */ + _getTooltip() { + return this.tooltip || ''; + } + /** * Helper function to be implemented by subclasses, which must return a * boolean value indicating if this button is disabled or not. @@ -258,7 +268,7 @@ export default class AbstractButton extends Component { iconName: this._getIconName(), label: this._getLabel(), styles: this._getStyles(), - tooltip: this.tooltip + tooltip: this._getTooltip() }; return ( diff --git a/react/features/recording/components/LiveStream/web/LiveStreamButton.js b/react/features/recording/components/LiveStream/web/LiveStreamButton.js index 3921440db..9345160c0 100644 --- a/react/features/recording/components/LiveStream/web/LiveStreamButton.js +++ b/react/features/recording/components/LiveStream/web/LiveStreamButton.js @@ -37,26 +37,6 @@ class LiveStreamButton extends AbstractLiveStreamButton { iconName = 'icon-public'; toggledIconName = 'icon-public'; - /** - * Constructor of the component. - * - * @inheritdoc - */ - constructor(props: Props) { - super(props); - - this.tooltip = props._liveStreamDisabledTooltipKey; - } - - /** - * Implements {@code Component}'s componentWillReceiveProps. - * - * @inheritdoc - */ - componentWillReceiveProps(newProps: Props) { - this.tooltip = newProps._liveStreamDisabledTooltipKey; - } - /** * Helper function to be implemented by subclasses, which returns * a React Element to display (a beta tag) at the end of the button. @@ -76,6 +56,16 @@ class LiveStreamButton extends AbstractLiveStreamButton { ); } + /** + * Returns the tooltip that should be displayed when the button is disabled. + * + * @private + * @returns {string} + */ + _getTooltip() { + return this.props._liveStreamDisabledTooltipKey || ''; + } + /** * Helper function to be implemented by subclasses, which must return a * boolean value indicating if this button is disabled or not. diff --git a/react/features/recording/components/Recording/web/RecordButton.js b/react/features/recording/components/Recording/web/RecordButton.js index 8abc848f1..d3f919bdf 100644 --- a/react/features/recording/components/Recording/web/RecordButton.js +++ b/react/features/recording/components/Recording/web/RecordButton.js @@ -36,23 +36,13 @@ class RecordButton extends AbstractRecordButton { toggledIconName = 'icon-camera-take-picture'; /** - * Constructor of the component. + * Returns the tooltip that should be displayed when the button is disabled. * - * @inheritdoc + * @private + * @returns {string} */ - constructor(props: Props) { - super(props); - - this.tooltip = props._fileRecordingsDisabledTooltipKey; - } - - /** - * Implements {@code Component}'s componentWillReceiveProps. - * - * @inheritdoc - */ - componentWillReceiveProps(newProps: Props) { - this.tooltip = newProps._fileRecordingsDisabledTooltipKey; + _getTooltip() { + return this.tooltip || ''; } /**