bigbuffet-rw/app/soapbox/features/conversations/index.js

89 lines
2.8 KiB
JavaScript
Raw Normal View History

import PropTypes from 'prop-types';
import React from 'react';
2022-03-21 11:09:01 -07:00
import { defineMessages, injectIntl } from 'react-intl';
import { connect } from 'react-redux';
2022-01-10 14:01:24 -08:00
import { directComposeById } from 'soapbox/actions/compose';
import { mountConversations, unmountConversations, expandConversations } from '../../actions/conversations';
import { connectDirectStream } from '../../actions/streaming';
2022-03-21 11:09:01 -07:00
import { Card, CardBody, Column, Stack, Text } from '../../components/ui';
const messages = defineMessages({
title: { id: 'column.direct', defaultMessage: 'Direct messages' },
searchPlaceholder: { id: 'direct.search_placeholder', defaultMessage: 'Send a message to…' },
2022-03-21 11:09:01 -07:00
body: { id: 'direct.body', defaultMessage: 'A new direct messaging experience will be available soon. Please stay tuned.' },
});
export default @connect()
@injectIntl
class ConversationsTimeline extends React.PureComponent {
static propTypes = {
dispatch: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
hasUnread: PropTypes.bool,
};
componentDidMount() {
const { dispatch } = this.props;
dispatch(mountConversations());
dispatch(expandConversations());
this.disconnect = dispatch(connectDirectStream());
}
componentWillUnmount() {
this.props.dispatch(unmountConversations());
if (this.disconnect) {
this.disconnect();
this.disconnect = null;
}
}
2021-10-14 09:52:12 -07:00
handleSuggestion = accountId => {
this.props.dispatch(directComposeById(accountId));
}
handleLoadMore = maxId => {
this.props.dispatch(expandConversations({ maxId }));
}
render() {
2022-03-21 11:09:01 -07:00
const { intl } = this.props;
return (
2022-03-21 11:09:01 -07:00
<Column label={intl.formatMessage(messages.title)} transparent>
<Card variant='rounded'>
<CardBody>
<Stack space={2}>
<Text size='lg' align='center' weight='bold'>{intl.formatMessage(messages.title)}</Text>
<Text theme='muted' align='center'>{intl.formatMessage(messages.body)}</Text>
</Stack>
</CardBody>
</Card>
</Column>
);
2022-03-21 11:09:01 -07:00
// return (
// <Column label={intl.formatMessage(messages.title)}>
// <ColumnHeader icon='envelope' active={hasUnread} title={intl.formatMessage(messages.title)} />
// <AccountSearch
// placeholder={intl.formatMessage(messages.searchPlaceholder)}
// onSelected={this.handleSuggestion}
// />
// <ConversationsListContainer
// scrollKey='direct_timeline'
// timelineId='direct'
// onLoadMore={this.handleLoadMore}
// emptyMessage={<FormattedMessage id='empty_column.direct' defaultMessage="You don't have any direct messages yet. When you send or receive one, it will show up here." />}
// />
// </Column>
// );
}
}