From d2beda08b6f54fb08da63e1a0250eba01796f2d7 Mon Sep 17 00:00:00 2001
From: Terence Ho <>
Date: Thu, 13 Oct 2022 11:54:35 +0800
Subject: [PATCH] [resumes][refactor] combine resume-card and resume-body into
resume-list-item
---
.../comments/ResumeCommentListItem.tsx | 77 +++++++++++++++++++
.../resumes/comments/ResumeCommentsList.tsx | 2 +-
.../comments/comment/ResumeCommentBody.tsx | 73 ------------------
.../comments/comment/ResumeCommentCard.tsx | 15 ----
.../comment/ResumeCommentListItem.tsx | 21 -----
5 files changed, 78 insertions(+), 110 deletions(-)
create mode 100644 apps/portal/src/components/resumes/comments/ResumeCommentListItem.tsx
delete mode 100644 apps/portal/src/components/resumes/comments/comment/ResumeCommentBody.tsx
delete mode 100644 apps/portal/src/components/resumes/comments/comment/ResumeCommentCard.tsx
delete mode 100644 apps/portal/src/components/resumes/comments/comment/ResumeCommentListItem.tsx
diff --git a/apps/portal/src/components/resumes/comments/ResumeCommentListItem.tsx b/apps/portal/src/components/resumes/comments/ResumeCommentListItem.tsx
new file mode 100644
index 00000000..537f3fc2
--- /dev/null
+++ b/apps/portal/src/components/resumes/comments/ResumeCommentListItem.tsx
@@ -0,0 +1,77 @@
+import {
+ ArrowDownCircleIcon,
+ ArrowUpCircleIcon,
+} from '@heroicons/react/20/solid';
+import { FaceSmileIcon } from '@heroicons/react/24/outline';
+
+import ResumeExpandableText from '../shared/ResumeExpandableText';
+
+import type { ResumeComment } from '~/types/resume-comments';
+
+type ResumeCommentListItemProps = {
+ comment: ResumeComment;
+ userId?: string;
+};
+
+export default function ResumeCommentListItem({
+ comment,
+ userId,
+}: ResumeCommentListItemProps) {
+ const isCommentOwner = userId === comment.user.userId;
+
+ return (
+
+
+ {comment.user.image ? (
+

+ ) : (
+
+ )}
+
+
+ {/* Name and creation time */}
+
+
+
+ {comment.user.name ?? 'Reviewer ABC'}
+
+
+
+ {isCommentOwner ? '(Me)' : ''}
+
+
+
+
+ {comment.createdAt.toLocaleString('en-US', {
+ dateStyle: 'medium',
+ timeStyle: 'short',
+ })}
+
+
+
+ {/* Description */}
+
{comment.description}
+
+ {/* Upvote and edit */}
+
+ {/* TODO: Implement upvote */}
+
+
{comment.numVotes}
+
+
+ {/* TODO: Implement edit */}
+ {isCommentOwner ? (
+
+ Edit
+
+ ) : null}
+
+
+
+
+ );
+}
diff --git a/apps/portal/src/components/resumes/comments/ResumeCommentsList.tsx b/apps/portal/src/components/resumes/comments/ResumeCommentsList.tsx
index 929f7571..5b50f0ad 100644
--- a/apps/portal/src/components/resumes/comments/ResumeCommentsList.tsx
+++ b/apps/portal/src/components/resumes/comments/ResumeCommentsList.tsx
@@ -5,8 +5,8 @@ import { Button } from '@tih/ui';
import { trpc } from '~/utils/trpc';
-import ResumeCommentListItem from './comment/ResumeCommentListItem';
import { RESUME_COMMENTS_SECTIONS } from './resumeCommentConstants';
+import ResumeCommentListItem from './ResumeCommentListItem';
import ResumeSignInButton from '../shared/ResumeSignInButton';
import type { ResumeComment } from '~/types/resume-comments';
diff --git a/apps/portal/src/components/resumes/comments/comment/ResumeCommentBody.tsx b/apps/portal/src/components/resumes/comments/comment/ResumeCommentBody.tsx
deleted file mode 100644
index 51483bac..00000000
--- a/apps/portal/src/components/resumes/comments/comment/ResumeCommentBody.tsx
+++ /dev/null
@@ -1,73 +0,0 @@
-import {
- ArrowDownCircleIcon,
- ArrowUpCircleIcon,
-} from '@heroicons/react/20/solid';
-import { FaceSmileIcon } from '@heroicons/react/24/outline';
-
-import ResumeExpandableText from '../../shared/ResumeExpandableText';
-
-import type { ResumeComment } from '~/types/resume-comments';
-
-type ResumeCommentBodyProps = {
- comment: ResumeComment;
- isCommentOwner?: boolean;
-};
-
-export default function ResumeCommentBody({
- comment,
- isCommentOwner,
-}: ResumeCommentBodyProps) {
- return (
-
- {comment.user.image ? (
-

- ) : (
-
- )}
-
-
- {/* Name and creation time */}
-
-
-
- {comment.user.name ?? 'Reviewer ABC'}
-
-
-
- {isCommentOwner ? '(Me)' : ''}
-
-
-
-
- {comment.createdAt.toLocaleString('en-US', {
- dateStyle: 'medium',
- timeStyle: 'short',
- })}
-
-
-
- {/* Description */}
-
{comment.description}
-
- {/* Upvote and edit */}
-
- {/* TODO: Implement upvote */}
-
-
{comment.numVotes}
-
-
- {/* TODO: Implement edit */}
- {isCommentOwner ? (
-
- Edit
-
- ) : null}
-
-
-
- );
-}
diff --git a/apps/portal/src/components/resumes/comments/comment/ResumeCommentCard.tsx b/apps/portal/src/components/resumes/comments/comment/ResumeCommentCard.tsx
deleted file mode 100644
index ae9ac3bf..00000000
--- a/apps/portal/src/components/resumes/comments/comment/ResumeCommentCard.tsx
+++ /dev/null
@@ -1,15 +0,0 @@
-import type { ReactNode } from 'react';
-
-type ResumeCommentCardProps = {
- children: ReactNode;
-};
-
-export default function ResumeCommentCard({
- children,
-}: ResumeCommentCardProps) {
- return (
-
- {children}
-
- );
-}
diff --git a/apps/portal/src/components/resumes/comments/comment/ResumeCommentListItem.tsx b/apps/portal/src/components/resumes/comments/comment/ResumeCommentListItem.tsx
deleted file mode 100644
index 05172457..00000000
--- a/apps/portal/src/components/resumes/comments/comment/ResumeCommentListItem.tsx
+++ /dev/null
@@ -1,21 +0,0 @@
-import ResumeCommentBody from './ResumeCommentBody';
-import ResumeCommentCard from './ResumeCommentCard';
-
-import type { ResumeComment } from '~/types/resume-comments';
-
-type ResumeCommentListItemProps = {
- comment: ResumeComment;
- userId?: string;
-};
-
-export default function ResumeCommentListItem({
- comment,
- userId,
-}: ResumeCommentListItemProps) {
- const isCommentOwner = userId === comment.user.userId;
- return (
-
-
-
- );
-}