feat(ui): floating viewer always shows progress, never shows metadata

This commit is contained in:
psychedelicious 2024-05-06 19:24:27 +10:00 committed by Kent Keirsey
parent cce3144c74
commit c0065a65a0
2 changed files with 18 additions and 4 deletions

View File

@ -26,9 +26,17 @@ type Props = {
isDragDisabled?: boolean; isDragDisabled?: boolean;
isDropDisabled?: boolean; isDropDisabled?: boolean;
withNextPrevButtons?: boolean; withNextPrevButtons?: boolean;
withMetadata?: boolean;
alwaysShowProgress?: boolean;
}; };
const CurrentImagePreview = ({ isDragDisabled = false, isDropDisabled = false, withNextPrevButtons = true }: Props) => { const CurrentImagePreview = ({
isDragDisabled = false,
isDropDisabled = false,
withNextPrevButtons = true,
withMetadata = true,
alwaysShowProgress = false,
}: Props) => {
const { t } = useTranslation(); const { t } = useTranslation();
const shouldShowImageDetails = useAppSelector((s) => s.ui.shouldShowImageDetails); const shouldShowImageDetails = useAppSelector((s) => s.ui.shouldShowImageDetails);
const imageName = useAppSelector(selectLastSelectedImageName); const imageName = useAppSelector(selectLastSelectedImageName);
@ -78,7 +86,7 @@ const CurrentImagePreview = ({ isDragDisabled = false, isDropDisabled = false, w
justifyContent="center" justifyContent="center"
position="relative" position="relative"
> >
{hasDenoiseProgress && shouldShowProgressInViewer ? ( {hasDenoiseProgress && (shouldShowProgressInViewer || alwaysShowProgress) ? (
<ProgressImage /> <ProgressImage />
) : ( ) : (
<IAIDndImage <IAIDndImage
@ -96,7 +104,7 @@ const CurrentImagePreview = ({ isDragDisabled = false, isDropDisabled = false, w
/> />
)} )}
<AnimatePresence> <AnimatePresence>
{shouldShowImageDetails && imageDTO && ( {shouldShowImageDetails && imageDTO && withMetadata && (
<Box <Box
as={motion.div} as={motion.div}
key="metadataViewer" key="metadataViewer"

View File

@ -137,7 +137,13 @@ const FloatingImageViewerComponent = () => {
<IconButton aria-label={t('common.close')} icon={<PiXBold />} size="sm" variant="link" onClick={onClose} /> <IconButton aria-label={t('common.close')} icon={<PiXBold />} size="sm" variant="link" onClick={onClose} />
</Flex> </Flex>
<Flex p={2} w="full" h="full"> <Flex p={2} w="full" h="full">
<CurrentImagePreview isDragDisabled={true} isDropDisabled={true} withNextPrevButtons={false} /> <CurrentImagePreview
isDragDisabled={true}
isDropDisabled={true}
withNextPrevButtons={false}
withMetadata={false}
alwaysShowProgress
/>
</Flex> </Flex>
</Flex> </Flex>
</Rnd> </Rnd>