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.

AbstractChatMessage.js 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // @flow
  2. import { PureComponent } from 'react';
  3. import { getAvatarURLByParticipantId } from '../../base/participants';
  4. /**
  5. * The type of the React {@code Component} props of {@code AbstractChatMessage}.
  6. */
  7. export type Props = {
  8. /**
  9. * The URL of the avatar of the participant.
  10. */
  11. _avatarURL: string,
  12. /**
  13. * The representation of a chat message.
  14. */
  15. message: Object,
  16. /**
  17. * Invoked to receive translated strings.
  18. */
  19. t: Function
  20. };
  21. /**
  22. * Abstract component to display a chat message.
  23. */
  24. export default class AbstractChatMessage<P: Props> extends PureComponent<P> {}
  25. /**
  26. * Maps part of the Redux state to the props of this component.
  27. *
  28. * @param {Object} state - The Redux state.
  29. * @param {Props} ownProps - The own props of the component.
  30. * @returns {{
  31. * _avatarURL: string
  32. * }}
  33. */
  34. export function _mapStateToProps(state: Object, ownProps: Props) {
  35. const { message } = ownProps;
  36. return {
  37. _avatarURL: getAvatarURLByParticipantId(state, message.user._id)
  38. };
  39. }