Skip to content

Commit eca8efc

Browse files
authored
Merge pull request #901 from objectstack-ai/copilot/fix-type-assignments-errors
2 parents c2f7d73 + 9b38f3e commit eca8efc

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

packages/plugin-designer/src/AppCreationWizard.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import {
4848
} from 'lucide-react';
4949
import { clsx } from 'clsx';
5050
import { twMerge } from 'tailwind-merge';
51+
import { resolveI18nLabel } from '@object-ui/react';
5152
import { useDesignerTranslation } from './hooks/useDesignerTranslation';
5253
import { useConfirmDialog } from './hooks/useConfirmDialog';
5354

@@ -524,7 +525,7 @@ function NavigationBuilderStep({
524525
<span className="text-xs text-gray-400">{item.icon}</span>
525526
)}
526527
<span className="flex-1 truncate text-sm text-gray-800">
527-
{item.type === 'separator' ? t('appDesigner.separatorLabel') : item.label}
528+
{item.type === 'separator' ? t('appDesigner.separatorLabel') : resolveI18nLabel(item.label)}
528529
</span>
529530
<span
530531
className={cn(

packages/plugin-designer/src/NavigationDesigner.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import {
4040
} from 'lucide-react';
4141
import { clsx } from 'clsx';
4242
import { twMerge } from 'tailwind-merge';
43+
import { resolveI18nLabel } from '@object-ui/react';
4344
import { useDesignerTranslation } from './hooks/useDesignerTranslation';
4445

4546
function cn(...inputs: (string | undefined | false)[]) {
@@ -139,7 +140,7 @@ function NavItemRow({
139140
t,
140141
}: NavItemRowProps) {
141142
const [editingLabel, setEditingLabel] = useState(false);
142-
const [labelDraft, setLabelDraft] = useState(item.label);
143+
const [labelDraft, setLabelDraft] = useState(resolveI18nLabel(item.label) ?? '');
143144
const [editingIcon, setEditingIcon] = useState(false);
144145
const [iconDraft, setIconDraft] = useState(item.icon || '');
145146
const meta = NAV_TYPE_META[item.type];
@@ -151,7 +152,7 @@ function NavItemRow({
151152
if (labelDraft.trim()) {
152153
onUpdateLabel(item.id, labelDraft.trim());
153154
} else {
154-
setLabelDraft(item.label);
155+
setLabelDraft(resolveI18nLabel(item.label) ?? '');
155156
}
156157
setEditingLabel(false);
157158
};
@@ -243,7 +244,7 @@ function NavItemRow({
243244
onKeyDown={(e) => {
244245
if (e.key === 'Enter') handleLabelCommit();
245246
if (e.key === 'Escape') {
246-
setLabelDraft(item.label);
247+
setLabelDraft(resolveI18nLabel(item.label) ?? '');
247248
setEditingLabel(false);
248249
}
249250
}}
@@ -258,12 +259,12 @@ function NavItemRow({
258259
)}
259260
onDoubleClick={() => {
260261
if (!readOnly && item.type !== 'separator') {
261-
setLabelDraft(item.label);
262+
setLabelDraft(resolveI18nLabel(item.label) ?? '');
262263
setEditingLabel(true);
263264
}
264265
}}
265266
>
266-
{item.label}
267+
{resolveI18nLabel(item.label)}
267268
</span>
268269
)}
269270

@@ -410,7 +411,7 @@ function PreviewItem({ item, depth }: { item: NavigationItem; depth: number }) {
410411
style={{ marginLeft: depth * 12 }}
411412
>
412413
<meta.Icon className="h-3 w-3 text-gray-400" />
413-
<span className="truncate">{item.label}</span>
414+
<span className="truncate">{resolveI18nLabel(item.label)}</span>
414415
</li>
415416
{item.type === 'group' && item.children?.map((child) => (
416417
<PreviewItem key={child.id} item={child} depth={depth + 1} />

packages/react/src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ export * from './components/form';
1313
export * from './LazyPluginLoader';
1414
export * from './spec-bridge';
1515

16+
// i18n utilities
17+
export { resolveI18nLabel } from './utils/i18n';
18+
1619
// Built-in i18n support
1720
export {
1821
I18nProvider,

0 commit comments

Comments
 (0)