1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-26 05:16:41 +07:00

add comments for guests

This commit is contained in:
Fedor Katurov 2023-10-30 15:16:19 +06:00
parent cbf7b1f616
commit 8abf6177b5
16 changed files with 278 additions and 194 deletions

View file

@ -0,0 +1,38 @@
import { FC } from 'react';
import { CommentForm } from '~/components/comment/CommentForm';
import { UploadDropzone } from '~/components/upload/UploadDropzone';
import { UploadSubject, UploadTarget } from '~/constants/uploads';
import { useUploader } from '~/hooks/data/useUploader';
import { IComment, INode } from '~/types';
import { UploaderContextProvider } from '~/utils/context/UploaderContextProvider';
interface CommentEditingFormProps {
comment: IComment;
nodeId: INode['id'];
saveComment: (data: IComment) => Promise<IComment | undefined>;
onCancelEdit?: () => void;
}
const CommentEditingForm: FC<CommentEditingFormProps> = ({
saveComment,
comment,
onCancelEdit,
}) => {
const uploader = useUploader(UploadSubject.Comment, UploadTarget.Comments);
return (
<UploadDropzone onUpload={uploader.uploadFiles}>
<UploaderContextProvider value={uploader}>
<CommentForm
saveComment={saveComment}
comment={comment}
onCancelEdit={onCancelEdit}
allowUploads
/>
</UploaderContextProvider>
</UploadDropzone>
);
};
export { CommentEditingForm };