File tree Expand file tree Collapse file tree 3 files changed +8
-10
lines changed Expand file tree Collapse file tree 3 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -254,11 +254,7 @@ export const Conversation = ({
254
254
255
255
const serviceEntity = userEntity . isService && ( await repositories . integration . getServiceFromUser ( userEntity ) ) ;
256
256
257
- if ( serviceEntity ) {
258
- openRightSidebar ( panelId , { entity : { ...serviceEntity , id : userEntity . id } } , true ) ;
259
- } else {
260
- openRightSidebar ( panelId , { entity : userEntity } , true ) ;
261
- }
257
+ openRightSidebar ( panelId , { entity : serviceEntity || userEntity } , true ) ;
262
258
} ;
263
259
264
260
const showParticipants = ( participants : User [ ] ) => {
Original file line number Diff line number Diff line change @@ -114,7 +114,6 @@ const RightSidebar: FC<RightSidebarProps> = ({
114
114
const conversationState = container . resolve ( ConversationState ) ;
115
115
const { activeConversation} = useKoSubscribableChildren ( conversationState , [ 'activeConversation' ] ) ;
116
116
117
- const [ isAddMode , setIsAddMode ] = useState < boolean > ( false ) ;
118
117
const [ animatePanelToLeft , setAnimatePanelToLeft ] = useState < boolean > ( true ) ;
119
118
120
119
const { rightSidebar} = useAppMainState . getState ( ) ;
@@ -130,10 +129,9 @@ const RightSidebar: FC<RightSidebarProps> = ({
130
129
131
130
const closePanel = ( ) => rightSidebar . close ( ) ;
132
131
133
- const togglePanel = ( newState : PanelState , entity : PanelEntity | null , addMode : boolean = false ) => {
132
+ const togglePanel = ( newState : PanelState , entity : PanelEntity | null , isAddMode : boolean = false ) => {
134
133
setAnimatePanelToLeft ( true ) ;
135
- rightSidebar . goTo ( newState , { entity} ) ;
136
- setIsAddMode ( addMode ) ;
134
+ rightSidebar . goTo ( newState , { entity, isAddMode} ) ;
137
135
} ;
138
136
139
137
const onBackClick = ( entity : PanelEntity | null = activeConversation || null ) => {
@@ -285,7 +283,7 @@ const RightSidebar: FC<RightSidebarProps> = ({
285
283
onClose = { closePanel }
286
284
serviceEntity = { serviceEntity }
287
285
selfUser = { selfUser }
288
- isAddMode = { isAddMode }
286
+ isAddMode = { rightSidebar . isAddMode }
289
287
/>
290
288
) }
291
289
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ type RightSidebarParams = {
33
33
entity : PanelEntity | null ;
34
34
showReactions ?: boolean ;
35
35
highlighted ?: User [ ] ;
36
+ isAddMode ?: boolean ;
36
37
} ;
37
38
38
39
type AppMainState = {
@@ -49,6 +50,7 @@ type AppMainState = {
49
50
highlightedUsers : RightSidebarParams [ 'highlighted' ] ;
50
51
history : PanelState [ ] ;
51
52
showReactions : RightSidebarParams [ 'showReactions' ] ;
53
+ isAddMode : RightSidebarParams [ 'isAddMode' ] ;
52
54
lastViewedMessageDetailsEntity : Message | null ;
53
55
updateEntity : ( entity : RightSidebarParams [ 'entity' ] ) => void ;
54
56
} ;
@@ -99,6 +101,7 @@ const useAppMainState = create<AppMainState>((set, get) => ({
99
101
highlightedUsers : params ?. highlighted || [ ] ,
100
102
history : [ ...replacedNewState , panel ] ,
101
103
showReactions : ! ! params ?. showReactions ,
104
+ isAddMode : ! ! params ?. isAddMode ,
102
105
} ,
103
106
} ;
104
107
} ) ;
@@ -111,6 +114,7 @@ const useAppMainState = create<AppMainState>((set, get) => ({
111
114
highlightedUsers : [ ] ,
112
115
history : [ ] ,
113
116
showReactions : false ,
117
+ isAddMode : false ,
114
118
updateEntity : ( entity : RightSidebarParams [ 'entity' ] ) =>
115
119
set ( state => ( { ...state , rightSidebar : { ...state . rightSidebar , entity} } ) ) ,
116
120
} ,
You can’t perform that action at this time.
0 commit comments