From 77418f535eec554062ad31171a0561d1712db55a Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Fri, 13 Oct 2017 16:46:33 +0100 Subject: [PATCH 1/4] Modify GroupView UI - Remove featured users/rooms - Add "Rooms" section to show all rooms in the group in a room-directory-esque list. This has a "+" button in "edit" mode. - Make the group view body scrollable --- src/components/structures/GroupView.js | 71 ++++++++--- src/components/structures/ScrollPanel.js | 1 + src/components/views/rooms/RoomDetailList.js | 122 +++++++++++++++++++ src/i18n/strings/en_EN.json | 3 +- 4 files changed, 179 insertions(+), 18 deletions(-) create mode 100644 src/components/views/rooms/RoomDetailList.js diff --git a/src/components/structures/GroupView.js b/src/components/structures/GroupView.js index 337ac6ab75..a43e1a4cd3 100644 --- a/src/components/structures/GroupView.js +++ b/src/components/structures/GroupView.js @@ -29,6 +29,8 @@ import classnames from 'classnames'; import GroupStoreCache from '../../stores/GroupStoreCache'; import GroupStore from '../../stores/GroupStore'; +import { showGroupAddRoomDialog } from '../../GroupAddressPicker'; + const RoomSummaryType = PropTypes.shape({ room_id: PropTypes.string.isRequired, @@ -64,7 +66,7 @@ const CategoryRoomList = React.createClass({ editing: PropTypes.bool.isRequired, }, - onAddRoomsClicked: function(ev) { + onAddRoomsToSummaryClicked: function(ev) { ev.preventDefault(); const AddressPickerDialog = sdk.getComponent("dialogs.AddressPickerDialog"); Modal.createTrackedDialog('Add Rooms to Group Summary', '', AddressPickerDialog, { @@ -106,7 +108,7 @@ const CategoryRoomList = React.createClass({ render: function() { const TintableSvg = sdk.getComponent("elements.TintableSvg"); const addButton = this.props.editing ? - ( + (
{ _t('Add a Room') } @@ -450,6 +452,7 @@ export default React.createClass({ }); }); this._groupStore.on('error', (err) => { + console.error(err); this.setState({ summary: null, error: err, @@ -601,6 +604,10 @@ export default React.createClass({ this._setPublicity(true); }, + _onAddRoomsClick: function() { + showGroupAddRoomDialog(this.props.groupId); + }, + _setPublicity: function(publicity) { this.setState({ publicityBusy: true, @@ -612,6 +619,28 @@ export default React.createClass({ }); }, + _getRoomsNode: function() { + const RoomDetailList = sdk.getComponent('rooms.RoomDetailList'); + const AccessibleButton = sdk.getComponent('elements.AccessibleButton'); + const TintableSvg = sdk.getComponent('elements.TintableSvg'); + const addButton = this.state.editing ? + ( +
+ +
+
+ { _t('Add rooms to this group') } +
+
) :
; + return
+
+

Rooms

+ { addButton } +
+ +
; + }, + _getFeaturedRoomsNode: function() { const summary = this.state.summary; @@ -790,6 +819,7 @@ export default React.createClass({ const GroupAvatar = sdk.getComponent("avatars.GroupAvatar"); const Loader = sdk.getComponent("elements.Spinner"); const TintableSvg = sdk.getComponent("elements.TintableSvg"); + const ScrollPanel = sdk.getComponent("structures.ScrollPanel"); if (this.state.summary === null && this.state.error === null || this.state.saving) { return ; @@ -799,7 +829,7 @@ export default React.createClass({ let avatarNode; let nameNode; let shortDescNode; - let roomBody; + let bodyNodes = []; const rightButtons = []; const headerClasses = { mx_GroupView_header: true, @@ -856,14 +886,15 @@ export default React.createClass({ width="18" height="18" alt={_t("Cancel")} /> , ); - roomBody =
-