prevent comment thread pinch

This commit is contained in:
hjlarry 2025-11-27 15:37:46 +08:00
parent be1f841b37
commit bd597497e7
1 changed files with 7 additions and 0 deletions

View File

@ -179,6 +179,7 @@ export const CommentThread: FC<CommentThreadProps> = memo(({
appId ? state.mentionableUsersCache[appId] : undefined
))
const mentionUsers = mentionUsersFromStore ?? []
const setCommentPreviewHovering = useStore(state => state.setCommentPreviewHovering)
// Extract all mentionable names for highlighting
const mentionableNames = useMemo(() => {
@ -192,6 +193,10 @@ export const CommentThread: FC<CommentThreadProps> = memo(({
setReplyContent('')
}, [comment.id])
useEffect(() => () => {
setCommentPreviewHovering(false)
}, [setCommentPreviewHovering])
// P0: Auto-focus reply input when thread opens or comment changes
useEffect(() => {
const timer = setTimeout(() => {
@ -344,6 +349,8 @@ export const CommentThread: FC<CommentThreadProps> = memo(({
top: canvasPosition.y,
transform: 'translateY(-20%)',
}}
onMouseEnter={() => setCommentPreviewHovering(true)}
onMouseLeave={() => setCommentPreviewHovering(false)}
>
<div
ref={threadRef}