UNPKG

@replyke/core

Version:

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

29 lines (28 loc) 1.12 kB
import { Comment, CommentIncludeParam } from "../../interfaces/models/Comment"; import { CommentsSortByOptions } from "../../interfaces/CommentsSortByOptions"; import { EntityCommentsTree } from "../../interfaces/EntityCommentsTree"; export interface UseEntityCommentsProps { entityId: string | undefined | null; limit?: number; defaultSortBy?: CommentsSortByOptions; include?: CommentIncludeParam; } export interface UseEntityCommentsValues { entityCommentsTree: EntityCommentsTree; comments: Comment[]; newComments: Comment[]; loading: boolean; hasMore: boolean; sortBy: CommentsSortByOptions | null; setSortBy: (newSortBy: CommentsSortByOptions) => void; loadMore: () => void; addCommentsToTree: (newComments: Comment[] | undefined, newlyAdded?: boolean) => void; removeCommentFromTree: ({ commentId }: { commentId: string; }) => void; markCommentAsDeleted: ({ commentId }: { commentId: string; }) => void; } declare function useEntityComments(props: UseEntityCommentsProps): UseEntityCommentsValues; export default useEntityComments;