mirror of
https://github.com/wassname/talk.git
synced 2026-08-05 13:30:26 +08:00
excludeIf no featured tags
This commit is contained in:
@@ -3,7 +3,6 @@ import cn from 'classnames';
|
||||
import styles from './Tag.css';
|
||||
import Tooltip from './Tooltip';
|
||||
import {t} from 'plugin-api/beta/client/services';
|
||||
import {isTagged} from 'plugin-api/beta/client/utils';
|
||||
|
||||
export default class Tag extends React.Component {
|
||||
constructor() {
|
||||
@@ -35,14 +34,10 @@ export default class Tag extends React.Component {
|
||||
<div className={styles.noSelect} onMouseEnter={this.showTooltip}
|
||||
onMouseLeave={this.hideTooltip} onTouchStart={this.showTooltip}
|
||||
onTouchEnd={this.hideTooltip}>
|
||||
{
|
||||
isTagged(this.props.comment.tags, 'FEATURED') ? (
|
||||
<span
|
||||
className={cn(styles.tag, styles.noSelect, {[styles.on]: tooltip})}>
|
||||
{t('talk-plugin-featured-comments.featured')}
|
||||
</span>
|
||||
) : null
|
||||
}
|
||||
<span
|
||||
className={cn(styles.tag, styles.noSelect, {[styles.on]: tooltip})}>
|
||||
{t('talk-plugin-featured-comments.featured')}
|
||||
</span>
|
||||
{tooltip && <Tooltip className={styles.tooltip} />}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
import {gql} from 'react-apollo';
|
||||
import {compose, gql} from 'react-apollo';
|
||||
import Tag from '../components/Tag';
|
||||
import {withFragments} from 'plugin-api/beta/client/hocs';
|
||||
import {isTagged} from 'plugin-api/beta/client/utils';
|
||||
import {withFragments, excludeIf} from 'plugin-api/beta/client/hocs';
|
||||
|
||||
export default withFragments({
|
||||
comment: gql`
|
||||
fragment TalkFeaturedComments_Tag_comment on Comment {
|
||||
tags {
|
||||
tag {
|
||||
name
|
||||
export default compose(
|
||||
withFragments({
|
||||
comment: gql`
|
||||
fragment TalkFeaturedComments_Tag_comment on Comment {
|
||||
tags {
|
||||
tag {
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
})(Tag);
|
||||
`}),
|
||||
excludeIf((props) => !isTagged(props.comment.tags, 'FEATURED'))
|
||||
)(Tag);
|
||||
|
||||
Reference in New Issue
Block a user