archiving kind of works but buggy

This commit is contained in:
or-else
2019-02-03 12:48:47 +03:00
parent 7e30c2acc6
commit fc96d200ed
15 changed files with 308 additions and 130 deletions
+28
View File
@@ -0,0 +1,28 @@
// A panel included into a list of contacts with an action text.
import React from 'react';
import { injectIntl } from 'react-intl';
class ContactAction extends React.PureComponent {
constructor(props) {
super(props);
this.handleClick = this.handleClick.bind(this);
}
handleClick(e) {
e.preventDefault();
e.stopPropagation();
this.props.onAction(this.props.action);
}
render() {
const {formatMessage} = this.props.intl;
return (
<li onClick={this.handleClick}>
<div className="action-text">{formatMessage(this.props.title, this.props.values)}</div>
</li>
);
}
};
export default injectIntl(ContactAction);
+6 -1
View File
@@ -31,7 +31,12 @@ class ContactList extends React.Component {
this.props.contacts.map((c) => {
if (c.action) {
// Action item
contactNodes.push(<ContactAction title={c.title} action={c.action} />);
contactNodes.push(
<ContactAction
title={c.title} action={c.action} values={c.values}
key={c.action}
onAction={this.props.onAction}
/>);
} else {
// Normal contact
const key = c.topic ? c.topic : c.user;