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.js 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // @flow
  2. import React, { Component } from 'react';
  3. import { Avatar } from '../../../base/avatar';
  4. import { translate } from '../../../base/i18n';
  5. import { getLocalParticipant } from '../../../base/participants';
  6. import { connect } from '../../../base/redux';
  7. /**
  8. * The type of the React {@code Component} props of
  9. * {@link ProfileButtonAvatar}.
  10. */
  11. type Props = {
  12. /**
  13. * The redux representation of the local participant.
  14. */
  15. _localParticipant: Object,
  16. };
  17. /**
  18. * A React {@code Component} for displaying a profile avatar as an
  19. * icon.
  20. *
  21. * @extends Component
  22. */
  23. class ProfileButtonAvatar extends Component<Props> {
  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) {
  50. return {
  51. _localParticipant: getLocalParticipant(state)
  52. };
  53. }
  54. export default translate(connect(_mapStateToProps)(ProfileButtonAvatar));