mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
add comments for guests
This commit is contained in:
parent
cbf7b1f616
commit
8abf6177b5
16 changed files with 278 additions and 194 deletions
|
@ -10,25 +10,31 @@ export interface CommentProviderProps {
|
|||
isLoadingMore: boolean;
|
||||
onShowImageModal: (images: IFile[], index: number) => void;
|
||||
onLoadMoreComments: () => void;
|
||||
onSaveComment: (comment: IComment) => Promise<unknown>;
|
||||
onSaveComment: (comment: IComment) => Promise<IComment | undefined>;
|
||||
onDeleteComment: (id: IComment['id'], isLocked: boolean) => void;
|
||||
}
|
||||
|
||||
const CommentContext = createContext<CommentProviderProps>({
|
||||
// user: EMPTY_USER,
|
||||
comments: [],
|
||||
hasMore: false,
|
||||
lastSeenCurrent: null,
|
||||
isLoading: false,
|
||||
isLoadingMore: false,
|
||||
onSaveComment: async () => {},
|
||||
onSaveComment: async () => undefined,
|
||||
onShowImageModal: () => {},
|
||||
onLoadMoreComments: () => {},
|
||||
onDeleteComment: () => {},
|
||||
});
|
||||
|
||||
export const CommentContextProvider: FC<CommentProviderProps> = ({ children, ...contextValue }) => {
|
||||
return <CommentContext.Provider value={contextValue}>{children}</CommentContext.Provider>;
|
||||
export const CommentContextProvider: FC<CommentProviderProps> = ({
|
||||
children,
|
||||
...contextValue
|
||||
}) => {
|
||||
return (
|
||||
<CommentContext.Provider value={contextValue}>
|
||||
{children}
|
||||
</CommentContext.Provider>
|
||||
);
|
||||
};
|
||||
|
||||
export const useCommentContext = () => useContext(CommentContext);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue