Connect, collaborate, and grow with a community of TypeScript developers
feat: Indicate if a comment is edited (#933)
Oreoluwa Bimbo-Salamibc21113df46c
diff --git a/apps/web/src/app/[locale]/challenge/_components/comments/comment.tsx b/apps/web/src/app/[locale]/challenge/_components/comments/comment.tsxindex 5a73fa3a..b20212f0 100644--- a/apps/web/src/app/[locale]/challenge/_components/comments/comment.tsx+++ b/apps/web/src/app/[locale]/challenge/_components/comments/comment.tsx@@ -342,6 +342,8 @@ function SingleComment({const isAuthor = loggedinUser.data?.user.id === comment.user.id;const isAdminAndModerator = isAdminOrModerator(loggedinUser.data);+ const hasBeenEdited = comment.updatedAt.getTime() > comment.createdAt.getTime();+useEffect(() => {if (!isHighlighted) return;const timeout = setTimeout(() => {@@ -375,6 +377,7 @@ function SingleComment({</Avatar><UserBadge username={comment.user.name ?? ''} linkComponent={Link} /></div>+<Tooltip delayDuration={0.05}><TooltipTrigger asChild><div className="text-muted-foreground flex items-center gap-2 whitespace-nowrap text-xs">@@ -391,6 +394,15 @@ function SingleComment({{!isEditing && (<div className="-mb-1"><ExpandableContent content={comment.text} />+ {hasBeenEdited ? (+ <div className="text-muted-foreground flex items-center gap-2 whitespace-nowrap text-xs">+ Last edited at+ {new Intl.DateTimeFormat(undefined, {+ timeStyle: 'short',+ dateStyle: 'short',+ }).format(comment.updatedAt)}+ </div>+ ) : null}</div>)}{isEditing ? (