Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui): canvas followups 10 #6872

Merged
merged 2 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ type IAIDndImageProps = FlexProps & {
fitContainer?: boolean;
droppableData?: TypesafeDroppableData;
draggableData?: TypesafeDraggableData;
dropLabel?: ReactNode;
dropLabel?: string;
isSelected?: boolean;
isSelectedForCompare?: boolean;
thumbnail?: boolean;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { Flex, Text } from '@invoke-ai/ui-library';
import type { AnimationProps } from 'framer-motion';
import { motion } from 'framer-motion';
import type { ReactNode } from 'react';
import { memo, useRef } from 'react';
import { useTranslation } from 'react-i18next';
import { v4 as uuidv4 } from 'uuid';
type Props = {
isOver: boolean;
label?: ReactNode;
label?: string;
};

const initial: AnimationProps['initial'] = {
Expand Down Expand Up @@ -64,7 +63,7 @@ const IAIDropOverlay = (props: Props) => {
p={4}
>
<Text
fontSize="xl"
fontSize="lg"
fontWeight="semibold"
color={isOver ? 'invokeYellow.300' : 'base.500'}
transitionProperty="common"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ import { useDroppableTypesafe } from 'features/dnd/hooks/typesafeHooks';
import type { TypesafeDroppableData } from 'features/dnd/types';
import { isValidDrop } from 'features/dnd/util/isValidDrop';
import { AnimatePresence } from 'framer-motion';
import type { ReactNode } from 'react';
import { memo, useRef } from 'react';
import { v4 as uuidv4 } from 'uuid';

import IAIDropOverlay from './IAIDropOverlay';

type IAIDroppableProps = {
dropLabel?: ReactNode;
dropLabel?: string;
disabled?: boolean;
data?: TypesafeDroppableData;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ export function useCanvasResetLayerHotkey() {
const isInteractable = useStore(adapter?.$isInteractable ?? $false);

const resetSelectedLayer = useCallback(() => {
if (selectedEntityIdentifier === null) {
if (selectedEntityIdentifier === null || adapter === null) {
return;
}
adapter.bufferRenderer.clearBuffer();
dispatch(entityReset({ entityIdentifier: selectedEntityIdentifier }));
}, [dispatch, selectedEntityIdentifier]);
}, [adapter, dispatch, selectedEntityIdentifier]);

const isResetEnabled = useMemo(
() => selectedEntityIdentifier !== null && isMaskEntityIdentifier(selectedEntityIdentifier),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ const GalleryBoard = ({ board, isSelected }: GalleryBoardProps) => {
{board.archived && !editingDisclosure.isOpen && <Icon as={PiArchiveBold} fill="base.300" />}
{!editingDisclosure.isOpen && <Text variant="subtext">{board.image_count}</Text>}

<IAIDroppable data={droppableData} dropLabel={<Text fontSize="lg">{t('unifiedCanvas.move')}</Text>} />
<IAIDroppable data={droppableData} dropLabel={t('unifiedCanvas.move')} />
</Flex>
</Tooltip>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const NoBoardBoard = memo(({ isSelected }: Props) => {
</Text>
{autoAddBoardId === 'none' && <AutoAddBadge />}
<Text variant="subtext">{imagesTotal}</Text>
<IAIDroppable data={droppableData} dropLabel={<Text fontSize="lg">{t('unifiedCanvas.move')}</Text>} />
<IAIDroppable data={droppableData} dropLabel={t('unifiedCanvas.move')} />
</Flex>
</Tooltip>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ const ImageFieldInputComponent = (props: FieldComponentProps<ImageFieldInputInst
postUploadAction={postUploadAction}
useThumbailFallback
uploadElement={<UploadElement />}
dropLabel={<DropLabel />}
minSize={8}
>
<IAIDndImageIcon
Expand All @@ -100,14 +99,3 @@ const UploadElement = memo(() => {
});

UploadElement.displayName = 'UploadElement';

const DropLabel = memo(() => {
const { t } = useTranslation();
return (
<Text fontSize={16} fontWeight="semibold">
{t('gallery.drop')}
</Text>
);
});

DropLabel.displayName = 'DropLabel';
Loading