Remove DragDropContext from FlairSettings
This also fixes a technical bug where one could drag a community from the settings to the LLP
This commit is contained in:
parent
bd54a401bc
commit
014e4a2ccf
3 changed files with 51 additions and 50 deletions
|
@ -68,7 +68,9 @@ export default React.createClass({
|
||||||
render() {
|
render() {
|
||||||
const GroupTile = sdk.getComponent('groups.GroupTile');
|
const GroupTile = sdk.getComponent('groups.GroupTile');
|
||||||
return <div className="mx_GroupPublicity_toggle">
|
return <div className="mx_GroupPublicity_toggle">
|
||||||
<GroupTile groupId={this.props.groupId} showDescription={false} avatarHeight={40} />
|
<GroupTile groupId={this.props.groupId} showDescription={false}
|
||||||
|
avatarHeight={40} draggable={false}
|
||||||
|
/>
|
||||||
<ToggleSwitch checked={this.state.isGroupPublicised}
|
<ToggleSwitch checked={this.state.isGroupPublicised}
|
||||||
disabled={!this.state.ready || this.state.busy}
|
disabled={!this.state.ready || this.state.busy}
|
||||||
onChange={this._onPublicityToggle} />
|
onChange={this._onPublicityToggle} />
|
||||||
|
|
|
@ -33,6 +33,7 @@ const GroupTile = React.createClass({
|
||||||
showDescription: PropTypes.bool,
|
showDescription: PropTypes.bool,
|
||||||
// Height of the group avatar in pixels
|
// Height of the group avatar in pixels
|
||||||
avatarHeight: PropTypes.number,
|
avatarHeight: PropTypes.number,
|
||||||
|
draggable: PropTypes.bool,
|
||||||
},
|
},
|
||||||
|
|
||||||
contextTypes: {
|
contextTypes: {
|
||||||
|
@ -49,6 +50,7 @@ const GroupTile = React.createClass({
|
||||||
return {
|
return {
|
||||||
showDescription: true,
|
showDescription: true,
|
||||||
avatarHeight: 50,
|
avatarHeight: 50,
|
||||||
|
draggable: true,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -78,54 +80,54 @@ const GroupTile = React.createClass({
|
||||||
<div className="mx_GroupTile_desc">{ profile.shortDescription }</div> :
|
<div className="mx_GroupTile_desc">{ profile.shortDescription }</div> :
|
||||||
<div />;
|
<div />;
|
||||||
const httpUrl = profile.avatarUrl ? this.context.matrixClient.mxcUrlToHttp(
|
const httpUrl = profile.avatarUrl ? this.context.matrixClient.mxcUrlToHttp(
|
||||||
profile.avatarUrl, avatarHeight, avatarHeight, "crop",
|
profile.avatarUrl, avatarHeight, avatarHeight, "crop") : null;
|
||||||
) : null;
|
|
||||||
|
let avatarElement = (
|
||||||
|
<div className="mx_GroupTile_avatar">
|
||||||
|
<BaseAvatar
|
||||||
|
name={name}
|
||||||
|
idName={this.props.groupId}
|
||||||
|
url={httpUrl}
|
||||||
|
width={avatarHeight}
|
||||||
|
height={avatarHeight} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
if (this.props.draggable) {
|
||||||
|
const avatarClone = avatarElement;
|
||||||
|
avatarElement = (
|
||||||
|
<Droppable droppableId="my-groups-droppable" type="draggable-TagTile">
|
||||||
|
{ (droppableProvided, droppableSnapshot) => (
|
||||||
|
<div ref={droppableProvided.innerRef}>
|
||||||
|
<Draggable
|
||||||
|
key={"GroupTile " + this.props.groupId}
|
||||||
|
draggableId={"GroupTile " + this.props.groupId}
|
||||||
|
index={this.props.groupId}
|
||||||
|
type="draggable-TagTile"
|
||||||
|
>
|
||||||
|
{ (provided, snapshot) => (
|
||||||
|
<div>
|
||||||
|
<div
|
||||||
|
ref={provided.innerRef}
|
||||||
|
{...provided.draggableProps}
|
||||||
|
{...provided.dragHandleProps}
|
||||||
|
>
|
||||||
|
{avatarClone}
|
||||||
|
</div>
|
||||||
|
{ /* Instead of a blank placeholder, use a copy of the avatar itself. */ }
|
||||||
|
{ provided.placeholder ? avatarClone : <div /> }
|
||||||
|
</div>
|
||||||
|
) }
|
||||||
|
</Draggable>
|
||||||
|
</div>
|
||||||
|
) }
|
||||||
|
</Droppable>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// XXX: Use onMouseDown as a workaround for https://github.com/atlassian/react-beautiful-dnd/issues/273
|
// XXX: Use onMouseDown as a workaround for https://github.com/atlassian/react-beautiful-dnd/issues/273
|
||||||
// instead of onClick. Otherwise we experience https://github.com/vector-im/riot-web/issues/6156
|
// instead of onClick. Otherwise we experience https://github.com/vector-im/riot-web/issues/6156
|
||||||
return <AccessibleButton className="mx_GroupTile" onMouseDown={this.onMouseDown} onClick={nop}>
|
return <AccessibleButton className="mx_GroupTile" onMouseDown={this.onMouseDown} onClick={nop}>
|
||||||
<Droppable droppableId="my-groups-droppable" type="draggable-TagTile">
|
{ avatarElement }
|
||||||
{ (droppableProvided, droppableSnapshot) => (
|
|
||||||
<div ref={droppableProvided.innerRef}>
|
|
||||||
<Draggable
|
|
||||||
key={"GroupTile " + this.props.groupId}
|
|
||||||
draggableId={"GroupTile " + this.props.groupId}
|
|
||||||
index={this.props.groupId}
|
|
||||||
type="draggable-TagTile"
|
|
||||||
>
|
|
||||||
{ (provided, snapshot) => (
|
|
||||||
<div>
|
|
||||||
<div
|
|
||||||
ref={provided.innerRef}
|
|
||||||
{...provided.draggableProps}
|
|
||||||
{...provided.dragHandleProps}
|
|
||||||
>
|
|
||||||
<div className="mx_GroupTile_avatar">
|
|
||||||
<BaseAvatar
|
|
||||||
name={name}
|
|
||||||
idName={this.props.groupId}
|
|
||||||
url={httpUrl}
|
|
||||||
width={avatarHeight}
|
|
||||||
height={avatarHeight} />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{ /* Instead of a blank placeholder, use a copy of the avatar itself. */ }
|
|
||||||
{ provided.placeholder ?
|
|
||||||
<div className="mx_GroupTile_avatar">
|
|
||||||
<BaseAvatar
|
|
||||||
name={name}
|
|
||||||
idName={this.props.groupId}
|
|
||||||
url={httpUrl}
|
|
||||||
width={avatarHeight}
|
|
||||||
height={avatarHeight} />
|
|
||||||
</div> :
|
|
||||||
<div />
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
) }
|
|
||||||
</Draggable>
|
|
||||||
</div>
|
|
||||||
) }
|
|
||||||
</Droppable>
|
|
||||||
<div className="mx_GroupTile_profile">
|
<div className="mx_GroupTile_profile">
|
||||||
<div className="mx_GroupTile_name">{ name }</div>
|
<div className="mx_GroupTile_name">{ name }</div>
|
||||||
{ descElement }
|
{ descElement }
|
||||||
|
|
|
@ -16,7 +16,6 @@ limitations under the License.
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {_t} from "../../../../../languageHandler";
|
import {_t} from "../../../../../languageHandler";
|
||||||
import {DragDropContext} from "react-beautiful-dnd";
|
|
||||||
import GroupUserSettings from "../../../groups/GroupUserSettings";
|
import GroupUserSettings from "../../../groups/GroupUserSettings";
|
||||||
import MatrixClientPeg from "../../../../../MatrixClientPeg";
|
import MatrixClientPeg from "../../../../../MatrixClientPeg";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
|
@ -42,9 +41,7 @@ export default class FlairUserSettingsTab extends React.Component {
|
||||||
<div className="mx_SettingsTab">
|
<div className="mx_SettingsTab">
|
||||||
<span className="mx_SettingsTab_heading">{_t("Flair")}</span>
|
<span className="mx_SettingsTab_heading">{_t("Flair")}</span>
|
||||||
<div className="mx_SettingsTab_section">
|
<div className="mx_SettingsTab_section">
|
||||||
<DragDropContext>
|
<GroupUserSettings />
|
||||||
<GroupUserSettings />
|
|
||||||
</DragDropContext>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue