mirror of https://github.com/jitsi/jitsi-meet
feat(presence): display status in thumbnail and large video (#1828)
* feat(presence): display status in thumbnail and large video - Create a React Component for displaying presence. It currently connects to the store for participant updates but in the future should not be as smart once more reactification occurs. - Modify filmstrip css so the presence status displays horizontal center and below the avatar. - Modify videolayout css so the presence status displays horizontal centered and with a rounded background. - Dispatch presence updates so the participant state can be update. - Update message position on large video update to ensure message positioning is correct. * squash: do not show presence message if connection message is displayedpull/1850/head jitsi-meet_2316
parent
82117a0aef
commit
c04ef05058
@ -0,0 +1,81 @@ |
||||
import React, { Component } from 'react'; |
||||
import { connect } from 'react-redux'; |
||||
|
||||
import { getParticipantById } from '../../base/participants'; |
||||
|
||||
/** |
||||
* React {@code Component} for displaying the current presence status of a |
||||
* participant. |
||||
* |
||||
* @extends Component |
||||
*/ |
||||
class PresenceLabel extends Component { |
||||
/** |
||||
* The default values for {@code PresenceLabel} component's property types. |
||||
* |
||||
* @static |
||||
*/ |
||||
static defaultProps = { |
||||
_presence: '' |
||||
}; |
||||
|
||||
/** |
||||
* {@code PresenceLabel} component's property types. |
||||
* |
||||
* @static |
||||
*/ |
||||
static propTypes = { |
||||
/** |
||||
* The current present status associated with the passed in |
||||
* participantID prop. |
||||
*/ |
||||
_presence: React.PropTypes.string, |
||||
|
||||
/** |
||||
* The ID of the participant whose presence status shoul display. |
||||
*/ |
||||
participantID: React.PropTypes.string |
||||
}; |
||||
|
||||
/** |
||||
* Implements React's {@link Component#render()}. |
||||
* |
||||
* @inheritdoc |
||||
* @returns {ReactElement} |
||||
*/ |
||||
render() { |
||||
const { _presence } = this.props; |
||||
|
||||
return ( |
||||
<div |
||||
className |
||||
= { `presence-label ${_presence ? '' : 'no-presence'}` }> |
||||
{ _presence } |
||||
</div> |
||||
); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Maps (parts of) the Redux state to the associated {@code PresenceLabel}'s |
||||
* props. |
||||
* |
||||
* @param {Object} state - The Redux state. |
||||
* @param {Object} ownProps - The React Component props passed to the associated |
||||
* instance of {@code PresenceLabel}. |
||||
* @private |
||||
* @returns {{ |
||||
* _presence: (string|undefined) |
||||
* }} |
||||
*/ |
||||
function _mapStateToProps(state, ownProps) { |
||||
const participant |
||||
= getParticipantById( |
||||
state['features/base/participants'], ownProps.participantID); |
||||
|
||||
return { |
||||
_presence: participant && participant.presence |
||||
}; |
||||
} |
||||
|
||||
export default connect(_mapStateToProps)(PresenceLabel); |
@ -0,0 +1 @@ |
||||
export { default as PresenceLabel } from './PresenceLabel'; |
@ -0,0 +1 @@ |
||||
export * from './components'; |
Loading…
Reference in new issue