diff --git a/common/gql/fragmentTypes.json b/common/gql/fragmentTypes.json index 06a04dd997..c6c3290fc5 100644 --- a/common/gql/fragmentTypes.json +++ b/common/gql/fragmentTypes.json @@ -5,117 +5,52 @@ "kind": "INTERFACE", "name": "Node", "possibleTypes": [ - { - "name": "Article" - }, - { - "name": "User" - }, - { - "name": "Tag" - }, - { - "name": "Draft" - }, - { - "name": "Comment" - } + { "name": "Article" }, + { "name": "User" }, + { "name": "Tag" }, + { "name": "Draft" }, + { "name": "Comment" } ] }, { "kind": "INTERFACE", "name": "Connection", "possibleTypes": [ - { - "name": "ArticleConnection" - }, - { - "name": "TagConnection" - }, - { - "name": "UserConnection" - }, - { - "name": "DraftConnection" - }, - { - "name": "AudiodraftConnection" - }, - { - "name": "ReadHistoryConnection" - }, - { - "name": "RecentSearchConnection" - }, - { - "name": "TransactionConnection" - }, - { - "name": "InvitationConnection" - }, - { - "name": "NoticeConnection" - }, - { - "name": "CommentConnection" - }, - { - "name": "SearchResultConnection" - }, - { - "name": "ReportConnection" - } + { "name": "ArticleConnection" }, + { "name": "TagConnection" }, + { "name": "UserConnection" }, + { "name": "DraftConnection" }, + { "name": "AudiodraftConnection" }, + { "name": "ReadHistoryConnection" }, + { "name": "RecentSearchConnection" }, + { "name": "TransactionConnection" }, + { "name": "InvitationConnection" }, + { "name": "NoticeConnection" }, + { "name": "CommentConnection" }, + { "name": "SearchResultConnection" }, + { "name": "ReportConnection" } ] }, { "kind": "INTERFACE", "name": "Notice", "possibleTypes": [ - { - "name": "UserNewFollowerNotice" - }, - { - "name": "ArticlePublishedNotice" - }, - { - "name": "ArticleNewDownstreamNotice" - }, - { - "name": "ArticleNewAppreciationNotice" - }, - { - "name": "ArticleNewSubscriberNotice" - }, - { - "name": "ArticleNewCommentNotice" - }, - { - "name": "ArticleMentionedYouNotice" - }, - { - "name": "SubscribedArticleNewCommentNotice" - }, - { - "name": "UpstreamArticleArchivedNotice" - }, - { - "name": "DownstreamArticleArchivedNotice" - }, - { - "name": "CommentPinnedNotice" - }, - { - "name": "CommentNewReplyNotice" - }, - { - "name": "CommentNewUpvoteNotice" - }, - { - "name": "CommentMentionedYouNotice" - }, - { - "name": "OfficialAnnouncementNotice" - } + { "name": "UserNewFollowerNotice" }, + { "name": "ArticlePublishedNotice" }, + { "name": "ArticleNewDownstreamNotice" }, + { "name": "ArticleNewCollectedNotice" }, + { "name": "ArticleNewAppreciationNotice" }, + { "name": "ArticleNewSubscriberNotice" }, + { "name": "ArticleNewCommentNotice" }, + { "name": "ArticleMentionedYouNotice" }, + { "name": "SubscribedArticleNewCommentNotice" }, + { "name": "UpstreamArticleArchivedNotice" }, + { "name": "DownstreamArticleArchivedNotice" }, + { "name": "CommentPinnedNotice" }, + { "name": "CommentNewReplyNotice" }, + { "name": "CommentNewUpvoteNotice" }, + { "name": "CommentMentionedYouNotice" }, + { "name": "OfficialAnnouncementNotice" } ] } ] diff --git a/components/NoticeDigest/ArticleNewCollectedNotice.tsx b/components/NoticeDigest/ArticleNewCollectedNotice.tsx new file mode 100644 index 0000000000..749c60fa66 --- /dev/null +++ b/components/NoticeDigest/ArticleNewCollectedNotice.tsx @@ -0,0 +1,72 @@ +import classNames from 'classnames' +import gql from 'graphql-tag' + +import { Translate } from '~/components' + +import { ArticleNewCollectedNotice as NoticeType } from './__generated__/ArticleNewCollectedNotice' +import NoticeActorAvatar from './NoticeActorAvatar' +import NoticeActorName from './NoticeActorName' +import NoticeArticle from './NoticeArticle' +import NoticeDate from './NoticeDate' +import styles from './styles.css' + +const ArticleNewCollectedNotice = ({ notice }: { notice: NoticeType }) => { + if (!notice || !notice.actor) { + return null + } + + const avatarWrapClasses = classNames({ + 'avatar-wrap': true + }) + console.log(notice) + + return ( +
+
+ +
+ +
+

+ {' '} + {' '} + {' '} + {' '} + {' '} + {' '} + +

+ + +
+ +
+ ) +} + +ArticleNewCollectedNotice.fragments = { + notice: gql` + fragment ArticleNewCollectedNotice on ArticleNewCollectedNotice { + id + unread + __typename + ...NoticeDate + actor { + ...NoticeActorAvatarUser + ...NoticeActorNameUser + } + collection { + ...NoticeArticle + } + target { + ...NoticeArticle + } + } + ${NoticeActorAvatar.fragments.user} + ${NoticeActorName.fragments.user} + ${NoticeArticle.fragments.article} + ${NoticeDate.fragments.notice} + ` +} + +export default ArticleNewCollectedNotice diff --git a/components/NoticeDigest/index.tsx b/components/NoticeDigest/index.tsx index c28a9187cd..b2312070a7 100644 --- a/components/NoticeDigest/index.tsx +++ b/components/NoticeDigest/index.tsx @@ -3,6 +3,7 @@ import gql from 'graphql-tag' import { DigestNotice } from './__generated__/DigestNotice' import ArticleMentionedYouNotice from './ArticleMentionedYouNotice' import ArticleNewAppreciationNotice from './ArticleNewAppreciationNotice' +import ArticleNewCollectedNotice from './ArticleNewCollectedNotice' import ArticleNewCommentNotice from './ArticleNewCommentNotice' import ArticleNewDownstreamNotice from './ArticleNewDownstreamNotice' import ArticleNewSubscriberNotice from './ArticleNewSubscriberNotice' @@ -29,6 +30,9 @@ const fragments = { ... on ArticleNewDownstreamNotice { ...ArticleNewDownstreamNotice } + ... on ArticleNewCollectedNotice { + ...ArticleNewCollectedNotice + } ... on ArticleNewAppreciationNotice { ...ArticleNewAppreciationNotice } @@ -69,6 +73,7 @@ const fragments = { ${ArticleNewAppreciationNotice.fragments.notice} ${ArticleNewCommentNotice.fragments.notice} ${ArticleNewDownstreamNotice.fragments.notice} + ${ArticleNewCollectedNotice.fragments.notice} ${ArticleNewSubscriberNotice.fragments.notice} ${ArticlePublishedNotice.fragments.notice} ${ArticleMentionedYouNotice.fragments.notice} @@ -92,6 +97,8 @@ const FeedDigest = ({ notice }: { notice: DigestNotice }) => { return case 'ArticleNewDownstreamNotice': return + case 'ArticleNewCollectedNotice': + return case 'ArticleNewSubscriberNotice': return case 'ArticlePublishedNotice': diff --git a/schema.json b/schema.json index e926a7dd3c..fe4a4677b0 100644 --- a/schema.json +++ b/schema.json @@ -5105,6 +5105,11 @@ "name": "ArticleNewDownstreamNotice", "ofType": null }, + { + "kind": "OBJECT", + "name": "ArticleNewCollectedNotice", + "ofType": null + }, { "kind": "OBJECT", "name": "ArticleNewAppreciationNotice", @@ -12683,6 +12688,111 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "OBJECT", + "name": "ArticleNewCollectedNotice", + "description": "", + "fields": [ + { + "name": "id", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "unread", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "actor", + "description": "", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "collection", + "description": "", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Article", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "target", + "description": "", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Article", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Notice", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, { "kind": "OBJECT", "name": "ArticleNewAppreciationNotice", diff --git a/views/ArticleDetail/Collection/index.tsx b/views/ArticleDetail/Collection/index.tsx index 1fb674bbb3..8b47946344 100644 --- a/views/ArticleDetail/Collection/index.tsx +++ b/views/ArticleDetail/Collection/index.tsx @@ -299,7 +299,7 @@ const CollectionEditingList = ({ window.dispatchEvent( new CustomEvent('addToast', { detail: { - color: 'white', + color: 'green', content: translate({ zh_hant: '關聯已更新', zh_hans: '关联已更新',