You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ProfileButtonAvatar.tsx 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import React, { Component } from 'react';
  2. import { connect } from 'react-redux';
  3. import { IReduxState } from '../../../app/types';
  4. import Avatar from '../../../base/avatar/components/Avatar';
  5. import { getLocalParticipant } from '../../../base/participants/functions';
  6. import { ILocalParticipant } from '../../../base/participants/types';
  7. /**
  8. * The type of the React {@code Component} props of
  9. * {@link ProfileButtonAvatar}.
  10. */
  11. interface IProps {
  12. /**
  13. * The redux representation of the local participant.
  14. */
  15. _localParticipant?: ILocalParticipant;
  16. }
  17. /**
  18. * A React {@code Component} for displaying a profile avatar as an
  19. * icon.
  20. *
  21. * @augments Component
  22. */
  23. class ProfileButtonAvatar extends Component<IProps> {
  24. /**
  25. * Implements React's {@link Component#render()}.
  26. *
  27. * @inheritdoc
  28. * @returns {ReactElement}
  29. */
  30. render() {
  31. const { _localParticipant } = this.props;
  32. return (
  33. <Avatar
  34. participantId = { _localParticipant?.id }
  35. size = { 20 } />
  36. );
  37. }
  38. }
  39. /**
  40. * Maps (parts of) the Redux state to the associated
  41. * {@code ProfileButtonAvatar} component's props.
  42. *
  43. * @param {Object} state - The Redux state.
  44. * @private
  45. * @returns {{
  46. * _localParticipant: Object,
  47. * }}
  48. */
  49. function _mapStateToProps(state: IReduxState) {
  50. return {
  51. _localParticipant: getLocalParticipant(state)
  52. };
  53. }
  54. export default connect(_mapStateToProps)(ProfileButtonAvatar);