comments yo
This commit is contained in:
mgabdev
2020-05-05 01:16:01 -04:00
parent 498f163880
commit 01bb440385
19 changed files with 234 additions and 73 deletions

View File

@@ -21,6 +21,7 @@ class StatusPrepend extends ImmutablePureComponent {
static propTypes = {
intl: PropTypes.object.isRequired,
status: ImmutablePropTypes.map,
isComment: PropTypes.bool,
isFeatured: PropTypes.bool,
isPromoted: PropTypes.bool,
}
@@ -31,15 +32,22 @@ class StatusPrepend extends ImmutablePureComponent {
status,
isFeatured,
isPromoted,
isComment,
} = this.props
if (!status) return null
const isRepost = (status.get('reblog', null) !== null && typeof status.get('reblog') === 'object')
if (!isFeatured && !isPromoted && !isRepost) return null
console.log("isComment:", isComment)
const iconId = isFeatured ? 'pin' : isPromoted ? 'star' : 'repost'
if (!isFeatured && !isPromoted && !isRepost && !isComment) return null
let iconId
if (isFeatured) iconId = 'pin'
else if (isPromoted) iconId = 'star'
else if (isRepost) iconId = 'repost'
else if (isComment) iconId = 'comment'
const containerClasses = CX({
default: 1,
@@ -54,7 +62,7 @@ class StatusPrepend extends ImmutablePureComponent {
<div className={[_s.default, _s.width100PC, _s.flexRow, _s.alignItemsCenter, _s.py5, _s.px15].join(' ')}>
<Icon id={iconId} size='12px' className={[_s.fillSecondary, _s.mr5].join(' ')} />
{
isRepost &&
isRepost && !isComment &&
<div className={[_s.default, _s.flexRow].join(' ')}>
<Text size='small' color='secondary'>
<FormattedMessage
@@ -79,11 +87,34 @@ class StatusPrepend extends ImmutablePureComponent {
</div>
}
{
!isRepost &&
!isRepost && !isComment &&
<Text color='secondary' size='small'>
{intl.formatMessage(isFeatured ? messages.pinned : messages.promoted)}
</Text>
}
{
isComment &&
<Text color='secondary' size='small'>
<FormattedMessage
id='status.commented_on_this'
defaultMessage='{name} commented on this gab'
values={{
name: (
<NavLink
className={[_s.noUnderline, _s.underline_onHover].join(' ')}
to={`/${status.getIn(['account', 'acct'])}`}
>
<Text size='small' color='secondary'>
<bdi>
<span dangerouslySetInnerHTML={{ __html: status.getIn(['account', 'display_name_html']) }} />
</bdi>
</Text>
</NavLink>
)
}}
/>
</Text>
}
</div>
</div>
)