Skip to content

Commit

Permalink
fix(ui): add missing builder translations
Browse files Browse the repository at this point in the history
  • Loading branch information
psychedelicious committed Mar 3, 2025
1 parent 7399909 commit b03e429
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
4 changes: 4 additions & 0 deletions invokeai/frontend/web/public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1726,6 +1726,10 @@
"layout": "Layout",
"row": "Row",
"column": "Column",
"container": "Container",
"heading": "Heading",
"text": "Text",
"divider": "Divider",
"nodeField": "Node Field",
"zoomToNode": "Zoom to Node",
"nodeFieldTooltip": "To add a node field, click the small plus sign button on the field in the Workflow Editor, or drag the field by its name into the form.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ import { $hasTemplates } from 'features/nodes/store/nodesSlice';
import { selectIsFormEmpty } from 'features/nodes/store/workflowSlice';
import type { FormElement } from 'features/nodes/types/workflow';
import { buildContainer, buildDivider, buildHeading, buildText } from 'features/nodes/types/workflow';
import { startCase } from 'lodash-es';
import type { RefObject } from 'react';
import type { PropsWithChildren, RefObject } from 'react';
import { memo, useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useGetOpenAPISchemaQuery } from 'services/api/endpoints/appInfo';
Expand All @@ -39,10 +38,10 @@ export const WorkflowBuilder = memo(() => {
<Flex justifyContent="center" w="full" h="full">
<Flex flexDir="column" w="full" maxW="768px" gap={2}>
<Flex w="full" alignItems="center" gap={2} pt={3}>
<AddFormElementDndButton type="container" />
<AddFormElementDndButton type="divider" />
<AddFormElementDndButton type="heading" />
<AddFormElementDndButton type="text" />
<AddFormElementDndButton type="container">{t('workflows.builder.container')}</AddFormElementDndButton>
<AddFormElementDndButton type="divider">{t('workflows.builder.divider')}</AddFormElementDndButton>
<AddFormElementDndButton type="heading">{t('workflows.builder.heading')}</AddFormElementDndButton>
<AddFormElementDndButton type="text">{t('workflows.builder.text')}</AddFormElementDndButton>
<Button size="sm" variant="ghost" tooltip={t('workflows.builder.nodeFieldTooltip')}>
{t('workflows.builder.nodeField')}
</Button>
Expand Down Expand Up @@ -130,14 +129,17 @@ const addFormElementButtonSx: SystemStyleObject = {
_disabled: { borderStyle: 'dashed', opacity: 0.5 },
};

const AddFormElementDndButton = ({ type }: { type: Parameters<typeof useAddFormElementDnd>[0] }) => {
const AddFormElementDndButton = ({
type,
children,
}: PropsWithChildren<{ type: Parameters<typeof useAddFormElementDnd>[0] }>) => {
const draggableRef = useRef<HTMLDivElement>(null);
const isDragging = useAddFormElementDnd(type, draggableRef);

return (
// Must be as div for draggable to work correctly
<Button as="div" ref={draggableRef} size="sm" isDisabled={isDragging} variant="outline" sx={addFormElementButtonSx}>
{startCase(type)}
{children}
</Button>
);
};

0 comments on commit b03e429

Please sign in to comment.