import type { As, ChakraProps, FlexProps } from '@invoke-ai/ui-library'; import { Flex, Icon, Skeleton, Spinner, Text } from '@invoke-ai/ui-library'; import { memo, useMemo } from 'react'; import { PiImageBold } from 'react-icons/pi'; import type { ImageDTO } from 'services/api/types'; type Props = { image: ImageDTO | undefined }; const IAILoadingImageFallback = memo((props: Props) => { if (props.image) { return ( ); } return ( ); }); IAILoadingImageFallback.displayName = 'IAILoadingImageFallback'; type IAINoImageFallbackProps = FlexProps & { label?: string; icon?: As | null; boxSize?: ChakraProps['boxSize']; }; export const IAINoContentFallback = memo((props: IAINoImageFallbackProps) => { const { icon = PiImageBold, boxSize = 16, ...rest } = props; return ( {icon && } {props.label && {props.label}} ); }); IAINoContentFallback.displayName = 'IAINoContentFallback'; type IAINoImageFallbackWithSpinnerProps = FlexProps & { label?: string; }; export const IAINoContentFallbackWithSpinner = memo((props: IAINoImageFallbackWithSpinnerProps) => { const { sx, ...rest } = props; const styles = useMemo( () => ({ w: 'full', h: 'full', alignItems: 'center', justifyContent: 'center', borderRadius: 'base', flexDir: 'column', gap: 2, userSelect: 'none', opacity: 0.7, color: 'base.500', ...sx, }), [sx] ); return ( {props.label && {props.label}} ); }); IAINoContentFallbackWithSpinner.displayName = 'IAINoContentFallbackWithSpinner';