+ No comments yet. Be the first to comment!
+
+ ) : (
+
+ {comments.map((comment) => (
+
+
+
+
+ {comment.user.username.charAt(0).toUpperCase()}
+
+
+
+
+
+ {comment.user.username}
+
+ {formatDistanceToNow(new Date(comment.created_at), {
+ addSuffix: true,
+ locale: fr,
+ })}
+
+
+ {user?.id === comment.user_id && (
+
+
+
+
+
+ handleDelete(comment.id)}
+ className="text-destructive"
+ >
+
+ Delete
+
+
+
+ )}
+
+
{comment.content}
+
+
+ ))}
+
+ {/* Pagination */}
+ {totalPages > 1 && (
+
+
+
+ Page {page} of {totalPages}
+
+
+
+ )}
+
+ )}
+