import { useAppSelector } from 'app/store/storeHooks'; import { useCallback } from 'react'; import { useDropzone } from 'react-dropzone'; import { useUploadImageMutation } from 'services/api/endpoints/images'; import { PostUploadAction } from 'services/api/types'; type UseImageUploadButtonArgs = { postUploadAction?: PostUploadAction; isDisabled?: boolean; }; /** * Provides image uploader functionality to any component. * * @example * const { getUploadButtonProps, getUploadInputProps, openUploader } = useImageUploadButton({ * postUploadAction: { * type: 'SET_CONTROLNET_IMAGE', * controlNetId: '12345', * }, * isDisabled: getIsUploadDisabled(), * }); * * // open the uploaded directly * const handleSomething = () => { openUploader() } * * // in the render function *