diff --git a/components/Thumbnail.tsx b/components/Thumbnail.tsx index 686b781e..9fb5d12b 100644 --- a/components/Thumbnail.tsx +++ b/components/Thumbnail.tsx @@ -1,6 +1,7 @@ import gql from 'graphql-tag'; import { t } from 'ttag'; import { makeStyles } from '@material-ui/core/styles'; +import { ThumbnailArticleDataFragment } from 'typegen/graphql'; import cx from 'clsx'; import { ellipsis } from 'lib/text'; @@ -12,12 +13,15 @@ const useStyles = makeStyles(() => ({ }, })); -/** - * - * @param {ThumbnailArticleData} props.article - * @param {string} props.className - for replaced elements like image and video - */ -function Thumbnail({ article, className }) { +type Props = { + article: ThumbnailArticleDataFragment; + className?: string; +}; + +function Thumbnail({ + article, + className /* for replaced elements like image and video */, +}: Props) { const classes = useStyles(); const thumbnailCls = cx(classes.thumbnail, className); diff --git a/typegen/gql.ts b/typegen/gql.ts index 064d5989..3282a961 100644 --- a/typegen/gql.ts +++ b/typegen/gql.ts @@ -13,7 +13,8 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/ * Therefore it is highly recommended to use the babel-plugin for production. */ const documents = { - "\n fragment CooccurrenceSectionData on Cooccurrence {\n createdAt\n articles {\n id\n articleType\n text\n }\n }\n ": types.CooccurrenceSectionDataFragmentDoc, + "\n fragment CooccurrenceSectionData on Cooccurrence {\n createdAt\n articles {\n id\n articleType\n text\n ...ThumbnailArticleData\n }\n }\n \n ": types.CooccurrenceSectionDataFragmentDoc, + "\n fragment ThumbnailArticleData on Article {\n articleType\n text\n thumbnailUrl: attachmentUrl(variant: THUMBNAIL)\n }\n ": types.ThumbnailArticleDataFragmentDoc, "\n fragment HighlightFields on Highlights {\n text\n reference\n hyperlinks {\n title\n summary\n }\n }\n": types.HighlightFieldsFragmentDoc, }; @@ -34,7 +35,11 @@ export function graphql(source: string): unknown; /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function graphql(source: "\n fragment CooccurrenceSectionData on Cooccurrence {\n createdAt\n articles {\n id\n articleType\n text\n }\n }\n "): (typeof documents)["\n fragment CooccurrenceSectionData on Cooccurrence {\n createdAt\n articles {\n id\n articleType\n text\n }\n }\n "]; +export function graphql(source: "\n fragment CooccurrenceSectionData on Cooccurrence {\n createdAt\n articles {\n id\n articleType\n text\n ...ThumbnailArticleData\n }\n }\n \n "): (typeof documents)["\n fragment CooccurrenceSectionData on Cooccurrence {\n createdAt\n articles {\n id\n articleType\n text\n ...ThumbnailArticleData\n }\n }\n \n "]; +/** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function graphql(source: "\n fragment ThumbnailArticleData on Article {\n articleType\n text\n thumbnailUrl: attachmentUrl(variant: THUMBNAIL)\n }\n "): (typeof documents)["\n fragment ThumbnailArticleData on Article {\n articleType\n text\n thumbnailUrl: attachmentUrl(variant: THUMBNAIL)\n }\n "]; /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ diff --git a/typegen/graphql.ts b/typegen/graphql.ts index 581c09dd..a3f80a6e 100644 --- a/typegen/graphql.ts +++ b/typegen/graphql.ts @@ -167,6 +167,8 @@ export type Article = Node & { attachmentUrl?: Maybe; /** Number of normal article categories */ categoryCount: Scalars['Int']; + /** Transcript contributors of the article */ + contributors: Array; cooccurrences?: Maybe>; /** May be null for legacy articles */ createdAt?: Maybe; @@ -186,6 +188,8 @@ export type Article = Node & { stats?: Maybe>>; status: ReplyRequestStatusEnum; text?: Maybe; + /** Time when the article was last transcribed */ + transcribedAt?: Maybe; updatedAt?: Maybe; /** The user submitted this article */ user?: Maybe; @@ -624,6 +628,8 @@ export type Reply = Node & { reference?: Maybe; /** Replies that has similar text or references of this current reply */ similarReplies: ReplyConnection; + /** The status of this reply, calculated from its author and article replies. */ + status: ArticleReplyStatusEnum; text?: Maybe; type: ReplyTypeEnum; /** The user submitted this reply version */ @@ -700,6 +706,15 @@ export enum AttachmentVariantEnum { Thumbnail = 'THUMBNAIL' } +export type Contributor = { + __typename?: 'Contributor'; + appId: Scalars['String']; + updatedAt?: Maybe; + /** The user who contributed to this article. */ + user?: Maybe; + userId: Scalars['String']; +}; + export type Cooccurrence = Node & { __typename?: 'Cooccurrence'; appId: Scalars['String']; @@ -1056,6 +1071,8 @@ export type ListArticleFilter = { selfOnly?: InputMaybe; /** Returns only articles with the specified statuses */ statuses?: InputMaybe>; + /** Show only articles with(out) article transcript contributed by specified user */ + transcribedBy?: InputMaybe; /** Specifies how the transcript of `mediaUrl` can be used to search. Can only specify `transcript` when `mediaUrl` is specified. */ transcript?: InputMaybe; /** Show only articles created by the specific user. */ @@ -1067,8 +1084,8 @@ export type ListArticleFilter = { export type UserAndExistInput = { /** * - * When true (or not specified), return only entries with the specified user's involvement. - * When false, return only entries that the specified user did not involve. + * When true (or not specified), return only entries with the specified user's involvement. + * When false, return only entries that the specified user did not involve. * */ exists?: InputMaybe; @@ -1460,9 +1477,12 @@ export type MutationResult = { id?: Maybe; }; -export type CooccurrenceSectionDataFragment = { __typename?: 'Cooccurrence', createdAt: string, articles: Array<{ __typename?: 'Article', id: string, articleType: ArticleTypeEnum, text?: string | null }> }; +export type CooccurrenceSectionDataFragment = { __typename?: 'Cooccurrence', createdAt: string, articles: Array<{ __typename?: 'Article', id: string, articleType: ArticleTypeEnum, text?: string | null, thumbnailUrl?: string | null }> }; + +export type ThumbnailArticleDataFragment = { __typename?: 'Article', articleType: ArticleTypeEnum, text?: string | null, thumbnailUrl?: string | null }; export type HighlightFieldsFragment = { __typename?: 'Highlights', text?: string | null, reference?: string | null, hyperlinks?: Array<{ __typename?: 'Hyperlink', title?: string | null, summary?: string | null } | null> | null }; -export const CooccurrenceSectionDataFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CooccurrenceSectionData"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Cooccurrence"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"articles"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"articleType"}},{"kind":"Field","name":{"kind":"Name","value":"text"}}]}}]}}]} as unknown as DocumentNode; +export const ThumbnailArticleDataFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ThumbnailArticleData"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Article"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"articleType"}},{"kind":"Field","name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"thumbnailUrl"},"name":{"kind":"Name","value":"attachmentUrl"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"variant"},"value":{"kind":"EnumValue","value":"THUMBNAIL"}}]}]}}]} as unknown as DocumentNode; +export const CooccurrenceSectionDataFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CooccurrenceSectionData"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Cooccurrence"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"articles"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"articleType"}},{"kind":"Field","name":{"kind":"Name","value":"text"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"ThumbnailArticleData"}}]}}]}},...ThumbnailArticleDataFragmentDoc.definitions]} as unknown as DocumentNode; export const HighlightFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"HighlightFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Highlights"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"text"}},{"kind":"Field","name":{"kind":"Name","value":"reference"}},{"kind":"Field","name":{"kind":"Name","value":"hyperlinks"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"summary"}}]}}]}}]} as unknown as DocumentNode; \ No newline at end of file