diff --git a/client/src/graphql/mutations/comment/addComment.js b/client/src/graphql/mutations/comment/addComment.js new file mode 100644 index 00000000..d53f4df9 --- /dev/null +++ b/client/src/graphql/mutations/comment/addComment.js @@ -0,0 +1,12 @@ +import { gql } from '@apollo/client'; + +export default addComment = gql` + mutation createComment($content: String!, $authorID: ID!, parentID: ID!, parentType: String!) { + createComment(content: $content, id: $authorID, parentID: $parentID, parentType: $parentType) { + content + id + parentID + parentType + } + } +`; diff --git a/client/src/graphql/queries/comments/getCommentByID.js b/client/src/graphql/queries/comments/getCommentByID.js new file mode 100644 index 00000000..50031eed --- /dev/null +++ b/client/src/graphql/queries/comments/getCommentByID.js @@ -0,0 +1,9 @@ +import { gql } from '@apollo/client'; + +export default getCommentByID = gql` + query getCommentById($id: ID!) { + getListOfComments(ids: $id) { + id + } + } +`; diff --git a/client/src/graphql/queries/comments/getListOfComments.js b/client/src/graphql/queries/comments/getListOfComments.js new file mode 100644 index 00000000..bfc9395e --- /dev/null +++ b/client/src/graphql/queries/comments/getListOfComments.js @@ -0,0 +1,9 @@ +import { gql } from '@apollo/client'; + +export default getListOfComments = gql` + query getListOfComments($ids: [ID]!, $limit: Int) { + getListOfComments(ids: $ids, limit: $limit) { + ids + } + } +`; diff --git a/client/src/pages/article/[...article].jsx b/client/src/pages/article/[...article].jsx index 0bac74ab..4c55ed17 100644 --- a/client/src/pages/article/[...article].jsx +++ b/client/src/pages/article/[...article].jsx @@ -16,6 +16,7 @@ import getArticleByID from '../../graphql/queries/article/getArticleByID'; import getArticleByOldID from '../../graphql/queries/article/getArticleByOldID'; import getArticleLink, { getArticleSlug } from '../../utils/getArticleLink'; import Custom500 from '../500'; +import Comment from '../../components/article/comments/Comment'; function ArticlePage({ article, isError }) { const { isFallback } = useRouter(); diff --git a/client/src/screens/Article.js b/client/src/screens/Article.js index c1d6c15c..bc6bc180 100644 --- a/client/src/screens/Article.js +++ b/client/src/screens/Article.js @@ -16,6 +16,7 @@ import ArticleTags from '../components/article/Tags'; import RecommendedArticles from '../components/article/RecommendedArticles'; import SidePanel from '../components/article/SidePanel'; import SidePanelMobile from '../components/article/SidePanelMobile'; +import Comment from '../components/article/comments/Comment'; // Assets import theme from '../config/themes/light'; @@ -35,7 +36,7 @@ function Article({ article }) {
- {/* */} +