Files
InvokeAI/invokeai/frontend/web/src/features/queue/components/InvokeQueueBackButton.tsx
psychedelicious 19f5a9c3a9 feat(ui): better invoke button checks
- Improved/more thorough checking before invoking for control layers
- Improved styling for the tooltip
2024-05-13 08:29:31 +10:00

44 lines
1.4 KiB
TypeScript

import { Button, Flex, Spacer } from '@invoke-ai/ui-library';
import { useAppSelector } from 'app/store/storeHooks';
import { QueueIterationsNumberInput } from 'features/queue/components/QueueIterationsNumberInput';
import { useQueueBack } from 'features/queue/hooks/useQueueBack';
import { memo } from 'react';
import { RiSparkling2Fill } from 'react-icons/ri';
import { QueueButtonTooltip } from './QueueButtonTooltip';
const invoke = 'Invoke';
export const InvokeQueueBackButton = memo(() => {
const { queueBack, isLoading, isDisabled } = useQueueBack();
const isLoadingDynamicPrompts = useAppSelector((s) => s.dynamicPrompts.isLoading);
return (
<Flex pos="relative" flexGrow={1} minW="240px">
<QueueIterationsNumberInput />
<QueueButtonTooltip>
<Button
onClick={queueBack}
isLoading={isLoading || isLoadingDynamicPrompts}
loadingText={invoke}
isDisabled={isDisabled}
rightIcon={<RiSparkling2Fill />}
variant="solid"
zIndex={1}
colorScheme="invokeYellow"
size="lg"
w="calc(100% - 60px)"
flexShrink={0}
justifyContent="space-between"
spinnerPlacement="end"
>
<span>{invoke}</span>
<Spacer />
</Button>
</QueueButtonTooltip>
</Flex>
);
});
InvokeQueueBackButton.displayName = 'InvokeQueueBackButton';