diff options
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/CommentForm/CommentForm.tsx | 21 | ||||
| -rw-r--r-- | src/components/PostHeader/PostHeader.tsx | 11 | ||||
| -rw-r--r-- | src/components/PostPreview/PostPreview.tsx | 6 |
3 files changed, 20 insertions, 18 deletions
diff --git a/src/components/CommentForm/CommentForm.tsx b/src/components/CommentForm/CommentForm.tsx index 988468c..b2d538f 100644 --- a/src/components/CommentForm/CommentForm.tsx +++ b/src/components/CommentForm/CommentForm.tsx @@ -2,7 +2,7 @@ import { ButtonSubmit } from '@components/Buttons'; import { Form, FormItem, Input, TextArea } from '@components/Form'; import Notice from '@components/Notice/Notice'; import { t } from '@lingui/macro'; -import { createComment } from '@services/graphql/comments'; +import { createComment } from '@services/graphql/mutations'; import { useState } from 'react'; const CommentForm = ({ @@ -30,15 +30,16 @@ const CommentForm = ({ e.preventDefault(); if (name && email && message && articleId) { - const createdComment = await createComment( - name, - email, - website, - message, - parentId, - articleId, - 'createComment' - ); + const data = { + author: name, + authorEmail: email, + authorUrl: website, + content: message, + parent: parentId, + commentOn: articleId, + mutationId: 'createComment', + }; + const createdComment = await createComment(data); if (createdComment.success) setIsSuccess(true); if (isSuccess) { diff --git a/src/components/PostHeader/PostHeader.tsx b/src/components/PostHeader/PostHeader.tsx index 5c5aff4..3ee6705 100644 --- a/src/components/PostHeader/PostHeader.tsx +++ b/src/components/PostHeader/PostHeader.tsx @@ -1,5 +1,6 @@ import { t } from '@lingui/macro'; -import { ArticleAuthor, ArticleDates } from '@ts/types/articles'; +import { Dates } from '@ts/types/app'; +import { ArticleAuthor } from '@ts/types/articles'; import { ThematicPreview } from '@ts/types/taxonomies'; import Link from 'next/link'; import { useRouter } from 'next/router'; @@ -7,13 +8,13 @@ import styles from './PostHeader.module.scss'; const PostHeader = ({ author, - date, + dates, intro, title, thematics, }: { author: ArticleAuthor; - date: ArticleDates; + dates: Dates; intro: string; title: string; thematics: ThematicPreview[]; @@ -52,9 +53,9 @@ const PostHeader = ({ <h1>{title}</h1> <ul className={styles.meta}> <li>{t`Written by ${getAuthor()} on ${getLocaleDate( - date.publication + dates.publication )}.`}</li> - <li>{t`Last update on ${getLocaleDate(date.update)}.`}</li> + <li>{t`Last update on ${getLocaleDate(dates.update)}.`}</li> {thematics.length > 0 && ( <li> <dl> diff --git a/src/components/PostPreview/PostPreview.tsx b/src/components/PostPreview/PostPreview.tsx index 95aca97..f5c6d9b 100644 --- a/src/components/PostPreview/PostPreview.tsx +++ b/src/components/PostPreview/PostPreview.tsx @@ -38,7 +38,7 @@ const PostPreview = ({ </header> <div className={styles.body} - dangerouslySetInnerHTML={{ __html: post.content }} + dangerouslySetInnerHTML={{ __html: post.intro }} ></div> <footer className={styles.footer}> <Link href={`/article/${post.slug}`}> @@ -54,8 +54,8 @@ const PostPreview = ({ </footer> <PostMeta commentCount={post.commentCount} - publicationDate={post.date.publication} - updateDate={post.date.update} + publicationDate={post.dates.publication} + updateDate={post.dates.update} thematics={post.thematics} /> </article> |
