Updated StatusActionBar "like" to only open likes list for own statuses and comments
• Updated: - StatusActionBar "like" to only open likes list for own statuses and comments
This commit is contained in:
parent
c0aa3dfb92
commit
c4c9dc521b
@ -3,6 +3,7 @@ import { NavLink } from 'react-router-dom'
|
||||
import { defineMessages, injectIntl } from 'react-intl'
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes'
|
||||
import ImmutablePureComponent from 'react-immutable-pure-component'
|
||||
import { me } from '../initial_state'
|
||||
import Button from './button'
|
||||
import DisplayName from './display_name'
|
||||
import DotTextSeperator from './dot_text_seperator'
|
||||
@ -56,6 +57,7 @@ class CommentHeader extends ImmutablePureComponent {
|
||||
|
||||
const statusUrl = `/${status.getIn(['account', 'acct'])}/posts/${status.get('id')}`;
|
||||
const isOwner = ancestorAccountId === status.getIn(['account', 'id'])
|
||||
const myComment = status.getIn(['account', 'id']) === me
|
||||
|
||||
return (
|
||||
<div className={[_s.default, _s.alignItemsStart, _s.py2, _s.maxWidth100PC, _s.flexGrow1].join(' ')}>
|
||||
@ -127,11 +129,11 @@ class CommentHeader extends ImmutablePureComponent {
|
||||
<DotTextSeperator />
|
||||
<Button
|
||||
isText
|
||||
underlineOnHover
|
||||
underlineOnHover={myComment}
|
||||
backgroundColor='none'
|
||||
color='tertiary'
|
||||
className={_s.ml5}
|
||||
onClick={this.openLikesList}
|
||||
onClick={myComment ? this.openLikesList : undefined}
|
||||
>
|
||||
<Text size='extraSmall' color='inherit'>
|
||||
{intl.formatMessage(messages.likesLabel, {
|
||||
|
@ -2,7 +2,10 @@ 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 { compactMode } from '../initial_state'
|
||||
import {
|
||||
me,
|
||||
compactMode,
|
||||
} from '../initial_state'
|
||||
import Text from './text'
|
||||
import StatusActionBarItem from './status_action_bar_item'
|
||||
import { CX } from '../constants'
|
||||
@ -84,6 +87,7 @@ class StatusActionBar extends ImmutablePureComponent {
|
||||
) && !hasInteractions
|
||||
|
||||
const statusUrl = `/${status.getIn(['account', 'acct'])}/posts/${status.get('id')}`
|
||||
const myStatus = status.getIn(['account', 'id']) === me
|
||||
|
||||
const containerClasses = CX({
|
||||
default: 1,
|
||||
@ -102,6 +106,18 @@ class StatusActionBar extends ImmutablePureComponent {
|
||||
mt5: hasInteractions && !compactMode,
|
||||
})
|
||||
|
||||
const likeBtnClasses = CX({
|
||||
default: 1,
|
||||
text: 1,
|
||||
cursorPointer: myStatus,
|
||||
fontWeightNormal: 1,
|
||||
noUnderline: 1,
|
||||
underline_onHover: myStatus,
|
||||
bgTransparent: 1,
|
||||
mr10: 1,
|
||||
py5: 1,
|
||||
})
|
||||
|
||||
const interactionBtnClasses = CX({
|
||||
default: 1,
|
||||
text: 1,
|
||||
@ -121,7 +137,11 @@ class StatusActionBar extends ImmutablePureComponent {
|
||||
<div className={[_s.default, _s.flexRow, _s.alignItemsEnd, _s.px5].join(' ')}>
|
||||
{
|
||||
favoriteCount > 0 &&
|
||||
<button className={interactionBtnClasses} onClick={this.openLikesList}>
|
||||
<button
|
||||
className={likeBtnClasses}
|
||||
onClick={this.openLikesList}
|
||||
disabled={!myStatus}
|
||||
>
|
||||
<Text color='secondary' size='small'>
|
||||
{intl.formatMessage(messages.likesLabel, {
|
||||
number: favoriteCount,
|
||||
|
Loading…
x
Reference in New Issue
Block a user