diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index df7d4224..c388c72a 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -5,7 +5,7 @@ class CommentsController < ApplicationController comments = Comment .where(post_id: params[:post_id]) .left_outer_joins(:user) - .select('comments.id, comments.body, comments.updated_at, users.full_name as user_full_name') + .select('comments.id, comments.body, comments.parent_id, comments.updated_at, users.full_name as user_full_name') .order(updated_at: :desc) render json: comments diff --git a/app/javascript/components/Comments/Comment.tsx b/app/javascript/components/Comments/Comment.tsx new file mode 100644 index 00000000..cc687b25 --- /dev/null +++ b/app/javascript/components/Comments/Comment.tsx @@ -0,0 +1,36 @@ +import * as React from 'react'; + +import { MutedText } from '../shared/CustomTexts'; + +interface Props { + id: number; + body: string; + parentId: number; + userFullName: string; + updatedAt: string; + + level: number; +} + +const Comment = ({ + id, + body, + parentId, + userFullName, + updatedAt, + + level, +}: Props) => ( +
+); + +export default Comment; \ No newline at end of file diff --git a/app/javascript/components/Comments/CommentList.tsx b/app/javascript/components/Comments/CommentList.tsx new file mode 100644 index 00000000..635717a7 --- /dev/null +++ b/app/javascript/components/Comments/CommentList.tsx @@ -0,0 +1,33 @@ +import * as React from 'react'; + +import Comment from './Comment'; + +import IComment from '../../interfaces/IComment'; + +interface Props { + comments: Array