UNPKG

@replyke/core

Version:

Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.

61 lines (60 loc) 2.45 kB
import { Comment, GifData } from "../../interfaces/models/Comment"; import { EntityCommentsTree } from "../../interfaces/EntityCommentsTree"; import { CommentsSortByOptions } from "../../interfaces/CommentsSortByOptions"; import { User } from "../../interfaces/models/User"; import { Mention } from "../../interfaces/models/Mention"; import { Entity } from "../../interfaces/models/Entity"; export interface UseCommentSectionDataProps { entity?: Entity | undefined | null; entityId?: string | undefined | null; foreignId?: string | undefined | null; shortId?: string | undefined | null; createIfNotFound?: boolean; callbacks?: Record<string, (...args: any[]) => void> | undefined; limit?: number; defaultSortBy?: CommentsSortByOptions; highlightedCommentId?: string | null; } export interface UseCommentSectionDataValues { entity: Entity | null | undefined; callbacks?: Record<string, (...args: any[]) => void> | undefined; entityCommentsTree: EntityCommentsTree; comments: Comment[]; newComments: Comment[]; highlightedComment: { comment: Comment; parentComment: Comment | null; } | null; loading: boolean; hasMore: boolean; submittingComment: boolean; loadMore: () => void; sortBy: CommentsSortByOptions | null; setSortBy: (newSortBy: CommentsSortByOptions) => void; pushMention: User | null; selectedComment: Comment | null; setSelectedComment: (newSelectedComment: Comment | null) => void; repliedToComment: Partial<Comment> | null; setRepliedToComment: (newRepliedToComment: Comment | null) => void; showReplyBanner: boolean; setShowReplyBanner: (newState: boolean) => void; addCommentsToTree: (newComments: Comment[] | undefined, newlyAdded?: boolean) => void; removeCommentFromTree: (commentId: string) => void; handleDeepReply: (comment: Comment) => void; handleShallowReply: (comment: Comment) => void; createComment: (props: { parentId?: string; content?: string; gif?: GifData; mentions: Mention[]; }) => Promise<void>; updateComment: (props: { commentId: string; content: string; }) => Promise<void>; deleteComment: (props: { commentId: string; }) => Promise<void>; } declare function useCommentSectionData(props: UseCommentSectionDataProps): UseCommentSectionDataValues; export default useCommentSectionData;