// @flow import * as React from 'react'; import compose from 'recompose/compose'; import { connect } from 'react-redux'; import { withRouter } from 'react-router'; import Header from './header'; import getThreadLink from 'src/helpers/get-thread-link'; import type { ThreadInfoType } from 'shared/graphql/fragments/thread/threadInfo'; import type { Dispatch } from 'redux'; import { InboxThreadItem, InboxLinkWrapper, InboxThreadContent, ThreadTitle, ThreadSnippet, Column, AvatarLink, CommunityAvatarLink, } from './style'; import { UserAvatar, CommunityAvatar } from 'src/components/avatar'; import ThreadActivity from './activity'; import { ErrorBoundary } from 'src/components/error'; import { withCurrentUser } from 'src/components/withCurrentUser'; import getSnippet from 'shared/clients/draft-js/utils/getSnippet'; import truncate from 'shared/truncate'; type Props = { active: boolean, dispatch: Dispatch, history: Object, location: Object, match: Object, staticContext: ?string, data: ThreadInfoType, viewContext?: | ?'inbox' | 'communityInbox' | 'communityProfile' | 'channelInbox' | 'channelProfile' | 'userProfile' | 'userProfileReplies', currentUser: ?Object, }; class InboxThread extends React.Component { render() { const { data: thread, active, viewContext = null, currentUser, } = this.props; return ( {viewContext !== 'userProfile' && viewContext !== 'userProfileReplies' && ( theme.brand.alt : null} user={thread.author.user} size={40} /> )} {(viewContext === 'userProfile' || viewContext === 'userProfileReplies') && ( )}
{truncate(thread.content.title, 80)} {getSnippet(JSON.parse(thread.content.body))} ); } } export default compose( withRouter, withCurrentUser, connect() )(InboxThread);