mirror of
https://github.com/wassname/talk.git
synced 2026-07-25 13:30:59 +08:00
Working featured comments on the admin side
This commit is contained in:
@@ -93,8 +93,10 @@ class Comment extends React.Component {
|
||||
<Slot
|
||||
data={props.data}
|
||||
root={props.root}
|
||||
comment={comment}
|
||||
asset={comment.asset}
|
||||
fill="adminCommentInfoBar"
|
||||
comment={comment} />
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,9 +2,6 @@ import React from 'react';
|
||||
import cn from 'classnames';
|
||||
import styles from './ModTag.css';
|
||||
import {t} from 'plugin-api/beta/client/services';
|
||||
import {isTagged} from 'plugin-api/beta/client/utils';
|
||||
|
||||
// import {isTagged} from 'plugin-api/beta/client/utils';
|
||||
import {Icon} from 'plugin-api/beta/client/components/ui';
|
||||
|
||||
export default class ModTag extends React.Component {
|
||||
@@ -32,19 +29,21 @@ export default class ModTag extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
const isFeatured = isTagged(this.props.comment.tags, 'FEATURED');
|
||||
const {alreadyTagged, deleteTag, postTag} = this.props;
|
||||
|
||||
return isFeatured ? (
|
||||
return alreadyTagged ? (
|
||||
<span className={cn(styles.tag, styles.featured)}
|
||||
onClick={deleteTag}
|
||||
onMouseEnter={this.handleMouseEnter}
|
||||
onMouseLeave={this.handleMouseLeave }>
|
||||
onMouseLeave={this.handleMouseLeave} >
|
||||
<Icon name="star_outline" className={cn(styles.tagIcon)} />
|
||||
{!this.state.on ? t('talk-plugin-featured-comments.featured') : t('talk-plugin-featured-comments.un_feature')}
|
||||
</span>
|
||||
) : (
|
||||
<span className={cn(styles.tag, {[styles.featured]: isFeatured})}>
|
||||
<span className={cn(styles.tag, {[styles.featured]: alreadyTagged})}
|
||||
onClick={postTag} >
|
||||
<Icon name="star_outline" className={cn(styles.tagIcon)} />
|
||||
{isFeatured ? t('talk-plugin-featured-comments.featured') : t('talk-plugin-featured-comments.feature')}
|
||||
{alreadyTagged ? t('talk-plugin-featured-comments.featured') : t('talk-plugin-featured-comments.feature')}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,15 +1,4 @@
|
||||
import {gql} from 'react-apollo';
|
||||
import ModTag from '../components/ModTag';
|
||||
import {withFragments} from 'plugin-api/beta/client/hocs';
|
||||
import {withTags} from 'plugin-api/beta/client/hocs';
|
||||
|
||||
export default withFragments({
|
||||
comment: gql`
|
||||
fragment TalkFeaturedComments_ModTab_comment on Comment {
|
||||
tags {
|
||||
tag {
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
})(ModTag);
|
||||
export default withTags('featured')(ModTag);
|
||||
|
||||
Reference in New Issue
Block a user