import * as React from 'react'; import IPost from '../../interfaces/IPost'; import IPostStatus from '../../interfaces/IPostStatus'; import IBoard from '../../interfaces/IBoard'; import LikeList from './LikeList'; import LikeButton from '../../containers/LikeButton'; import PostBoardSelect from './PostBoardSelect'; import PostStatusSelect from './PostStatusSelect'; import PostBoardLabel from '../shared/PostBoardLabel'; import PostStatusLabel from '../shared/PostStatusLabel'; import Comments from '../../containers/Comments'; import { MutedText } from '../shared/CustomTexts'; import friendlyDate from '../../helpers/friendlyDate'; import { LikesState } from '../../reducers/likesReducer'; import { CommentsState } from '../../reducers/commentsReducer'; import PostUpdateList from './PostUpdateList'; interface Props { postId: number; post: IPost; likes: LikesState; comments: CommentsState; boards: Array; postStatuses: Array; isLoggedIn: boolean; isPowerUser: boolean; userEmail: string; authenticityToken: string; requestPost(postId: number): void; requestLikes(postId: number): void; changePostBoard( postId: number, newBoardId: number, authenticityToken: string, ): void; changePostStatus( postId: number, newPostStatusId: number, authenticityToken: string, ): void; } class PostP extends React.Component { componentDidMount() { this.props.requestPost(this.props.postId); this.props.requestLikes(this.props.postId); } render() { const { post, likes, comments, boards, postStatuses, isLoggedIn, isPowerUser, userEmail, authenticityToken, changePostBoard, changePostStatus, } = this.props; return (
comment.isPostUpdate === true)} areLoading={comments.areLoading} error={comments.error} />
like.email === userEmail) ? 1 : 0} isLoggedIn={isLoggedIn} authenticityToken={authenticityToken} />

{post.title}

{ isPowerUser && post ? Edit : null }
{ isPowerUser && post ?
changePostBoard(post.id, newBoardId, authenticityToken) } /> changePostStatus(post.id, newPostStatusId, authenticityToken) } />
:
board.id === post.boardId)} /> postStatus.id === post.postStatusId)} />
}

{post.description}

{friendlyDate(post.createdAt)}
); } } export default PostP;