Skip to content

Commit db451b7

Browse files
Copilothotlong
andcommitted
fix: address code review feedback - make UI text configurable for i18n
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 40ee48e commit db451b7

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

packages/components/src/renderers/navigation/header-bar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ ComponentRegistry.register('header-bar',
8282
<Search className="absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" />
8383
<Input
8484
type="search"
85-
placeholder={schema.search.placeholder || 'Search...'}
85+
placeholder={schema.search.placeholder}
8686
className="pl-8 w-[200px] lg:w-[300px]"
8787
/>
8888
{schema.search.shortcut && (

packages/layout/src/SidebarNav.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export interface SidebarNavProps {
4040
className?: string;
4141
collapsible?: "offcanvas" | "icon" | "none";
4242
searchEnabled?: boolean;
43+
searchPlaceholder?: string;
4344
}
4445

4546
function isNavGroup(item: NavItem | NavGroup): item is NavGroup {
@@ -104,7 +105,7 @@ function NavItemRenderer({ item, pathname }: { item: NavItem; pathname: string }
104105
);
105106
}
106107

107-
export function SidebarNav({ items, title = "Application", className, collapsible = "icon", searchEnabled = false }: SidebarNavProps) {
108+
export function SidebarNav({ items, title = "Application", className, collapsible = "icon", searchEnabled = false, searchPlaceholder = "Search..." }: SidebarNavProps) {
108109
const location = useLocation();
109110
const [search, setSearch] = React.useState('');
110111

@@ -137,7 +138,7 @@ export function SidebarNav({ items, title = "Application", className, collapsibl
137138
<Search className="absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" />
138139
<Input
139140
type="search"
140-
placeholder="Search..."
141+
placeholder={searchPlaceholder}
141142
value={search}
142143
onChange={(e) => setSearch(e.target.value)}
143144
className="pl-8 h-9"

packages/plugin-view/src/ViewSwitcher.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export type ViewSwitcherProps = {
4949
onViewChange?: (view: ViewType) => void;
5050
onCreateView?: () => void;
5151
onViewAction?: (action: string, view: ViewType) => void;
52+
createViewLabel?: string;
5253
[key: string]: any;
5354
};
5455

@@ -169,12 +170,20 @@ const DEFAULT_VIEW_ACTION_ICONS: Record<string, LucideIcon> = {
169170
delete: Trash2,
170171
};
171172

173+
const DEFAULT_VIEW_ACTION_LABELS: Record<string, string> = {
174+
share: 'Share',
175+
settings: 'Settings',
176+
duplicate: 'Duplicate',
177+
delete: 'Delete',
178+
};
179+
172180
export const ViewSwitcher: React.FC<ViewSwitcherProps> = ({
173181
schema,
174182
className,
175183
onViewChange,
176184
onCreateView,
177185
onViewAction,
186+
createViewLabel = 'Create view',
178187
...props
179188
}) => {
180189
const storageKey = React.useMemo(() => {
@@ -254,7 +263,7 @@ export const ViewSwitcher: React.FC<ViewSwitcherProps> = ({
254263
variant="ghost"
255264
size="icon-sm"
256265
onClick={() => onViewAction?.(action.type, currentView!)}
257-
title={action.type}
266+
title={DEFAULT_VIEW_ACTION_LABELS[action.type] || action.type}
258267
>
259268
{ActionIcon ? <ActionIcon className="h-3.5 w-3.5" /> : null}
260269
</Button>
@@ -269,7 +278,7 @@ export const ViewSwitcher: React.FC<ViewSwitcherProps> = ({
269278
variant="ghost"
270279
size="icon-sm"
271280
onClick={() => onCreateView?.()}
272-
title="Create view"
281+
title={createViewLabel}
273282
>
274283
<Plus className="h-3.5 w-3.5" />
275284
</Button>

0 commit comments

Comments
 (0)