Skip to content

Commit 783a44e

Browse files
fix(ui): add missing builder translations
1 parent 7399909 commit 783a44e

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

invokeai/frontend/web/public/locales/en.json

+4
Original file line numberDiff line numberDiff line change
@@ -1726,6 +1726,10 @@
17261726
"layout": "Layout",
17271727
"row": "Row",
17281728
"column": "Column",
1729+
"container": "Container",
1730+
"heading": "Heading",
1731+
"text": "Text",
1732+
"divider": "Divider",
17291733
"nodeField": "Node Field",
17301734
"zoomToNode": "Zoom to Node",
17311735
"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.",

invokeai/frontend/web/src/features/nodes/components/sidePanel/builder/WorkflowBuilder.tsx

+10-8
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ import { $hasTemplates } from 'features/nodes/store/nodesSlice';
1414
import { selectIsFormEmpty } from 'features/nodes/store/workflowSlice';
1515
import type { FormElement } from 'features/nodes/types/workflow';
1616
import { buildContainer, buildDivider, buildHeading, buildText } from 'features/nodes/types/workflow';
17-
import { startCase } from 'lodash-es';
18-
import type { RefObject } from 'react';
17+
import type { PropsWithChildren, RefObject } from 'react';
1918
import { memo, useEffect, useRef, useState } from 'react';
2019
import { useTranslation } from 'react-i18next';
2120
import { useGetOpenAPISchemaQuery } from 'services/api/endpoints/appInfo';
@@ -39,10 +38,10 @@ export const WorkflowBuilder = memo(() => {
3938
<Flex justifyContent="center" w="full" h="full">
4039
<Flex flexDir="column" w="full" maxW="768px" gap={2}>
4140
<Flex w="full" alignItems="center" gap={2} pt={3}>
42-
<AddFormElementDndButton type="container" />
43-
<AddFormElementDndButton type="divider" />
44-
<AddFormElementDndButton type="heading" />
45-
<AddFormElementDndButton type="text" />
41+
<AddFormElementDndButton type="container">{t('workflows.builder.container')}</AddFormElementDndButton>
42+
<AddFormElementDndButton type="divider">{t('workflows.builder.divider')}</AddFormElementDndButton>
43+
<AddFormElementDndButton type="heading">{t('workflows.builder.heading')}</AddFormElementDndButton>
44+
<AddFormElementDndButton type="text">{t('workflows.builder.text')}</AddFormElementDndButton>
4645
<Button size="sm" variant="ghost" tooltip={t('workflows.builder.nodeFieldTooltip')}>
4746
{t('workflows.builder.nodeField')}
4847
</Button>
@@ -130,14 +129,17 @@ const addFormElementButtonSx: SystemStyleObject = {
130129
_disabled: { borderStyle: 'dashed', opacity: 0.5 },
131130
};
132131

133-
const AddFormElementDndButton = ({ type }: { type: Parameters<typeof useAddFormElementDnd>[0] }) => {
132+
const AddFormElementDndButton = ({
133+
type,
134+
children,
135+
}: PropsWithChildren<{ type: Parameters<typeof useAddFormElementDnd>[0] }>) => {
134136
const draggableRef = useRef<HTMLDivElement>(null);
135137
const isDragging = useAddFormElementDnd(type, draggableRef);
136138

137139
return (
138140
// Must be as div for draggable to work correctly
139141
<Button as="div" ref={draggableRef} size="sm" isDisabled={isDragging} variant="outline" sx={addFormElementButtonSx}>
140-
{startCase(type)}
142+
{children}
141143
</Button>
142144
);
143145
};

0 commit comments

Comments
 (0)