import { useCallback } from 'react'; import type { FC } from 'react'; import { FormattedMessage } from 'react-intl'; import { Button } from '@/mastodon/components/button'; import { deleteImage } from '@/mastodon/reducers/slices/profile_edit'; import type { ImageLocation } from '@/mastodon/reducers/slices/profile_edit'; import { useAppDispatch, useAppSelector } from '@/mastodon/store'; import { DialogModal } from '../../ui/components/dialog_modal'; import type { DialogModalProps } from '../../ui/components/dialog_modal'; export const ImageDeleteModal: FC< DialogModalProps & { location: ImageLocation } > = ({ onClose, location }) => { const isPending = useAppSelector((state) => state.profileEdit.isPending); const dispatch = useAppDispatch(); const handleDelete = useCallback(() => { void dispatch(deleteImage({ location })).then(onClose); }, [dispatch, location, onClose]); return ( } buttons={ } > ); };