Remove sketch from collection view page
This commit is contained in:
parent
4c5e62bce8
commit
45dbb8ec8b
1 changed files with 9 additions and 12 deletions
|
@ -153,10 +153,10 @@ class CollectionItemRowBase extends React.Component {
|
||||||
this.props.showShareModal(this.props.collection.id, this.props.collection.name, this.props.username);
|
this.props.showShareModal(this.props.collection.id, this.props.collection.name, this.props.username);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSketchDelete = () => {
|
handleSketchRemove = () => {
|
||||||
this.closeAll();
|
this.closeAll();
|
||||||
if (window.confirm(`Are you sure you want to delete "${this.props.collection.name}"?`)) {
|
if (window.confirm(`Are you sure you want to remove "${this.props.item.project.name}" from this collection?`)) {
|
||||||
this.props.deleteProject(this.props.collection.id);
|
this.props.removeFromCollection(this.props.collection.id, this.props.item.project.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,11 +185,11 @@ class CollectionItemRowBase extends React.Component {
|
||||||
<li>
|
<li>
|
||||||
<button
|
<button
|
||||||
className="sketch-list__action-option"
|
className="sketch-list__action-option"
|
||||||
onClick={this.handleSketchDelete}
|
onClick={this.handleSketchRemove}
|
||||||
onBlur={this.onBlurComponent}
|
onBlur={this.onBlurComponent}
|
||||||
onFocus={this.onFocusComponent}
|
onFocus={this.onFocusComponent}
|
||||||
>
|
>
|
||||||
Delete
|
Remove from Collection
|
||||||
</button>
|
</button>
|
||||||
</li>}
|
</li>}
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -218,12 +218,7 @@ class CollectionItemRowBase extends React.Component {
|
||||||
</th>
|
</th>
|
||||||
<td>{format(new Date(item.createdAt), 'MMM D, YYYY h:mm A')}</td>
|
<td>{format(new Date(item.createdAt), 'MMM D, YYYY h:mm A')}</td>
|
||||||
<td>{sketchOwnerUsername}</td>
|
<td>{sketchOwnerUsername}</td>
|
||||||
{/*
|
|
||||||
<td>{format(new Date(item.createdAt), 'MMM D, YYYY h:mm A')}</td>
|
|
||||||
<td>{format(new Date(itm.updatedAt), 'MMM D, YYYY h:mm A')}</td>
|
|
||||||
<td>{(collection.items || []).length}</td>
|
|
||||||
<td>{dropdown}</td>
|
<td>{dropdown}</td>
|
||||||
*/}
|
|
||||||
</tr>);
|
</tr>);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -235,6 +230,7 @@ CollectionItemRowBase.propTypes = {
|
||||||
}).isRequired,
|
}).isRequired,
|
||||||
item: PropTypes.shape({
|
item: PropTypes.shape({
|
||||||
project: PropTypes.shape({
|
project: PropTypes.shape({
|
||||||
|
id: PropTypes.string.isRequired,
|
||||||
name: PropTypes.string.isRequired,
|
name: PropTypes.string.isRequired,
|
||||||
}).isRequired,
|
}).isRequired,
|
||||||
}).isRequired,
|
}).isRequired,
|
||||||
|
@ -243,7 +239,7 @@ CollectionItemRowBase.propTypes = {
|
||||||
username: PropTypes.string,
|
username: PropTypes.string,
|
||||||
authenticated: PropTypes.bool.isRequired
|
authenticated: PropTypes.bool.isRequired
|
||||||
}).isRequired,
|
}).isRequired,
|
||||||
deleteProject: PropTypes.func.isRequired,
|
removeFromCollection: PropTypes.func.isRequired,
|
||||||
showShareModal: PropTypes.func.isRequired,
|
showShareModal: PropTypes.func.isRequired,
|
||||||
cloneProject: PropTypes.func.isRequired,
|
cloneProject: PropTypes.func.isRequired,
|
||||||
exportProjectAsZip: PropTypes.func.isRequired,
|
exportProjectAsZip: PropTypes.func.isRequired,
|
||||||
|
@ -251,7 +247,7 @@ CollectionItemRowBase.propTypes = {
|
||||||
};
|
};
|
||||||
|
|
||||||
function mapDispatchToPropsSketchListRow(dispatch) {
|
function mapDispatchToPropsSketchListRow(dispatch) {
|
||||||
return bindActionCreators(Object.assign({}, ProjectActions, IdeActions), dispatch);
|
return bindActionCreators(Object.assign({}, CollectionsActions, ProjectActions, IdeActions), dispatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
const CollectionItemRow = connect(null, mapDispatchToPropsSketchListRow)(CollectionItemRowBase);
|
const CollectionItemRow = connect(null, mapDispatchToPropsSketchListRow)(CollectionItemRowBase);
|
||||||
|
@ -455,6 +451,7 @@ class Collection extends React.Component {
|
||||||
item={item}
|
item={item}
|
||||||
user={this.props.user}
|
user={this.props.user}
|
||||||
username={this.getUsername()}
|
username={this.getUsername()}
|
||||||
|
collection={this.props.collection}
|
||||||
/>))}
|
/>))}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
Loading…
Reference in a new issue