mirror of
https://github.com/wassname/talk.git
synced 2026-08-12 12:30:39 +08:00
Simplify file namings
This commit is contained in:
+5
-5
@@ -1,20 +1,20 @@
|
||||
import React from 'react';
|
||||
import cn from 'classnames';
|
||||
import styles from './FeaturedButton.css';
|
||||
import styles from './Button.css';
|
||||
import {name} from '../../package.json';
|
||||
import {can} from 'plugin-api/beta/client/services';
|
||||
import {withTags} from 'plugin-api/beta/client/hocs';
|
||||
import {Icon} from 'plugin-api/beta/client/components/ui';
|
||||
|
||||
const FeaturedButton = (props) => {
|
||||
const Button = (props) => {
|
||||
const {alreadyTagged, deleteTag, postTag, user} = props;
|
||||
|
||||
return can(user, 'MODERATE_COMMENTS') ? (
|
||||
<button
|
||||
<button
|
||||
className={cn([name, styles.button, {[styles.featured] : alreadyTagged}])}
|
||||
onClick={alreadyTagged ? deleteTag : postTag} >
|
||||
|
||||
{alreadyTagged ?
|
||||
{alreadyTagged ?
|
||||
<Icon name="star" className={styles.icon} /> :
|
||||
<Icon name="star_border" className={styles.icon} />
|
||||
}
|
||||
@@ -23,5 +23,5 @@ const FeaturedButton = (props) => {
|
||||
) : null ;
|
||||
};
|
||||
|
||||
export default withTags('featured')(FeaturedButton);
|
||||
export default withTags('featured')(Button);
|
||||
|
||||
+3
-3
@@ -1,12 +1,12 @@
|
||||
import React from 'react';
|
||||
import cn from 'classnames';
|
||||
import styles from './FeaturedComment.css';
|
||||
import styles from './Comment.css';
|
||||
import {name} from '../../package.json';
|
||||
import {timeago} from 'coral-framework/services/i18n';
|
||||
import {Slot} from 'plugin-api/beta/client/components';
|
||||
import {Icon} from 'plugin-api/beta/client/components/ui';
|
||||
|
||||
class FeaturedComment extends React.Component {
|
||||
class Comment extends React.Component {
|
||||
|
||||
viewComment = () => {
|
||||
this.props.viewComment(this.props.comment.id);
|
||||
@@ -55,4 +55,4 @@ class FeaturedComment extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
export default FeaturedComment;
|
||||
export default Comment;
|
||||
@@ -1,10 +1,10 @@
|
||||
import React from 'react';
|
||||
import FeaturedComment from '../containers/FeaturedComment';
|
||||
import Comment from '../containers/Comment';
|
||||
|
||||
export default ({root, data, asset: {featuredComments, ...asset}, viewComment}) => (
|
||||
<div>
|
||||
{featuredComments.nodes.map((comment) =>
|
||||
<FeaturedComment
|
||||
<Comment
|
||||
key={comment.id}
|
||||
root={root}
|
||||
data={data}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import styles from './FeaturedTag.css';
|
||||
import styles from './Tag.css';
|
||||
import {t} from 'plugin-api/beta/client/services';
|
||||
import {isTagged} from 'plugin-api/beta/client/utils';
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
import {gql} from 'react-apollo';
|
||||
import FeaturedComment from '../components/FeaturedComment';
|
||||
import Comment from '../components/Comment';
|
||||
import {withFragments} from 'plugin-api/beta/client/hocs';
|
||||
import {getSlotFragmentSpreads} from 'plugin-api/beta/client/utils';
|
||||
|
||||
@@ -38,4 +38,4 @@ export default withFragments({
|
||||
${getSlotFragmentSpreads(slots, 'comment')}
|
||||
}
|
||||
`
|
||||
})(FeaturedComment);
|
||||
})(Comment);
|
||||
@@ -3,7 +3,7 @@ import {bindActionCreators} from 'redux';
|
||||
import {compose, gql} from 'react-apollo';
|
||||
import TabPane from '../components/TabPane';
|
||||
import {withFragments} from 'plugin-api/beta/client/hocs';
|
||||
import FeaturedComment from '../containers/FeaturedComment';
|
||||
import Comment from '../containers/Comment';
|
||||
import {getDefinitionName} from 'coral-framework/utils';
|
||||
|
||||
import {viewComment} from 'coral-embed-stream/src/actions/stream';
|
||||
@@ -19,25 +19,25 @@ const enhance = compose(
|
||||
root: gql`
|
||||
fragment TalkFeaturedComments_TabPane_root on RootQuery {
|
||||
__typename
|
||||
...${getDefinitionName(FeaturedComment.fragments.root)}
|
||||
...${getDefinitionName(Comment.fragments.root)}
|
||||
}
|
||||
${FeaturedComment.fragments.root}
|
||||
${Comment.fragments.root}
|
||||
`,
|
||||
asset: gql`
|
||||
fragment TalkFeaturedComments_TabPane_asset on Asset {
|
||||
id
|
||||
featuredComments: comments(tags: ["FEATURED"], excludeIgnored: $excludeIgnored, deep: true) {
|
||||
nodes {
|
||||
...${getDefinitionName(FeaturedComment.fragments.comment)}
|
||||
...${getDefinitionName(Comment.fragments.comment)}
|
||||
}
|
||||
hasNextPage
|
||||
startCursor
|
||||
endCursor
|
||||
}
|
||||
...${getDefinitionName(FeaturedComment.fragments.asset)}
|
||||
...${getDefinitionName(Comment.fragments.asset)}
|
||||
}
|
||||
${FeaturedComment.fragments.comment}
|
||||
${FeaturedComment.fragments.asset}
|
||||
${Comment.fragments.comment}
|
||||
${Comment.fragments.asset}
|
||||
`,
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import Tab from './containers/Tab';
|
||||
import TabPane from './containers/TabPane';
|
||||
import FeaturedTag from './components/FeaturedTag';
|
||||
import FeaturedButton from './components/FeaturedButton';
|
||||
import Tag from './components/Tag';
|
||||
import Button from './components/Button';
|
||||
import translations from './translations.json';
|
||||
import update from 'immutability-helper';
|
||||
|
||||
@@ -13,8 +13,8 @@ export default {
|
||||
slots: {
|
||||
streamTabs: [Tab],
|
||||
streamTabPanes: [TabPane],
|
||||
commentInfoBar: [FeaturedTag],
|
||||
commentReactions: [FeaturedButton]
|
||||
commentInfoBar: [Tag],
|
||||
commentReactions: [Button]
|
||||
},
|
||||
mutations: {
|
||||
IgnoreUser: ({variables}) => ({
|
||||
|
||||
Reference in New Issue
Block a user