Skip to content

Commit f625590

Browse files
authored
Merge pull request element-hq#6143 from vector-im/luke/dnd-group-view-tag-panel
Implement riot-web side of dragging GroupTile avatars to TagPanel
2 parents 8c1d2a4 + f64fefa commit f625590

File tree

2 files changed

+19
-61
lines changed

2 files changed

+19
-61
lines changed

src/components/structures/LeftPanel.js

Lines changed: 13 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,13 @@ limitations under the License.
1919
import React from 'react';
2020
import PropTypes from 'prop-types';
2121
import classNames from 'classnames';
22-
import { DragDropContext } from 'react-beautiful-dnd';
2322
import { MatrixClient } from 'matrix-js-sdk';
2423
import { KeyCode } from 'matrix-react-sdk/lib/Keyboard';
2524
import sdk from 'matrix-react-sdk';
2625
import dis from 'matrix-react-sdk/lib/dispatcher';
2726
import VectorConferenceHandler from '../../VectorConferenceHandler';
2827

2928
import SettingsStore from 'matrix-react-sdk/lib/settings/SettingsStore';
30-
import TagOrderActions from 'matrix-react-sdk/lib/actions/TagOrderActions';
31-
import RoomListActions from 'matrix-react-sdk/lib/actions/RoomListActions';
3229

3330

3431
var LeftPanel = React.createClass({
@@ -170,47 +167,6 @@ var LeftPanel = React.createClass({
170167
this.setState({ searchFilter: term });
171168
},
172169

173-
onDragEnd: function(result) {
174-
// Dragged to an invalid destination, not onto a droppable
175-
if (!result.destination) {
176-
return;
177-
}
178-
179-
const dest = result.destination.droppableId;
180-
181-
if (dest === 'tag-panel-droppable') {
182-
// Dispatch synchronously so that the TagPanel receives an
183-
// optimistic update from TagOrderStore before the previous
184-
// state is shown.
185-
dis.dispatch(TagOrderActions.moveTag(
186-
this.context.matrixClient,
187-
result.draggableId,
188-
result.destination.index,
189-
), true);
190-
} else {
191-
this.onRoomTileEndDrag(result);
192-
}
193-
},
194-
195-
onRoomTileEndDrag: function(result) {
196-
let newTag = result.destination.droppableId.split('_')[1];
197-
let prevTag = result.source.droppableId.split('_')[1];
198-
if (newTag === 'undefined') newTag = undefined;
199-
if (prevTag === 'undefined') prevTag = undefined;
200-
201-
const roomId = result.draggableId.split('_')[1];
202-
203-
const oldIndex = result.source.index;
204-
const newIndex = result.destination.index;
205-
206-
dis.dispatch(RoomListActions.tagRoom(
207-
this.context.matrixClient,
208-
this.context.matrixClient.getRoom(roomId),
209-
prevTag, newTag,
210-
oldIndex, newIndex,
211-
), true);
212-
},
213-
214170
collectRoomList: function(ref) {
215171
this._roomList = ref;
216172
},
@@ -250,21 +206,19 @@ var LeftPanel = React.createClass({
250206
);
251207

252208
return (
253-
<DragDropContext onDragEnd={this.onDragEnd}>
254-
<div className={containerClasses}>
255-
{ tagPanel }
256-
<aside className={classes} onKeyDown={ this._onKeyDown } onFocus={ this._onFocus } onBlur={ this._onBlur }>
257-
{ topBox }
258-
<CallPreview ConferenceHandler={VectorConferenceHandler} />
259-
<RoomList
260-
ref={this.collectRoomList}
261-
collapsed={this.props.collapsed}
262-
searchFilter={this.state.searchFilter}
263-
ConferenceHandler={VectorConferenceHandler} />
264-
<BottomLeftMenu collapsed={this.props.collapsed}/>
265-
</aside>
266-
</div>
267-
</DragDropContext>
209+
<div className={containerClasses}>
210+
{ tagPanel }
211+
<aside className={classes} onKeyDown={ this._onKeyDown } onFocus={ this._onFocus } onBlur={ this._onBlur }>
212+
{ topBox }
213+
<CallPreview ConferenceHandler={VectorConferenceHandler} />
214+
<RoomList
215+
ref={this.collectRoomList}
216+
collapsed={this.props.collapsed}
217+
searchFilter={this.state.searchFilter}
218+
ConferenceHandler={VectorConferenceHandler} />
219+
<BottomLeftMenu collapsed={this.props.collapsed}/>
220+
</aside>
221+
</div>
268222
);
269223
}
270224
});

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ limitations under the License.
9494
text-align: center;
9595
}
9696

97-
.mx_MyGroups_joinedGroups .gm-scroll-view {
97+
.mx_MyGroups_joinedGroups {
9898
border-top: 1px solid $primary-hairline-color;
9999
overflow-x: hidden;
100100

@@ -104,7 +104,7 @@ limitations under the License.
104104
align-content: flex-start;
105105
}
106106

107-
.mx_MyGroups_joinedGroups .gm-scroll-view .mx_GroupTile {
107+
.mx_MyGroups_joinedGroups .mx_GroupTile {
108108
min-width: 300px;
109109
max-width: 33%;
110110
flex: 1 0 300px;
@@ -115,6 +115,10 @@ limitations under the License.
115115
cursor: pointer;
116116
}
117117

118+
.mx_GroupTile_avatar {
119+
cursor: grab, -webkit-grab;
120+
}
121+
118122
.mx_GroupTile_profile {
119123
margin-left: 10px;
120124
display: flex;

0 commit comments

Comments
 (0)