mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Increased consistency and readability by replacing any unnecessary JSX expressions in places where string literals are sufficient
42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
import { emptyTempFolder } from 'app/socketio/actions';
|
|
import { useAppDispatch, useAppSelector } from 'app/storeHooks';
|
|
import IAIAlertDialog from 'common/components/IAIAlertDialog';
|
|
import IAIButton from 'common/components/IAIButton';
|
|
import { isStagingSelector } from 'features/canvas/store/canvasSelectors';
|
|
import {
|
|
clearCanvasHistory,
|
|
resetCanvas,
|
|
} from 'features/canvas/store/canvasSlice';
|
|
import { useTranslation } from 'react-i18next';
|
|
import { FaTrash } from 'react-icons/fa';
|
|
|
|
const EmptyTempFolderButtonModal = () => {
|
|
const isStaging = useAppSelector(isStagingSelector);
|
|
const dispatch = useAppDispatch();
|
|
const { t } = useTranslation();
|
|
|
|
const acceptCallback = () => {
|
|
dispatch(emptyTempFolder());
|
|
dispatch(resetCanvas());
|
|
dispatch(clearCanvasHistory());
|
|
};
|
|
|
|
return (
|
|
<IAIAlertDialog
|
|
title={t('unifiedcanvas:emptyTempImageFolder')}
|
|
acceptCallback={acceptCallback}
|
|
acceptButtonText={t('unifiedcanvas:emptyFolder')}
|
|
triggerComponent={
|
|
<IAIButton leftIcon={<FaTrash />} size="sm" isDisabled={isStaging}>
|
|
{t('unifiedcanvas:emptyTempImageFolder')}
|
|
</IAIButton>
|
|
}
|
|
>
|
|
<p>{t('unifiedcanvas:emptyTempImagesFolderMessage')}</p>
|
|
<br />
|
|
<p>{t('unifiedcanvas:emptyTempImagesFolderConfirm')}</p>
|
|
</IAIAlertDialog>
|
|
);
|
|
};
|
|
export default EmptyTempFolderButtonModal;
|