From 1ec2f4b4646f29a1a3f56ce996fb0f562b0c4662 Mon Sep 17 00:00:00 2001 From: Gerzon Z Date: Thu, 14 Apr 2022 14:43:53 -0400 Subject: [PATCH] update: `RoomActionsView` --- app/views/RoomActionsView/index.tsx | 151 ++++++++++++++-------------- 1 file changed, 77 insertions(+), 74 deletions(-) diff --git a/app/views/RoomActionsView/index.tsx b/app/views/RoomActionsView/index.tsx index 8b668e735..9a0b8ba89 100644 --- a/app/views/RoomActionsView/index.tsx +++ b/app/views/RoomActionsView/index.tsx @@ -971,19 +971,71 @@ class RoomActionsView extends React.Component { + const { room, canForwardGuest, canReturnQueue } = this.state; + const { rid, t } = room; + const { theme } = this.props; + + if (t !== 'l' && this.isOmnichannelPreview) { + return null; + } + + return ( + + {canForwardGuest ? ( + <> + + this.onPressTouchable({ + route: 'ForwardLivechatView', + params: { rid } + }) + } + left={() => } + showActionIndicator + /> + + + ) : null} + + {canReturnQueue ? ( + <> + + this.onPressTouchable({ + event: this.returnLivechat + }) + } + left={() => } + showActionIndicator + /> + + + ) : null} + + <> + + this.onPressTouchable({ + event: this.closeLivechat + }) + } + left={() => } + showActionIndicator + /> + + + + ); + }; + render() { - const { - room, - membersCount, - canViewMembers, - canAddUser, - canInviteUser, - joined, - canAutoTranslate, - canForwardGuest, - canReturnQueue, - canViewCannedResponse - } = this.state; + const { room, membersCount, canViewMembers, canAddUser, canInviteUser, joined, canAutoTranslate, canViewCannedResponse } = + this.state; const { rid, t, prid } = room; const isGroupChat = RocketChat.isGroupChat(room); @@ -1073,6 +1125,18 @@ class RoomActionsView extends React.Component ) : null} + {['l'].includes(t) && !this.isOmnichannelPreview && canViewCannedResponse ? ( + <> + this.onPressTouchable({ route: 'CannedResponsesListView', params: { rid, room } })} + left={() => } + showActionIndicator + /> + + + ) : null} + {['c', 'p', 'd'].includes(t) ? ( <> - this.onPressTouchable({ route: 'CannedResponsesListView', params: { rid, room } })} - left={() => } - showActionIndicator - /> - - - ) : null} - - {['l'].includes(t) && !this.isOmnichannelPreview ? ( - <> - - this.onPressTouchable({ - event: this.closeLivechat - }) - } - left={() => } - showActionIndicator - /> - - - ) : null} - - {['l'].includes(t) && !this.isOmnichannelPreview && canForwardGuest ? ( - <> - - this.onPressTouchable({ - route: 'ForwardLivechatView', - params: { rid } - }) - } - left={() => } - showActionIndicator - /> - - - ) : null} - - {['l'].includes(t) && !this.isOmnichannelPreview && canReturnQueue ? ( - <> - - this.onPressTouchable({ - event: this.returnLivechat - }) - } - left={() => } - showActionIndicator - /> - - - ) : null} - + {this.renderOmnichannelSection()} {this.renderLastSection()}