Skip to content

Commit

Permalink
CRS-320 Add own reactions (#604)
Browse files Browse the repository at this point in the history
* pass message.own_reactions into reactions related components so they can be used in custom implementations

* fix prop types
  • Loading branch information
Tom Hutman authored Nov 10, 2020
1 parent 8c08116 commit da2014a
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/components/Message/MessageCommerce.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ const MessageCommerce = (props) => {
<ReactionsList
reactions={message.latest_reactions}
reaction_counts={message.reaction_counts || undefined}
own_reactions={message.own_reactions}
onClick={onReactionListClick}
/>
)}
Expand All @@ -145,6 +146,7 @@ const MessageCommerce = (props) => {
detailedView
reaction_counts={message.reaction_counts || undefined}
latest_reactions={message.latest_reactions}
own_reactions={message.own_reactions}
ref={reactionSelectorRef}
/>
)}
Expand Down
2 changes: 2 additions & 0 deletions src/components/Message/MessageLivestream.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ const MessageLivestreamComponent = (props) => {
detailedView
latest_reactions={message?.latest_reactions}
reaction_counts={message?.reaction_counts || undefined}
own_reactions={message.own_reactions}
ref={reactionSelectorRef}
/>
)}
Expand Down Expand Up @@ -276,6 +277,7 @@ const MessageLivestreamComponent = (props) => {
<ReactionsList
reaction_counts={message.reaction_counts || undefined}
reactions={message.latest_reactions}
own_reactions={message.own_reactions}
handleReaction={propHandleReaction || handleReaction}
/>
)}
Expand Down
2 changes: 2 additions & 0 deletions src/components/Message/MessageSimple.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ const MessageSimple = (props) => {
<ReactionsList
reactions={message.latest_reactions}
reaction_counts={message.reaction_counts || undefined}
own_reactions={message.own_reactions}
onClick={onReactionListClick}
reverse={true}
/>
Expand All @@ -177,6 +178,7 @@ const MessageSimple = (props) => {
detailedView
reaction_counts={message.reaction_counts || undefined}
latest_reactions={message.latest_reactions}
own_reactions={message.own_reactions}
ref={reactionSelectorRef}
/>
)}
Expand Down
3 changes: 3 additions & 0 deletions src/components/Message/MessageTeam.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ const MessageTeam = (props) => {
handleReaction={propHandleReaction || handleReaction}
latest_reactions={message.latest_reactions}
reaction_counts={message.reaction_counts || undefined}
own_reactions={message.own_reactions}
detailedView={true}
ref={reactionSelectorRef}
/>
Expand Down Expand Up @@ -315,6 +316,7 @@ const MessageTeam = (props) => {
reaction_counts={message.reaction_counts || undefined}
handleReaction={propHandleReaction || handleReaction}
reactions={message.latest_reactions}
own_reactions={message.own_reactions}
/>
)}
{message?.status === 'failed' && (
Expand Down Expand Up @@ -358,6 +360,7 @@ const MessageTeam = (props) => {
reaction_counts={message.reaction_counts || undefined}
handleReaction={propHandleReaction || handleReaction}
reactions={message.latest_reactions}
own_reactions={message.own_reactions}
/>
)}
{!threadList && message && (
Expand Down
2 changes: 2 additions & 0 deletions src/components/Message/MessageText.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ const MessageTextComponent = (props) => {
<ReactionsList
reactions={message.latest_reactions}
reaction_counts={message.reaction_counts || undefined}
own_reactions={message.own_reactions}
onClick={onReactionListClick}
reverse={true}
/>
Expand All @@ -114,6 +115,7 @@ const MessageTextComponent = (props) => {
detailedView
reaction_counts={message.reaction_counts || undefined}
latest_reactions={message.latest_reactions}
own_reactions={message.own_reactions}
ref={reactionSelectorRef}
/>
)}
Expand Down
2 changes: 2 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,7 @@ export interface ReactionSelectorProps {
reaction_counts?: {
[reaction_type: string]: number;
};
own_reactions?: StreamChatReactMessageResponse['own_reactions'];
/** Enable the avatar display */
detailedView?: boolean;
/** Provide a list of reaction options [{name: 'angry', emoji: 'angry'}] */
Expand Down Expand Up @@ -992,6 +993,7 @@ export interface ReactionsListProps {
reaction_counts?: {
[reaction_type: string]: number;
};
own_reactions?: StreamChatReactMessageResponse['own_reactions'];
/** Provide a list of reaction options [{name: 'angry', emoji: 'angry'}] */
reactionOptions?: MinimalEmojiInterface[];
onClick?(): void;
Expand Down

0 comments on commit da2014a

Please sign in to comment.