From c1165830edff18015caf808c28f020c36eaf7d73 Mon Sep 17 00:00:00 2001 From: Germain Souquet Date: Tue, 28 Sep 2021 14:55:00 +0100 Subject: [PATCH] Create rendering context enum for MessageActionBar --- src/components/views/messages/MessageActionBar.tsx | 11 ++++++++--- src/components/views/rooms/EventTile.tsx | 9 ++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/components/views/messages/MessageActionBar.tsx b/src/components/views/messages/MessageActionBar.tsx index d3d4d5a693..06817b910a 100644 --- a/src/components/views/messages/MessageActionBar.tsx +++ b/src/components/views/messages/MessageActionBar.tsx @@ -128,6 +128,11 @@ const ReactButton: React.FC = ({ mxEvent, reactions, onFocusC ; }; +export enum ActionBarRenderingContext { + Room, + Thread +} + interface IMessageActionBarProps { mxEvent: MatrixEvent; reactions?: Relations; @@ -137,7 +142,7 @@ interface IMessageActionBarProps { permalinkCreator?: RoomPermalinkCreator; onFocusChange?: (menuDisplayed: boolean) => void; toggleThreadExpanded: () => void; - isInThreadTimeline?: boolean; + renderingContext?: ActionBarRenderingContext; isQuoteExpanded?: boolean; } @@ -146,7 +151,7 @@ export default class MessageActionBar extends React.PureComponent { } } - const isInThreadTimeline = this.props.tileShape === TileShape.Thread; + const renderingContext = this.props.tileShape === TileShape.Thread + ? ActionBarRenderingContext.Thread + : ActionBarRenderingContext.Room; const actionBar = !isEditing ? { getTile={this.getTile} getReplyThread={this.getReplyThread} onFocusChange={this.onActionBarFocusChange} - isInThreadTimeline={isInThreadTimeline} + renderingContext={renderingContext} + isQuoteExpanded={isQuoteExpanded} toggleThreadExpanded={() => this.setQuoteExpanded(!isQuoteExpanded)} /> : undefined;