import React from 'react' import PropTypes from 'prop-types' import ImmutablePropTypes from 'react-immutable-proptypes' import ImmutablePureComponent from 'react-immutable-pure-component' import { defineMessages, injectIntl } from 'react-intl' import { NavLink } from 'react-router-dom' import { me } from '../initial_state' import Text from './text' import StatusActionBarItem from './status_action_bar_item' import { CX } from '../constants' class StatusActionBar extends ImmutablePureComponent { // updateOnProps = ['status'] handleShareClick = () => { this.props.onShare(this.shareButton, this.props.status) } handleReplyClick = () => { this.props.onReply(this.props.status, null, true) } handleFavoriteClick = () => { this.props.onFavorite(this.props.status) } handleRepostClick = () => { this.props.onRepost(this.props.status) } handleQuoteClick = () => { this.props.onQuote(this.props.status) } openLikesList = () => { this.props.onOpenLikes(this.props.status) } openRepostsList = () => { this.props.onOpenReposts(this.props.status) } setShareButton = (n) => { this.shareButton = n } render() { const { status, intl } = this.props const publicStatus = ['public', 'unlisted'].includes(status.get('visibility')) const replyCount = status.get('replies_count') const repostCount = status.get('reblogs_count') const favoriteCount = status.get('favourites_count') const hasInteractions = favoriteCount > 0 || replyCount > 0 || repostCount > 0 const shouldCondense = ( !!status.get('card') || status.get('media_attachments').size > 0 || !!status.get('quote') ) && !hasInteractions const statusUrl = `/${status.getIn(['account', 'acct'])}/posts/${status.get('id')}` const myStatus = status.getIn(['account', 'id']) === me const containerClasses = CX({ d: 1, px10: 1, mt10: !shouldCondense, mt5: shouldCondense, }) const innerContainerClasses = CX({ d: 1, py2: 1, flexRow: 1, w100PC: 1, borderTop1PX: !shouldCondense, borderColorSecondary: !shouldCondense, mt5: hasInteractions, }) const likeBtnClasses = CX({ d: 1, text: 1, cursorPointer: myStatus, fw400: 1, noUnderline: 1, underline_onHover: myStatus, bgTransparent: 1, mr10: 1, py5: 1, }) const interactionBtnClasses = CX({ d: 1, text: 1, cursorPointer: 1, fw400: 1, noUnderline: 1, underline_onHover: 1, bgTransparent: 1, mr10: 1, py5: 1, }) return (