UNPKG

@replyke/core

Version:

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

60 lines (59 loc) 2.47 kB
import { Comment as CommentType, GifData } from "../../interfaces/models/Comment"; import { EntityCommentsTree } from "../../interfaces/EntityCommentsTree"; import { CommentsSortByOptions } from "../../interfaces/CommentsSortByOptions"; import { UserLean } from "../../interfaces/models/User"; import { Mention } from "../../interfaces/models/Mention"; import { Entity } from "../../interfaces/models/Entity"; export interface UseCommentSectionDataProps { entity?: Entity; entityId?: string | undefined | null; referenceId?: 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: CommentType[]; newComments: CommentType[]; loading: boolean; hasMore: boolean; submittingComment: boolean; loadMore: () => void; pushMention: UserLean | null; sortBy: CommentsSortByOptions | null; setSortBy: (newSortBy: CommentsSortByOptions) => void; selectedComment: CommentType | null; setSelectedComment: (newSelectedComment: CommentType | null) => void; repliedToComment: Partial<CommentType> | null; setRepliedToComment: (newRepliedToComment: CommentType | null) => void; showReplyBanner: boolean; setShowReplyBanner: (newState: boolean) => void; addCommentsToTree: (newComments: CommentType[] | undefined, newlyAdded?: boolean) => void; removeCommentFromTree: (commentId: string) => void; handleDeepReply: (comment: CommentType) => void; handleShallowReply: (comment: CommentType) => void; createComment: (props: { content?: string; gif?: GifData; mentions: Mention[]; }) => Promise<void>; updateComment: (props: { commentId: string; content: string; }) => Promise<void>; deleteComment: (props: { commentId: string; }) => Promise<void>; highlightedComment: { comment: CommentType; parentComment: CommentType | null; } | null; } declare function useCommentSectionData(props: UseCommentSectionDataProps): UseCommentSectionDataValues; export default useCommentSectionData;