mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
545d8968fd
build(ui): fix husky path build(ui): fix hmr issue, remove emotion cache build(ui): clean up package.json build(ui): update gh action and npm scripts feat(ui): wip port lightbox to chakra theme feat(ui): wip use chakra theme tokens feat(ui): Add status text to main loading spinner feat(ui): wip chakra theme tweaking feat(ui): simply iaisimplemenu button feat(ui): wip chakra theming feat(ui): Theme Management feat(ui): Add Ocean Blue Theme feat(ui): wip lightbox fix(ui): fix lightbox mouse feat(ui): set default theme variants feat(ui): model manager chakra theme chore(ui): lint feat(ui): remove last scss feat(ui): fix switch theme feat(ui): Theme Cleanup feat(ui): Stylize Search Models Found List feat(ui): hide scrollbars feat(ui): fix floating button position feat(ui): Scrollbar Styling fix broken scripts This PR fixes the following scripts: 1) Scripts that can be executed within the repo's scripts directory. Note that these are for development testing and are not intended to be exposed to the user. configure_invokeai.py - configuration dream.py - the legacy CLI images2prompt.py - legacy "dream prompt" retriever invoke-new.py - new nodes-based CLI invoke.py - the legacy CLI under another name make_models_markdown_table.py - a utility used during the release/doc process pypi_helper.py - another utility used during the release process sd-metadata.py - retrieve JSON-formatted metadata from a PNG file 2) Scripts that are installed by pip install. They get placed into the venv's PATH and are intended to be the official entry points: invokeai-node-cli - new nodes-based CLI invokeai-node-web - new nodes-based web server invokeai - legacy CLI invokeai-configure - install time configuration script invokeai-merge - model merging script invokeai-ti - textual inversion script invokeai-model-install - model installer invokeai-update - update script invokeai-metadata" - retrieve JSON-formatted metadata from PNG files protect invocations against black autoformatting deps: upgrade to diffusers 0.14, safetensors 0.3, transformers 4.26, accelerate 0.16
83 lines
1.9 KiB
TypeScript
83 lines
1.9 KiB
TypeScript
import {
|
|
AlertDialog,
|
|
AlertDialogBody,
|
|
AlertDialogContent,
|
|
AlertDialogFooter,
|
|
AlertDialogHeader,
|
|
AlertDialogOverlay,
|
|
forwardRef,
|
|
useDisclosure,
|
|
} from '@chakra-ui/react';
|
|
import { cloneElement, ReactElement, ReactNode, useRef } from 'react';
|
|
import IAIButton from './IAIButton';
|
|
|
|
type Props = {
|
|
acceptButtonText?: string;
|
|
acceptCallback: () => void;
|
|
cancelButtonText?: string;
|
|
cancelCallback?: () => void;
|
|
children: ReactNode;
|
|
title: string;
|
|
triggerComponent: ReactElement;
|
|
};
|
|
|
|
const IAIAlertDialog = forwardRef((props: Props, ref) => {
|
|
const {
|
|
acceptButtonText = 'Accept',
|
|
acceptCallback,
|
|
cancelButtonText = 'Cancel',
|
|
cancelCallback,
|
|
children,
|
|
title,
|
|
triggerComponent,
|
|
} = props;
|
|
|
|
const { isOpen, onOpen, onClose } = useDisclosure();
|
|
const cancelRef = useRef<HTMLButtonElement | null>(null);
|
|
|
|
const handleAccept = () => {
|
|
acceptCallback();
|
|
onClose();
|
|
};
|
|
|
|
const handleCancel = () => {
|
|
cancelCallback && cancelCallback();
|
|
onClose();
|
|
};
|
|
|
|
return (
|
|
<>
|
|
{cloneElement(triggerComponent, {
|
|
onClick: onOpen,
|
|
ref: ref,
|
|
})}
|
|
|
|
<AlertDialog
|
|
isOpen={isOpen}
|
|
leastDestructiveRef={cancelRef}
|
|
onClose={onClose}
|
|
>
|
|
<AlertDialogOverlay>
|
|
<AlertDialogContent>
|
|
<AlertDialogHeader fontSize="lg" fontWeight="bold">
|
|
{title}
|
|
</AlertDialogHeader>
|
|
|
|
<AlertDialogBody>{children}</AlertDialogBody>
|
|
|
|
<AlertDialogFooter>
|
|
<IAIButton ref={cancelRef} onClick={handleCancel}>
|
|
{cancelButtonText}
|
|
</IAIButton>
|
|
<IAIButton colorScheme="error" onClick={handleAccept} ml={3}>
|
|
{acceptButtonText}
|
|
</IAIButton>
|
|
</AlertDialogFooter>
|
|
</AlertDialogContent>
|
|
</AlertDialogOverlay>
|
|
</AlertDialog>
|
|
</>
|
|
);
|
|
});
|
|
export default IAIAlertDialog;
|