mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
tidy(ui): clearer component names for ip adapter
This commit is contained in:
parent
594da60f2f
commit
b170fc232e
@ -3,7 +3,7 @@ import { Flex } from '@invoke-ai/ui-library';
|
|||||||
import ScrollableContent from 'common/components/OverlayScrollbars/ScrollableContent';
|
import ScrollableContent from 'common/components/OverlayScrollbars/ScrollableContent';
|
||||||
import { ControlAdapterList } from 'features/controlLayers/components/ControlAdapter/ControlAdapterList';
|
import { ControlAdapterList } from 'features/controlLayers/components/ControlAdapter/ControlAdapterList';
|
||||||
import { InpaintMask } from 'features/controlLayers/components/InpaintMask/InpaintMask';
|
import { InpaintMask } from 'features/controlLayers/components/InpaintMask/InpaintMask';
|
||||||
import { IPAEntityList } from 'features/controlLayers/components/IPAdapter/IPAEntityList';
|
import { IPAdapterList } from 'features/controlLayers/components/IPAdapter/IPAdapterList';
|
||||||
import { LayerEntityList } from 'features/controlLayers/components/Layer/LayerEntityList';
|
import { LayerEntityList } from 'features/controlLayers/components/Layer/LayerEntityList';
|
||||||
import { RGEntityList } from 'features/controlLayers/components/RegionalGuidance/RGEntityList';
|
import { RGEntityList } from 'features/controlLayers/components/RegionalGuidance/RGEntityList';
|
||||||
import { memo } from 'react';
|
import { memo } from 'react';
|
||||||
@ -15,7 +15,7 @@ export const CanvasEntityList = memo(() => {
|
|||||||
<InpaintMask />
|
<InpaintMask />
|
||||||
<RGEntityList />
|
<RGEntityList />
|
||||||
<ControlAdapterList />
|
<ControlAdapterList />
|
||||||
<IPAEntityList />
|
<IPAdapterList />
|
||||||
<LayerEntityList />
|
<LayerEntityList />
|
||||||
</Flex>
|
</Flex>
|
||||||
</ScrollableContent>
|
</ScrollableContent>
|
||||||
|
@ -4,7 +4,7 @@ import { CanvasEntityDeleteButton } from 'features/controlLayers/components/comm
|
|||||||
import { CanvasEntityEnabledToggle } from 'features/controlLayers/components/common/CanvasEntityEnabledToggle';
|
import { CanvasEntityEnabledToggle } from 'features/controlLayers/components/common/CanvasEntityEnabledToggle';
|
||||||
import { CanvasEntityHeader } from 'features/controlLayers/components/common/CanvasEntityHeader';
|
import { CanvasEntityHeader } from 'features/controlLayers/components/common/CanvasEntityHeader';
|
||||||
import { CanvasEntityTitle } from 'features/controlLayers/components/common/CanvasEntityTitle';
|
import { CanvasEntityTitle } from 'features/controlLayers/components/common/CanvasEntityTitle';
|
||||||
import { IPASettings } from 'features/controlLayers/components/IPAdapter/IPASettings';
|
import { IPAdapterSettings } from 'features/controlLayers/components/IPAdapter/IPAdapterSettings';
|
||||||
import { EntityIdentifierContext } from 'features/controlLayers/contexts/EntityIdentifierContext';
|
import { EntityIdentifierContext } from 'features/controlLayers/contexts/EntityIdentifierContext';
|
||||||
import type { CanvasEntityIdentifier } from 'features/controlLayers/store/types';
|
import type { CanvasEntityIdentifier } from 'features/controlLayers/store/types';
|
||||||
import { memo, useMemo } from 'react';
|
import { memo, useMemo } from 'react';
|
||||||
@ -13,7 +13,7 @@ type Props = {
|
|||||||
id: string;
|
id: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const IPA = memo(({ id }: Props) => {
|
export const IPAdapter = memo(({ id }: Props) => {
|
||||||
const entityIdentifier = useMemo<CanvasEntityIdentifier>(() => ({ id, type: 'ip_adapter' }), [id]);
|
const entityIdentifier = useMemo<CanvasEntityIdentifier>(() => ({ id, type: 'ip_adapter' }), [id]);
|
||||||
const { isOpen, onToggle } = useDisclosure({ defaultIsOpen: true });
|
const { isOpen, onToggle } = useDisclosure({ defaultIsOpen: true });
|
||||||
|
|
||||||
@ -26,10 +26,10 @@ export const IPA = memo(({ id }: Props) => {
|
|||||||
<Spacer />
|
<Spacer />
|
||||||
<CanvasEntityDeleteButton />
|
<CanvasEntityDeleteButton />
|
||||||
</CanvasEntityHeader>
|
</CanvasEntityHeader>
|
||||||
{isOpen && <IPASettings />}
|
{isOpen && <IPAdapterSettings />}
|
||||||
</CanvasEntityContainer>
|
</CanvasEntityContainer>
|
||||||
</EntityIdentifierContext.Provider>
|
</EntityIdentifierContext.Provider>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
IPA.displayName = 'IPA';
|
IPAdapter.displayName = 'IPAdapter';
|
@ -22,7 +22,7 @@ type Props = {
|
|||||||
postUploadAction: PostUploadAction;
|
postUploadAction: PostUploadAction;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const IPAImagePreview = memo(({ image, onChangeImage, ipAdapterId, droppableData, postUploadAction }: Props) => {
|
export const IPAdapterImagePreview = memo(({ image, onChangeImage, ipAdapterId, droppableData, postUploadAction }: Props) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const isConnected = useAppSelector((s) => s.system.isConnected);
|
const isConnected = useAppSelector((s) => s.system.isConnected);
|
||||||
@ -97,4 +97,4 @@ export const IPAImagePreview = memo(({ image, onChangeImage, ipAdapterId, droppa
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
IPAImagePreview.displayName = 'IPAImagePreview';
|
IPAdapterImagePreview.displayName = 'IPAdapterImagePreview';
|
@ -2,7 +2,7 @@
|
|||||||
import { createMemoizedSelector } from 'app/store/createMemoizedSelector';
|
import { createMemoizedSelector } from 'app/store/createMemoizedSelector';
|
||||||
import { useAppSelector } from 'app/store/storeHooks';
|
import { useAppSelector } from 'app/store/storeHooks';
|
||||||
import { CanvasEntityGroupTitle } from 'features/controlLayers/components/common/CanvasEntityGroupTitle';
|
import { CanvasEntityGroupTitle } from 'features/controlLayers/components/common/CanvasEntityGroupTitle';
|
||||||
import { IPA } from 'features/controlLayers/components/IPAdapter/IPA';
|
import { IPAdapter } from 'features/controlLayers/components/IPAdapter/IPAdapter';
|
||||||
import { mapId } from 'features/controlLayers/konva/util';
|
import { mapId } from 'features/controlLayers/konva/util';
|
||||||
import { selectCanvasV2Slice } from 'features/controlLayers/store/canvasV2Slice';
|
import { selectCanvasV2Slice } from 'features/controlLayers/store/canvasV2Slice';
|
||||||
import { memo } from 'react';
|
import { memo } from 'react';
|
||||||
@ -12,7 +12,7 @@ const selectEntityIds = createMemoizedSelector(selectCanvasV2Slice, (canvasV2) =
|
|||||||
return canvasV2.ipAdapters.entities.map(mapId).reverse();
|
return canvasV2.ipAdapters.entities.map(mapId).reverse();
|
||||||
});
|
});
|
||||||
|
|
||||||
export const IPAEntityList = memo(() => {
|
export const IPAdapterList = memo(() => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const isSelected = useAppSelector((s) => Boolean(s.canvasV2.selectedEntityIdentifier?.type === 'ip_adapter'));
|
const isSelected = useAppSelector((s) => Boolean(s.canvasV2.selectedEntityIdentifier?.type === 'ip_adapter'));
|
||||||
const ipaIds = useAppSelector(selectEntityIds);
|
const ipaIds = useAppSelector(selectEntityIds);
|
||||||
@ -29,11 +29,11 @@ export const IPAEntityList = memo(() => {
|
|||||||
isSelected={isSelected}
|
isSelected={isSelected}
|
||||||
/>
|
/>
|
||||||
{ipaIds.map((id) => (
|
{ipaIds.map((id) => (
|
||||||
<IPA key={id} id={id} />
|
<IPAdapter key={id} id={id} />
|
||||||
))}
|
))}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
IPAEntityList.displayName = 'IPAEntityList';
|
IPAdapterList.displayName = 'IPAdapterList';
|
@ -12,7 +12,7 @@ type Props = {
|
|||||||
onChange: (method: IPMethodV2) => void;
|
onChange: (method: IPMethodV2) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const IPAMethod = memo(({ method, onChange }: Props) => {
|
export const IPAdapterMethod = memo(({ method, onChange }: Props) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const options: { label: string; value: IPMethodV2 }[] = useMemo(
|
const options: { label: string; value: IPMethodV2 }[] = useMemo(
|
||||||
() => [
|
() => [
|
||||||
@ -41,4 +41,4 @@ export const IPAMethod = memo(({ method, onChange }: Props) => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
IPAMethod.displayName = 'IPAMethod';
|
IPAdapterMethod.displayName = 'IPAdapterMethod';
|
@ -22,7 +22,7 @@ type Props = {
|
|||||||
onChangeCLIPVisionModel: (clipVisionModel: CLIPVisionModelV2) => void;
|
onChangeCLIPVisionModel: (clipVisionModel: CLIPVisionModelV2) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const IPAModelCombobox = memo(({ modelKey, onChangeModel, clipVisionModel, onChangeCLIPVisionModel }: Props) => {
|
export const IPAdapterModel = memo(({ modelKey, onChangeModel, clipVisionModel, onChangeCLIPVisionModel }: Props) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const currentBaseModel = useAppSelector((s) => s.canvasV2.params.model?.base);
|
const currentBaseModel = useAppSelector((s) => s.canvasV2.params.model?.base);
|
||||||
const [modelConfigs, { isLoading }] = useIPAdapterModels();
|
const [modelConfigs, { isLoading }] = useIPAdapterModels();
|
||||||
@ -95,4 +95,4 @@ export const IPAModelCombobox = memo(({ modelKey, onChangeModel, clipVisionModel
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
IPAModelCombobox.displayName = 'IPAModelCombobox';
|
IPAdapterModel.displayName = 'IPAdapterModel';
|
@ -3,7 +3,7 @@ import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
|||||||
import { BeginEndStepPct } from 'features/controlLayers/components/common/BeginEndStepPct';
|
import { BeginEndStepPct } from 'features/controlLayers/components/common/BeginEndStepPct';
|
||||||
import { CanvasEntitySettings } from 'features/controlLayers/components/common/CanvasEntitySettings';
|
import { CanvasEntitySettings } from 'features/controlLayers/components/common/CanvasEntitySettings';
|
||||||
import { Weight } from 'features/controlLayers/components/common/Weight';
|
import { Weight } from 'features/controlLayers/components/common/Weight';
|
||||||
import { IPAMethod } from 'features/controlLayers/components/IPAdapter/IPAMethod';
|
import { IPAdapterMethod } from 'features/controlLayers/components/IPAdapter/IPAdapterMethod';
|
||||||
import { useEntityIdentifierContext } from 'features/controlLayers/contexts/EntityIdentifierContext';
|
import { useEntityIdentifierContext } from 'features/controlLayers/contexts/EntityIdentifierContext';
|
||||||
import {
|
import {
|
||||||
ipaBeginEndStepPctChanged,
|
ipaBeginEndStepPctChanged,
|
||||||
@ -19,10 +19,10 @@ import type { IPAImageDropData } from 'features/dnd/types';
|
|||||||
import { memo, useCallback, useMemo } from 'react';
|
import { memo, useCallback, useMemo } from 'react';
|
||||||
import type { ImageDTO, IPAdapterModelConfig, IPALayerImagePostUploadAction } from 'services/api/types';
|
import type { ImageDTO, IPAdapterModelConfig, IPALayerImagePostUploadAction } from 'services/api/types';
|
||||||
|
|
||||||
import { IPAImagePreview } from './IPAImagePreview';
|
import { IPAdapterImagePreview } from './IPAdapterImagePreview';
|
||||||
import { IPAModelCombobox } from './IPAModelCombobox';
|
import { IPAdapterModel } from './IPAdapterModel';
|
||||||
|
|
||||||
export const IPASettings = memo(() => {
|
export const IPAdapterSettings = memo(() => {
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const { id } = useEntityIdentifierContext();
|
const { id } = useEntityIdentifierContext();
|
||||||
const ipAdapter = useAppSelector((s) => selectIPAOrThrow(s.canvasV2, id));
|
const ipAdapter = useAppSelector((s) => selectIPAOrThrow(s.canvasV2, id));
|
||||||
@ -77,7 +77,7 @@ export const IPASettings = memo(() => {
|
|||||||
<Flex flexDir="column" gap={4} position="relative" w="full">
|
<Flex flexDir="column" gap={4} position="relative" w="full">
|
||||||
<Flex gap={3} alignItems="center" w="full">
|
<Flex gap={3} alignItems="center" w="full">
|
||||||
<Box minW={0} w="full" transitionProperty="common" transitionDuration="0.1s">
|
<Box minW={0} w="full" transitionProperty="common" transitionDuration="0.1s">
|
||||||
<IPAModelCombobox
|
<IPAdapterModel
|
||||||
modelKey={ipAdapter.model?.key ?? null}
|
modelKey={ipAdapter.model?.key ?? null}
|
||||||
onChangeModel={onChangeModel}
|
onChangeModel={onChangeModel}
|
||||||
clipVisionModel={ipAdapter.clipVisionModel}
|
clipVisionModel={ipAdapter.clipVisionModel}
|
||||||
@ -87,12 +87,12 @@ export const IPASettings = memo(() => {
|
|||||||
</Flex>
|
</Flex>
|
||||||
<Flex gap={4} w="full" alignItems="center">
|
<Flex gap={4} w="full" alignItems="center">
|
||||||
<Flex flexDir="column" gap={3} w="full">
|
<Flex flexDir="column" gap={3} w="full">
|
||||||
<IPAMethod method={ipAdapter.method} onChange={onChangeIPMethod} />
|
<IPAdapterMethod method={ipAdapter.method} onChange={onChangeIPMethod} />
|
||||||
<Weight weight={ipAdapter.weight} onChange={onChangeWeight} />
|
<Weight weight={ipAdapter.weight} onChange={onChangeWeight} />
|
||||||
<BeginEndStepPct beginEndStepPct={ipAdapter.beginEndStepPct} onChange={onChangeBeginEndStepPct} />
|
<BeginEndStepPct beginEndStepPct={ipAdapter.beginEndStepPct} onChange={onChangeBeginEndStepPct} />
|
||||||
</Flex>
|
</Flex>
|
||||||
<Flex alignItems="center" justifyContent="center" h={36} w={36} aspectRatio="1/1">
|
<Flex alignItems="center" justifyContent="center" h={36} w={36} aspectRatio="1/1">
|
||||||
<IPAImagePreview
|
<IPAdapterImagePreview
|
||||||
image={ipAdapter.imageObject?.image ?? null}
|
image={ipAdapter.imageObject?.image ?? null}
|
||||||
onChangeImage={onChangeImage}
|
onChangeImage={onChangeImage}
|
||||||
ipAdapterId={ipAdapter.id}
|
ipAdapterId={ipAdapter.id}
|
||||||
@ -106,4 +106,4 @@ export const IPASettings = memo(() => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
IPASettings.displayName = 'IPASettings';
|
IPAdapterSettings.displayName = 'IPAdapterSettings';
|
@ -2,9 +2,9 @@ import { Box, Flex, IconButton, Spacer, Text } from '@invoke-ai/ui-library';
|
|||||||
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
||||||
import { BeginEndStepPct } from 'features/controlLayers/components/common/BeginEndStepPct';
|
import { BeginEndStepPct } from 'features/controlLayers/components/common/BeginEndStepPct';
|
||||||
import { Weight } from 'features/controlLayers/components/common/Weight';
|
import { Weight } from 'features/controlLayers/components/common/Weight';
|
||||||
import { IPAImagePreview } from 'features/controlLayers/components/IPAdapter/IPAImagePreview';
|
import { IPAdapterImagePreview } from 'features/controlLayers/components/IPAdapter/IPAdapterImagePreview';
|
||||||
import { IPAMethod } from 'features/controlLayers/components/IPAdapter/IPAMethod';
|
import { IPAdapterMethod } from 'features/controlLayers/components/IPAdapter/IPAdapterMethod';
|
||||||
import { IPAModelCombobox } from 'features/controlLayers/components/IPAdapter/IPAModelCombobox';
|
import { IPAdapterModel } from 'features/controlLayers/components/IPAdapter/IPAdapterModel';
|
||||||
import {
|
import {
|
||||||
rgIPAdapterBeginEndStepPctChanged,
|
rgIPAdapterBeginEndStepPctChanged,
|
||||||
rgIPAdapterCLIPVisionModelChanged,
|
rgIPAdapterCLIPVisionModelChanged,
|
||||||
@ -107,7 +107,7 @@ export const RGIPAdapterSettings = memo(({ id, ipAdapterId, ipAdapterNumber }: P
|
|||||||
<Flex flexDir="column" gap={4} position="relative" w="full">
|
<Flex flexDir="column" gap={4} position="relative" w="full">
|
||||||
<Flex gap={3} alignItems="center" w="full">
|
<Flex gap={3} alignItems="center" w="full">
|
||||||
<Box minW={0} w="full" transitionProperty="common" transitionDuration="0.1s">
|
<Box minW={0} w="full" transitionProperty="common" transitionDuration="0.1s">
|
||||||
<IPAModelCombobox
|
<IPAdapterModel
|
||||||
modelKey={ipAdapter.model?.key ?? null}
|
modelKey={ipAdapter.model?.key ?? null}
|
||||||
onChangeModel={onChangeModel}
|
onChangeModel={onChangeModel}
|
||||||
clipVisionModel={ipAdapter.clipVisionModel}
|
clipVisionModel={ipAdapter.clipVisionModel}
|
||||||
@ -117,12 +117,12 @@ export const RGIPAdapterSettings = memo(({ id, ipAdapterId, ipAdapterNumber }: P
|
|||||||
</Flex>
|
</Flex>
|
||||||
<Flex gap={4} w="full" alignItems="center">
|
<Flex gap={4} w="full" alignItems="center">
|
||||||
<Flex flexDir="column" gap={3} w="full">
|
<Flex flexDir="column" gap={3} w="full">
|
||||||
<IPAMethod method={ipAdapter.method} onChange={onChangeIPMethod} />
|
<IPAdapterMethod method={ipAdapter.method} onChange={onChangeIPMethod} />
|
||||||
<Weight weight={ipAdapter.weight} onChange={onChangeWeight} />
|
<Weight weight={ipAdapter.weight} onChange={onChangeWeight} />
|
||||||
<BeginEndStepPct beginEndStepPct={ipAdapter.beginEndStepPct} onChange={onChangeBeginEndStepPct} />
|
<BeginEndStepPct beginEndStepPct={ipAdapter.beginEndStepPct} onChange={onChangeBeginEndStepPct} />
|
||||||
</Flex>
|
</Flex>
|
||||||
<Flex alignItems="center" justifyContent="center" h={36} w={36} aspectRatio="1/1">
|
<Flex alignItems="center" justifyContent="center" h={36} w={36} aspectRatio="1/1">
|
||||||
<IPAImagePreview
|
<IPAdapterImagePreview
|
||||||
image={ipAdapter.imageObject?.image ?? null}
|
image={ipAdapter.imageObject?.image ?? null}
|
||||||
onChangeImage={onChangeImage}
|
onChangeImage={onChangeImage}
|
||||||
ipAdapterId={ipAdapter.id}
|
ipAdapterId={ipAdapter.id}
|
||||||
|
Loading…
Reference in New Issue
Block a user