From e7bcd18cc5845002655193ed0717379d2954ba06 Mon Sep 17 00:00:00 2001 From: Terence Ho <> Date: Thu, 13 Oct 2022 11:02:55 +0800 Subject: [PATCH] [resumes][refactor] prefix comments section with Resume --- .../resumes/comments/CommentListItems.tsx | 35 ---------- .../resumes/comments/CommentsList.tsx | 54 --------------- ...ommentsForm.tsx => ResumeCommentsForm.tsx} | 6 +- .../resumes/comments/ResumeCommentsList.tsx | 69 +++++++++++++++++++ ...sSection.tsx => ResumeCommentsSection.tsx} | 14 ++-- .../resumes/comments/comment/Comment.tsx | 18 ----- ...{CommentBody.tsx => ResumeCommentBody.tsx} | 10 +-- ...{CommentCard.tsx => ResumeCommentCard.tsx} | 6 +- .../comment/ResumeCommentListItem.tsx | 21 ++++++ ...constants.ts => resumeCommentConstants.ts} | 2 +- .../ResumeExpandableText.tsx} | 6 +- apps/portal/src/pages/resumes/[resumeId].tsx | 4 +- 12 files changed, 116 insertions(+), 129 deletions(-) delete mode 100644 apps/portal/src/components/resumes/comments/CommentListItems.tsx delete mode 100644 apps/portal/src/components/resumes/comments/CommentsList.tsx rename apps/portal/src/components/resumes/comments/{CommentsForm.tsx => ResumeCommentsForm.tsx} (97%) create mode 100644 apps/portal/src/components/resumes/comments/ResumeCommentsList.tsx rename apps/portal/src/components/resumes/comments/{CommentsSection.tsx => ResumeCommentsSection.tsx} (73%) delete mode 100644 apps/portal/src/components/resumes/comments/comment/Comment.tsx rename apps/portal/src/components/resumes/comments/comment/{CommentBody.tsx => ResumeCommentBody.tsx} (88%) rename apps/portal/src/components/resumes/comments/comment/{CommentCard.tsx => ResumeCommentCard.tsx} (64%) create mode 100644 apps/portal/src/components/resumes/comments/comment/ResumeCommentListItem.tsx rename apps/portal/src/components/resumes/comments/{constants.ts => resumeCommentConstants.ts} (90%) rename apps/portal/src/components/resumes/{comments/comment/CommentDescription.tsx => shared/ResumeExpandableText.tsx} (90%) diff --git a/apps/portal/src/components/resumes/comments/CommentListItems.tsx b/apps/portal/src/components/resumes/comments/CommentListItems.tsx deleted file mode 100644 index 5e3e154d..00000000 --- a/apps/portal/src/components/resumes/comments/CommentListItems.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { useSession } from 'next-auth/react'; -import { Spinner } from '@tih/ui'; - -import Comment from './comment/Comment'; - -import type { ResumeComment } from '~/types/resume-comments'; - -type Props = Readonly<{ - comments: Array; - isLoading: boolean; -}>; - -export default function CommentListItems({ comments, isLoading }: Props) { - const { data: session } = useSession(); - - if (isLoading) { - return ( -
- -
- ); - } - - return ( -
- {comments.map((comment) => ( - - ))} -
- ); -} diff --git a/apps/portal/src/components/resumes/comments/CommentsList.tsx b/apps/portal/src/components/resumes/comments/CommentsList.tsx deleted file mode 100644 index e4f842cb..00000000 --- a/apps/portal/src/components/resumes/comments/CommentsList.tsx +++ /dev/null @@ -1,54 +0,0 @@ -import { useSession } from 'next-auth/react'; -import { useState } from 'react'; -import { Tabs } from '@tih/ui'; -import { Button } from '@tih/ui'; - -import { trpc } from '~/utils/trpc'; - -import CommentListItems from './CommentListItems'; -import { COMMENTS_SECTIONS } from './constants'; -import ResumeSignInButton from '../shared/ResumeSignInButton'; - -type CommentsListProps = Readonly<{ - resumeId: string; - setShowCommentsForm: (show: boolean) => void; -}>; - -export default function CommentsList({ - resumeId, - setShowCommentsForm, -}: CommentsListProps) { - const { data: sessionData } = useSession(); - const [tab, setTab] = useState(COMMENTS_SECTIONS[0].value); - - const commentsQuery = trpc.useQuery(['resumes.reviews.list', { resumeId }]); - const renderButton = () => { - if (sessionData === null) { - return ; - } - return ( -