From bbd4cba1c162e36b0b7cd049cbdf232c75f3c132 Mon Sep 17 00:00:00 2001 From: highperfocused Date: Sat, 22 Nov 2025 21:17:49 +0100 Subject: [PATCH] Refactor CommentsSection to simplify error handling and improve layout structure --- src/components/comments/CommentsSection.tsx | 118 ++++++++++---------- 1 file changed, 56 insertions(+), 62 deletions(-) diff --git a/src/components/comments/CommentsSection.tsx b/src/components/comments/CommentsSection.tsx index a269934..6de0e99 100644 --- a/src/components/comments/CommentsSection.tsx +++ b/src/components/comments/CommentsSection.tsx @@ -29,72 +29,66 @@ export function CommentsSection({ if (error) { return ( - - -
- -

Failed to load comments

-
-
-
+
+ +

Failed to load comments

+
); } return ( - - - - - {title} - {!isLoading && ( - - ({comments.length}) - - )} - - - - {/* Comment Form */} - - - {/* Comments List */} - {isLoading ? ( -
- {[...Array(3)].map((_, i) => ( - - -
-
- -
- - -
-
- -
-
-
- ))} -
- ) : comments.length === 0 ? ( -
- -

{emptyStateMessage}

-

{emptyStateSubtitle}

-
- ) : ( -
- {comments.map((comment) => ( - - ))} -
+
+ {/* Header */} +
+ +

{title}

+ {!isLoading && ( + + ({comments.length}) + )} - - +
+ + {/* Comment Form */} + + + {/* Comments List */} + {isLoading ? ( +
+ {[...Array(3)].map((_, i) => ( + + +
+
+ +
+ + +
+
+ +
+
+
+ ))} +
+ ) : comments.length === 0 ? ( +
+ +

{emptyStateMessage}

+

{emptyStateSubtitle}

+
+ ) : ( +
+ {comments.map((comment) => ( + + ))} +
+ )} +
); } \ No newline at end of file