mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-04-23 03:00:31 -04:00
feat(ui): empty state for drop containers
This commit is contained in:
@@ -1707,7 +1707,8 @@
|
||||
"component": "Component",
|
||||
"numberInput": "Number Input",
|
||||
"slider": "Slider",
|
||||
"both": "Both"
|
||||
"both": "Both",
|
||||
"emptyContainerPlaceholder": "Drag an element into this container."
|
||||
}
|
||||
},
|
||||
"controlLayers": {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Flex, type SystemStyleObject } from '@invoke-ai/ui-library';
|
||||
import type { SystemStyleObject } from '@invoke-ai/ui-library';
|
||||
import { Flex, Text } from '@invoke-ai/ui-library';
|
||||
import { useAppSelector } from 'app/store/storeHooks';
|
||||
import {
|
||||
ContainerContextProvider,
|
||||
@@ -21,6 +22,7 @@ import {
|
||||
isTextElement,
|
||||
} from 'features/nodes/types/workflow';
|
||||
import { memo } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import type { Equals } from 'tsafe';
|
||||
import { assert } from 'tsafe';
|
||||
|
||||
@@ -72,6 +74,7 @@ export const ContainerElementComponentViewMode = memo(({ el }: { el: ContainerEl
|
||||
ContainerElementComponentViewMode.displayName = 'ContainerElementComponentViewMode';
|
||||
|
||||
export const ContainerElementComponentEditMode = memo(({ el }: { el: ContainerElement }) => {
|
||||
const { t } = useTranslation();
|
||||
const depth = useDepthContext();
|
||||
const { id, data } = el;
|
||||
const { children, layout } = data;
|
||||
@@ -84,6 +87,11 @@ export const ContainerElementComponentEditMode = memo(({ el }: { el: ContainerEl
|
||||
{children.map((childId) => (
|
||||
<FormElementComponent key={childId} id={childId} />
|
||||
))}
|
||||
{children.length === 0 && (
|
||||
<Flex p={4} w="full" h="full" alignItems="center" justifyContent="center">
|
||||
<Text variant="subtext">{t('workflows.builder.emptyContainerPlaceholder')}</Text>
|
||||
</Flex>
|
||||
)}
|
||||
</Flex>
|
||||
</ContainerContextProvider>
|
||||
</DepthContextProvider>
|
||||
|
||||
@@ -24,6 +24,8 @@ const sx: SystemStyleObject = {
|
||||
w: 'full',
|
||||
ps: 2,
|
||||
h: 8,
|
||||
minH: 8,
|
||||
maxH: 8,
|
||||
borderTopRadius: 'inherit',
|
||||
borderColor: 'inherit',
|
||||
alignItems: 'center',
|
||||
|
||||
Reference in New Issue
Block a user