Both comment hooks expose behavioral callbacks you can customize in the hook file:
// File: hooks/use-threaded-comments.tsx (or use-social-comments.tsx)// Called when unauthenticated user tries to commentconst loginRequiredCallback = () => { router.push('/login?returnTo=' + window.location.pathname);};// Called when user without a username tries to commentconst usernameRequiredCallback = () => { router.push('/settings/profile?setup=username');};// Called when clicking your own profileconst currentUserClickCallback = () => { router.push('/profile');};// Called when clicking another user's name/avatarconst otherUserClickCallback = (userId: string, foreignId?: string) => { router.push(`/users/${foreignId || userId}`);};
For major UI changes, replace a sub-component with your own implementation:
// File: comment-thread.tsx// Instead of the built-in VoteButtons:// import VoteButtons from './single-comment/vote-buttons';// Use your own:import CustomVoteButtons from '@/components/ui/vote-buttons';return ( <div> <AuthorInfo /> <CommentBody /> <CustomVoteButtons commentId={comment.id} upvotes={comment.upvotes} downvotes={comment.downvotes} /> </div>);
const otherUserClickCallback = (userId: string, foreignId?: string) => { // foreignId is your system's user ID if set during auth const profileUrl = foreignId ? `/users/${foreignId}` : `/users/replyke/${userId}`; router.push(profileUrl);};
Wire the highlightedCommentId prop to deep-link from your notifications:
// In your notification handlerconst handleNotificationClick = (notification) => { if (notification.type === 'comment-reply') { router.push(`/posts/${notification.metadata.entityId}?commentId=${notification.metadata.commentId}`); }};// In your post pageconst [searchParams] = useSearchParams();<ThreadedCommentSection foreignId={post.id} highlightedCommentId={searchParams.get('commentId')}/>