mirror of https://framagit.org/tykayn/mastodon.git
52 lines
1.2 KiB
JavaScript
52 lines
1.2 KiB
JavaScript
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
import ConversationItem from './conversation-item';
|
|
import { mockRecipient, mockRecipient2 } from './mocks/mockConversation';
|
|
|
|
export default class ConversationStack extends React.Component {
|
|
|
|
static propTypes = {
|
|
conversations: PropTypes.array,
|
|
};
|
|
|
|
static defaultProps = {
|
|
conversations: [mockRecipient, mockRecipient2],
|
|
};
|
|
|
|
openConversationWith(account) {
|
|
console.log('openConversationWith name', account.username);
|
|
}
|
|
|
|
render() {
|
|
let list = this.props.conversations.map(recipient => {
|
|
|
|
console.log('recipient', recipient);
|
|
recipient = recipient[0];
|
|
return (
|
|
<li
|
|
className='conversation-item-wrapper'
|
|
key={'wrapper' + recipient.id}
|
|
>
|
|
<ConversationItem
|
|
recipient={recipient}
|
|
messages={recipient.messages}
|
|
key={'ConversationItem_' + recipient.id}
|
|
onClick={this.openConversationWith}
|
|
/>
|
|
</li >
|
|
);
|
|
|
|
},
|
|
)
|
|
;
|
|
return (
|
|
<ul className='stack conversations_list'>
|
|
{list}
|
|
</ul >
|
|
|
|
);
|
|
};
|
|
|
|
}
|