Skip to content

Commit 57eb2fe

Browse files
committed
Make right panel collpasing work in GroupView
1 parent be611f5 commit 57eb2fe

3 files changed

Lines changed: 70 additions & 38 deletions

File tree

‎src/components/structures/RightPanel.js‎

Lines changed: 64 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,15 @@ module.exports = React.createClass({
9898
return;
9999
}
100100

101-
// call ChatInviteDialog
102-
dis.dispatch({
103-
action: 'view_invite',
104-
roomId: this.props.roomId,
105-
});
101+
if (this.state.phase === this.Phase.GroupMemberList) {
102+
// TODO: display UserPickeDialog
103+
} else {
104+
// call UserPickerDialog
105+
dis.dispatch({
106+
action: 'view_invite',
107+
roomId: this.props.roomId,
108+
});
109+
}
106110
},
107111

108112
onRoomStateMember: function(ev, state, member) {
@@ -169,7 +173,6 @@ module.exports = React.createClass({
169173
const NotificationPanel = sdk.getComponent('structures.NotificationPanel');
170174
const FilePanel = sdk.getComponent('structures.FilePanel');
171175
const TintableSvg = sdk.getComponent("elements.TintableSvg");
172-
let buttonGroup;
173176
let inviteGroup;
174177
let panel;
175178

@@ -212,50 +215,72 @@ module.exports = React.createClass({
212215

213216
}
214217

218+
let headerButtons = [];
215219
if (this.props.roomId) {
216-
buttonGroup =
217-
<div className="mx_RightPanel_headerButtonGroup">
218-
<AccessibleButton className="mx_RightPanel_headerButton"
219-
title={ _t('Members') } onClick={ this.onMemberListButtonClick }>
220-
<div className="mx_RightPanel_headerButton_badge">{ membersBadge ? membersBadge : <span>&nbsp;</span>}</div>
221-
<TintableSvg src="img/icons-people.svg" width="25" height="25"/>
222-
{ membersHighlight }
223-
</AccessibleButton>
224-
<AccessibleButton
225-
className="mx_RightPanel_headerButton mx_RightPanel_filebutton"
226-
title={ _t('Files') } onClick={ this.onFileListButtonClick }>
227-
<div className="mx_RightPanel_headerButton_badge">&nbsp;</div>
228-
<TintableSvg src="img/icons-files.svg" width="25" height="25"/>
229-
{ filesHighlight }
230-
</AccessibleButton>
231-
<AccessibleButton
232-
className="mx_RightPanel_headerButton mx_RightPanel_notificationbutton"
233-
title={ _t('Notifications') } onClick={ this.onNotificationListButtonClick }>
234-
<div className="mx_RightPanel_headerButton_badge">&nbsp;</div>
235-
<TintableSvg src="img/icons-notifications.svg" width="25" height="25"/>
236-
{ notificationsHighlight }
237-
</AccessibleButton>
238-
<div className="mx_RightPanel_headerButton mx_RightPanel_collapsebutton" title={ _t("Hide panel") } onClick={ this.onCollapseClick }>
239-
<TintableSvg src="img/minimise.svg" width="10" height="16"/>
240-
</div>
241-
</div>;
220+
headerButtons.push(
221+
<AccessibleButton className="mx_RightPanel_headerButton" key="_membersButton"
222+
title={ _t('Members') } onClick={ this.onMemberListButtonClick }>
223+
<div className="mx_RightPanel_headerButton_badge">{ membersBadge ? membersBadge : <span>&nbsp;</span>}</div>
224+
<TintableSvg src="img/icons-people.svg" width="25" height="25"/>
225+
{ membersHighlight }
226+
</AccessibleButton>
227+
);
228+
headerButtons.push(
229+
<AccessibleButton
230+
className="mx_RightPanel_headerButton mx_RightPanel_filebutton" key="_filesButton"
231+
title={ _t('Files') } onClick={ this.onFileListButtonClick }>
232+
<div className="mx_RightPanel_headerButton_badge">&nbsp;</div>
233+
<TintableSvg src="img/icons-files.svg" width="25" height="25"/>
234+
{ filesHighlight }
235+
</AccessibleButton>
236+
);
237+
headerButtons.push(
238+
<AccessibleButton
239+
className="mx_RightPanel_headerButton mx_RightPanel_notificationbutton" key="_notifsButton"
240+
title={ _t('Notifications') } onClick={ this.onNotificationListButtonClick }>
241+
<div className="mx_RightPanel_headerButton_badge">&nbsp;</div>
242+
<TintableSvg src="img/icons-notifications.svg" width="25" height="25"/>
243+
{ notificationsHighlight }
244+
</AccessibleButton>
245+
);
246+
}
247+
248+
if (this.props.roomId || this.props.groupId) {
249+
// Hiding the right panel hides it completely and relies on an 'expand' button
250+
// being put in the RoomHeader or GroupView header, so only show the minimise
251+
// button on these 2 screens or you won't be able to re-expand the panel.
252+
headerButtons.push(
253+
<div className="mx_RightPanel_headerButton mx_RightPanel_collapsebutton" key="_minimizeButton"
254+
title={ _t("Hide panel") } onClick={ this.onCollapseClick }
255+
>
256+
<TintableSvg src="img/minimise.svg" width="10" height="16"/>
257+
</div>
258+
);
242259
}
243260

244261
if (!this.props.collapsed) {
245262
if (this.props.roomId && this.state.phase == this.Phase.RoomMemberList) {
246263
panel = <MemberList roomId={this.props.roomId} key={this.props.roomId} />
247264
} else if (this.props.groupId && this.state.phase == this.Phase.GroupMemberList) {
248-
panel = <GroupMemberList groupId={this.props.groupId} key={this.props.groupId} />
265+
panel = <GroupMemberList groupId={this.props.groupId} key={this.props.groupId} />;
266+
inviteGroup = (
267+
<AccessibleButton className="mx_RightPanel_invite" onClick={ this.onInviteButtonClick } >
268+
<div className="mx_RightPanel_icon" >
269+
<TintableSvg src="img/icon-invite-people.svg" width="35" height="35" />
270+
</div>
271+
<div className="mx_RightPanel_message">{ _t('Invite to this group') }</div>
272+
</AccessibleButton>
273+
);
249274
} else if (this.state.phase == this.Phase.RoomMemberInfo) {
250275
const MemberInfo = sdk.getComponent('rooms.MemberInfo');
251276
panel = <MemberInfo member={this.state.member} key={this.props.roomId || this.state.member.userId} />
252277
} else if (this.state.phase == this.Phase.GroupMemberInfo) {
253278
const GroupMemberInfo = sdk.getComponent('groups.GroupMemberInfo');
254-
panel = <GroupMemberInfo member={this.state.member} groupId={this.props.groupId} key={this.state.member.user_id} />
279+
panel = <GroupMemberInfo member={this.state.member} groupId={this.props.groupId} key={this.state.member.user_id} />;
255280
} else if (this.state.phase == this.Phase.NotificationPanel) {
256-
panel = <NotificationPanel />
281+
panel = <NotificationPanel />;
257282
} else if (this.state.phase == this.Phase.FilePanel) {
258-
panel = <FilePanel roomId={this.props.roomId} />
283+
panel = <FilePanel roomId={this.props.roomId} />;
259284
}
260285
}
261286

@@ -271,7 +296,9 @@ module.exports = React.createClass({
271296
return (
272297
<aside className={classes} style={{ opacity: this.props.opacity }}>
273298
<div className="mx_RightPanel_header">
274-
{ buttonGroup }
299+
<div className="mx_RightPanel_headerButtonGroup">
300+
{headerButtons}
301+
</div>
275302
</div>
276303
{ panel }
277304
<div className="mx_RightPanel_footer">

‎src/i18n/strings/en_EN.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,5 +205,6 @@
205205
"Remember, you can always set an email address in user settings if you change your mind.": "Remember, you can always set an email address in user settings if you change your mind.",
206206
"To return to your account in future you need to <u>set a password</u>": "To return to your account in future you need to <u>set a password</u>",
207207
"Set Password": "Set Password",
208-
"Couldn't load home page": "Couldn't load home page"
208+
"Couldn't load home page": "Couldn't load home page",
209+
"Invite to this group": "Invite to this group"
209210
}

‎src/skins/vector/css/matrix-react-sdk/structures/_GroupView.scss‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ limitations under the License.
7070
flex: 1;
7171
}
7272

73+
.mx_GroupView_header_rightCol {
74+
display: flex;
75+
}
76+
7377
.mx_GroupView_saveButton, .mx_GroupView_cancelButton {
7478
display: table-cell;
7579
}

0 commit comments

Comments
 (0)