diff --git a/apps/portal/src/components/offers/profile/ProfileComments.tsx b/apps/portal/src/components/offers/profile/ProfileComments.tsx
index e3e9bb18..0b18332a 100644
--- a/apps/portal/src/components/offers/profile/ProfileComments.tsx
+++ b/apps/portal/src/components/offers/profile/ProfileComments.tsx
@@ -1,5 +1,5 @@
import { ClipboardDocumentIcon, ShareIcon } from '@heroicons/react/24/outline';
-import { Button, Spinner, TextArea } from '@tih/ui';
+import { Button, HorizontalDivider, Spinner, TextArea } from '@tih/ui';
import ExpandableCommentCard from './comments/ExpandableCommentCard';
@@ -21,6 +21,10 @@ export default function ProfileComments({
function handleReply(replayingToId: string, userId: string) {
return replayingToId + userId; // To integrate with API
}
+
+ function handleComment() {
+ return 'profileId'; // To integrate with API
+ }
if (isLoading) {
return (
@@ -54,9 +58,26 @@ export default function ProfileComments({
onClick={handleCopyPublicLink}
/>
-
- Discussions feature coming soon
-
+ Discussions
+
-
);
}
diff --git a/apps/portal/src/components/offers/profile/comments/CommentCard.tsx b/apps/portal/src/components/offers/profile/comments/CommentCard.tsx
index 712f06a1..f434da8e 100644
--- a/apps/portal/src/components/offers/profile/comments/CommentCard.tsx
+++ b/apps/portal/src/components/offers/profile/comments/CommentCard.tsx
@@ -1,5 +1,6 @@
+import { useState } from 'react';
import { ChatBubbleBottomCenterIcon } from '@heroicons/react/24/outline';
-import { Button } from '@tih/ui';
+import { Button, HorizontalDivider, TextArea } from '@tih/ui';
import type { CommentEntity } from '~/components/offers/types';
@@ -7,43 +8,73 @@ import { timeSinceNow } from '~/utils/offers/time';
type Props = Readonly<{
comment: CommentEntity;
+ handleExpanded?: () => void;
handleReply: (replayingToId: string, userId: string) => void;
+ isExpanded?: boolean;
+ replyLength?: number;
}>;
export default function CommentCard({
- comment: {
- createdAt,
- message,
- // ProfileId,
- // replies,
- replyingToId,
- userId,
- username,
- },
+ comment: { createdAt, message, replyingToId, userId, username },
+ handleExpanded,
handleReply,
+ isExpanded,
+ replyLength = 0,
}: Props) {
+ const [isReplying, setIsReplying] = useState(false);
return (
-
-
-
{username}
-
{message}
-
-
{`${timeSinceNow(
- createdAt,
- )} ago`}
-
-
+
+ >
);
}
diff --git a/apps/portal/src/components/offers/profile/comments/ExpandableCommentCard.tsx b/apps/portal/src/components/offers/profile/comments/ExpandableCommentCard.tsx
index 9bb750a9..17852c73 100644
--- a/apps/portal/src/components/offers/profile/comments/ExpandableCommentCard.tsx
+++ b/apps/portal/src/components/offers/profile/comments/ExpandableCommentCard.tsx
@@ -1,4 +1,4 @@
-import { Collapsible } from '@tih/ui';
+import { useState } from 'react';
import CommentCard from '~/components/offers/profile/comments/CommentCard';
import type { CommentEntity } from '~/components/offers/types';
@@ -9,20 +9,26 @@ type Props = Readonly<{
}>;
export default function ExpandableCommentCard({ comment, handleReply }: Props) {
+ const [isExpanded, setIsExpanded] = useState(false);
return (
-
+
setIsExpanded(!isExpanded)}
+ handleReply={handleReply}
+ isExpanded={isExpanded}
+ replyLength={comment.replies?.length ?? 0}
+ />
{comment.replies && (
-
-
- {comment.replies.map((reply) => (
+
+ {isExpanded &&
+ comment.replies.map((reply) => (
))}
-
)}