stream-chat-react icon indicating copy to clipboard operation
stream-chat-react copied to clipboard

Display image and channel title in `ChannelHeader` for direct messaging (DM) channel

Open MartinCupela opened this issue 3 years ago • 0 comments

Motivation

Provide a consistent behavior between different types of channels as well as with ChannelPreview component in ChannelList. Currently the image (Avatar) is displayed in ChannelHeader only if the value is set on channel.data.image, meanwhile the ChannelPreview takes a look and channel.data.image and if not available tries to use other user's image.

Proposed solution

Use the same util functions getDisplayTitle and getDisplayImage already used in ChannelPreview to determine the channel title and image in ChannelHeader. The state may be held in ChannelHeader.

Optional: allow for customGetDisplayTitle and customGetDisplayImage functions that can be passed to ChannelPreview and ChannelHeader to customize the logic of determining the channel's title and display image.

Acceptance Criteria

ChannelHeader by default:

  1. displays image provided by channel.data.image and if not available and the channel is DM channel, display other user's image (otherMember.user.image)
  2. displays title provided by channel.data.name and if not available and the channel is DM channel, display other user's name (otherMember.user.name)
  3. Update the displayed image resp. name upon user.updated / channel.updated event received via the websocket connection

MartinCupela avatar May 05 '22 20:05 MartinCupela