2017-09-27 02:33:08 +08:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2017-09-27 02:46:00 +08:00
|
|
|
import { MultiselectToolbar } from 'mailspring-component-kit';
|
2017-09-27 02:33:08 +08:00
|
|
|
import InjectsToolbarButtons, { ToolbarRole } from './injects-toolbar-buttons';
|
2016-03-18 00:50:30 +08:00
|
|
|
|
|
|
|
class ThreadListToolbar extends Component {
|
|
|
|
static displayName = 'ThreadListToolbar';
|
|
|
|
|
|
|
|
static propTypes = {
|
|
|
|
items: PropTypes.array,
|
|
|
|
selection: PropTypes.shape({
|
|
|
|
clear: PropTypes.func,
|
|
|
|
}),
|
|
|
|
injectedButtons: PropTypes.element,
|
|
|
|
};
|
|
|
|
|
2016-05-06 13:30:34 +08:00
|
|
|
onClearSelection = () => {
|
2017-09-27 02:33:08 +08:00
|
|
|
this.props.selection.clear();
|
2016-03-18 00:50:30 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
render() {
|
2017-09-27 02:33:08 +08:00
|
|
|
const { injectedButtons, items } = this.props;
|
2016-03-18 00:50:30 +08:00
|
|
|
|
|
|
|
return (
|
|
|
|
<MultiselectToolbar
|
|
|
|
collection="thread"
|
|
|
|
selectionCount={items.length}
|
|
|
|
toolbarElement={injectedButtons}
|
|
|
|
onClearSelection={this.onClearSelection}
|
|
|
|
/>
|
2017-09-27 02:33:08 +08:00
|
|
|
);
|
2016-03-18 00:50:30 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const toolbarProps = {
|
|
|
|
extraRoles: [`ThreadList:${ToolbarRole}`],
|
2017-09-27 02:33:08 +08:00
|
|
|
};
|
2016-03-18 00:50:30 +08:00
|
|
|
|
2017-09-27 02:33:08 +08:00
|
|
|
export default InjectsToolbarButtons(ThreadListToolbar, toolbarProps);
|