mirror of https://github.com/jitsi/jitsi-meet
feat(recording) allow highlighting meeting recording moments (#10981)
parent
faac45b5bc
commit
d651ecb166
After Width: | Height: | Size: 962 B |
@ -0,0 +1,71 @@ |
||||
// @flow
|
||||
|
||||
import { Component } from 'react'; |
||||
|
||||
import { getActiveSession, isHighlightMeetingMomentDisabled } from '../..'; |
||||
import { JitsiRecordingConstants } from '../../../base/lib-jitsi-meet'; |
||||
import { highlightMeetingMoment } from '../../actions.any'; |
||||
|
||||
export type Props = { |
||||
|
||||
/** |
||||
* Whether or not the conference is in audio only mode. |
||||
*/ |
||||
_audioOnly: boolean, |
||||
|
||||
/** |
||||
* Invoked to obtain translated strings. |
||||
*/ |
||||
t: Function |
||||
}; |
||||
|
||||
/** |
||||
* Abstract class for the {@code AbstractHighlightButton} component. |
||||
*/ |
||||
export default class AbstractHighlightButton<P: Props> extends Component<P> { |
||||
/** |
||||
* Initializes a new AbstractVideoTrack instance. |
||||
* |
||||
* @param {Object} props - The read-only properties with which the new |
||||
* instance is to be initialized. |
||||
*/ |
||||
constructor(props: Props) { |
||||
super(props); |
||||
|
||||
this._onClick = this._onClick.bind(this); |
||||
} |
||||
|
||||
/** |
||||
* Handles clicking / pressing the button. |
||||
* |
||||
* @override |
||||
* @protected |
||||
* @returns {void} |
||||
*/ |
||||
_onClick() { |
||||
const { dispatch } = this.props; |
||||
|
||||
dispatch(highlightMeetingMoment()); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Maps (parts of) the Redux state to the associated |
||||
* {@code AbstractVideoQualityLabel}'s props. |
||||
* |
||||
* @param {Object} state - The Redux state. |
||||
* @private |
||||
* @returns {{ |
||||
* _audioOnly: boolean |
||||
* }} |
||||
*/ |
||||
export function _abstractMapStateToProps(state: Object) { |
||||
const isRecordingRunning = getActiveSession(state, JitsiRecordingConstants.mode.FILE); |
||||
const isButtonDisabled = isHighlightMeetingMomentDisabled(state); |
||||
const { webhookProxyUrl } = state['features/base/config']; |
||||
|
||||
return { |
||||
_disabled: !isRecordingRunning || isButtonDisabled, |
||||
_visible: Boolean(webhookProxyUrl) |
||||
}; |
||||
} |
@ -0,0 +1,94 @@ |
||||
// @flow
|
||||
|
||||
import { withStyles } from '@material-ui/core'; |
||||
import React from 'react'; |
||||
|
||||
import { translate } from '../../../../base/i18n'; |
||||
import { IconHighlight } from '../../../../base/icons'; |
||||
import { Label } from '../../../../base/label'; |
||||
import { connect } from '../../../../base/redux'; |
||||
import { Tooltip } from '../../../../base/tooltip'; |
||||
import BaseTheme from '../../../../base/ui/components/BaseTheme'; |
||||
import AbstractHighlightButton, { |
||||
_abstractMapStateToProps, |
||||
type Props as AbstractProps |
||||
} from '../AbstractHighlightButton'; |
||||
|
||||
type Props = AbstractProps & { |
||||
_disabled: boolean, |
||||
|
||||
/** |
||||
* The message to show within the label's tooltip. |
||||
*/ |
||||
_tooltipKey: string, |
||||
|
||||
/** |
||||
* Flag controlling visibility of the component. |
||||
*/ |
||||
_visible: boolean, |
||||
}; |
||||
|
||||
/** |
||||
* Creates the styles for the component. |
||||
* |
||||
* @param {Object} theme - The current UI theme. |
||||
* |
||||
* @returns {Object} |
||||
*/ |
||||
const styles = theme => { |
||||
return { |
||||
regular: { |
||||
background: theme.palette.field02, |
||||
margin: '0 4px 4px 4px' |
||||
}, |
||||
disabled: { |
||||
background: theme.palette.text02, |
||||
margin: '0 4px 4px 4px' |
||||
} |
||||
}; |
||||
}; |
||||
|
||||
/** |
||||
* React {@code Component} responsible for displaying an action that |
||||
* allows users to highlight a meeting moment. |
||||
*/ |
||||
export class HighlightButton extends AbstractHighlightButton<Props> { |
||||
|
||||
/** |
||||
* Implements React's {@link Component#render()}. |
||||
* |
||||
* @inheritdoc |
||||
* @returns {ReactElement} |
||||
*/ |
||||
render() { |
||||
const { |
||||
_disabled, |
||||
_visible, |
||||
classes, |
||||
t |
||||
} = this.props; |
||||
|
||||
|
||||
if (!_visible) { |
||||
return null; |
||||
} |
||||
|
||||
const className = _disabled ? classes.disabled : classes.regular; |
||||
const tooltipKey = _disabled ? 'recording.highlightMomentDisabled' : 'recording.highlightMoment'; |
||||
|
||||
return ( |
||||
<Tooltip |
||||
content = { t(tooltipKey) } |
||||
position = { 'bottom' }> |
||||
<Label |
||||
className = { className } |
||||
icon = { IconHighlight } |
||||
iconColor = { _disabled ? BaseTheme.palette.text03 : BaseTheme.palette.field01 } |
||||
id = 'highlightMeetingLabel' |
||||
onClick = { this._onClick } /> |
||||
</Tooltip> |
||||
); |
||||
} |
||||
} |
||||
|
||||
export default withStyles(styles)(translate(connect(_abstractMapStateToProps)(HighlightButton))); |
@ -1,5 +1,6 @@ |
||||
// @flow
|
||||
|
||||
export { default as HighlightButton } from './HighlightButton'; |
||||
export { default as RecordButton } from './RecordButton'; |
||||
export { default as StartRecordingDialog } from './StartRecordingDialog'; |
||||
export { default as StopRecordingDialog } from './StopRecordingDialog'; |
||||
|
Loading…
Reference in new issue