mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
useDisclosure instead of useState.
This commit is contained in:
parent
d1ac50b061
commit
91c4e4c9b9
@ -1,4 +1,4 @@
|
|||||||
import { useState } from 'react';
|
import { useDisclosure } from '@chakra-ui/react';
|
||||||
import {
|
import {
|
||||||
AlertDialog,
|
AlertDialog,
|
||||||
AlertDialogBody,
|
AlertDialogBody,
|
||||||
@ -22,10 +22,10 @@ import IAIIconButton from 'common/components/IAIIconButton';
|
|||||||
const ClearNodesButton = () => {
|
const ClearNodesButton = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const [isDialogOpen, setIsDialogOpen] = useState(false);
|
const { isOpen, onOpen, onClose } = useDisclosure();
|
||||||
|
|
||||||
const handleClearNodes = () => {
|
const handleClearNodes = () => {
|
||||||
setIsDialogOpen(true);
|
onOpen();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleConfirmClear = () => {
|
const handleConfirmClear = () => {
|
||||||
@ -40,11 +40,11 @@ const ClearNodesButton = () => {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
setIsDialogOpen(false);
|
onClose();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleCancelClear = () => {
|
const handleCancelClear = () => {
|
||||||
setIsDialogOpen(false);
|
onClose();
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -56,12 +56,7 @@ const ClearNodesButton = () => {
|
|||||||
onClick={handleClearNodes}
|
onClick={handleClearNodes}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<AlertDialog
|
<AlertDialog isOpen={isOpen} onClose={handleCancelClear} isCentered>
|
||||||
isOpen={isDialogOpen}
|
|
||||||
leastDestructiveRef={undefined}
|
|
||||||
onClose={handleCancelClear}
|
|
||||||
isCentered
|
|
||||||
>
|
|
||||||
<AlertDialogOverlay />
|
<AlertDialogOverlay />
|
||||||
|
|
||||||
<AlertDialogContent>
|
<AlertDialogContent>
|
||||||
|
Loading…
Reference in New Issue
Block a user