Skip to content

Commit

Permalink
fix(frontend): fixed not displaying comment problem
Browse files Browse the repository at this point in the history
  • Loading branch information
Elifnurdeniz committed Nov 24, 2024
1 parent 96074eb commit 077b647
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions frontend/src/components/post/post-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export default function PostCard({
};

const displayedText =
isExpanded || content.length <= maxLength
isExpanded || (content && content.length <= maxLength)
? content
: `${content.slice(0, maxLength)}... `;

Expand Down Expand Up @@ -151,7 +151,7 @@ export default function PostCard({
<CardBody className="px-3 py-0 text-small text-default-600 text-justify leading-relaxed overflow-hidden">
<p>
{displayedText}
{content.length > maxLength && (
{(content) && content.length > maxLength && (
<span
onClick={toggleExpand}
style={{ color: "#186df5", cursor: "pointer" }}
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/pages/post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,12 @@ export default function Post() {
.fill(0)
.map((_, index) => <CommentSkeleton key={index} />)
: comments.map((comment) => (
console.log(comment),
<Suspense key={comment.id} fallback={<CommentSkeleton />}>
<PostCard
id={comment.id}
username={comment.author}
content={comment.content}
content={comment.body || comment.content}
timePassed={formatTimeAgo(comment.created_at)}
likeCount={comment.like_count}
initialIsLiked={comment.is_liked}
Expand Down

0 comments on commit 077b647

Please sign in to comment.