fix: satisfy localization build

This commit is contained in:
lucaronin
2026-04-26 19:39:56 +02:00
parent a2f8ba72a2
commit 943fa854e1
2 changed files with 12 additions and 8 deletions

View File

@@ -68,13 +68,17 @@ export function ViewsSection({
<div className="border-b border-border" style={{ padding: '0 6px' }}>
<SidebarGroupHeader label={translate(locale, 'sidebar.group.views')} collapsed={collapsed} onToggle={onToggle}>
{onCreateView && (
<Plus
size={12}
className="text-muted-foreground hover:text-foreground"
<Button
type="button"
variant="ghost"
size="icon-xs"
className="h-auto w-auto min-w-0 rounded-none p-0 text-muted-foreground hover:bg-transparent hover:text-foreground"
aria-label={translate(locale, 'sidebar.action.createView')}
title={translate(locale, 'sidebar.action.createView')}
onClick={(event) => { event.stopPropagation(); onCreateView() }}
/>
>
<Plus size={12} className="text-muted-foreground hover:text-foreground" />
</Button>
)}
</SidebarGroupHeader>
{!collapsed && (

View File

@@ -12,7 +12,7 @@ const GROUP_LABEL_KEYS = {
Settings: 'command.group.settings',
} satisfies Record<CommandGroup, TranslationKey>
const STATIC_LABEL_KEYS = {
const STATIC_LABEL_KEYS: Partial<Record<string, TranslationKey>> = {
'search-notes': 'command.navigation.searchNotes',
'go-all': 'command.navigation.goAllNotes',
'go-archived': 'command.navigation.goArchived',
@@ -59,7 +59,7 @@ const STATIC_LABEL_KEYS = {
'repair-vault': 'command.settings.repairVault',
'open-ai-agents': 'command.ai.openAgents',
'restore-vault-ai-guidance': 'command.ai.restoreGuidance',
} satisfies Record<string, TranslationKey>
}
function stripKnownPrefix(label: string, prefix: string): string {
return label.startsWith(prefix) ? label.slice(prefix.length) : label
@@ -91,12 +91,12 @@ function localizeColumnsCommand(command: CommandAction, t: Translate): string {
return t('noteList.properties.customizeColumns')
}
const VIEW_STATE_LABELERS = {
const VIEW_STATE_LABELERS: Partial<Record<string, CommandLabeler>> = {
'toggle-note-layout': (command, t) => t(command.label === 'Use Left-Aligned Note Layout' ? 'command.view.leftLayout' : 'command.view.centerLayout'),
'zoom-in': (command, t) => t('command.view.zoomIn', { zoom: parenthesizedSuffix(command.label)?.replace('%', '') ?? '' }),
'zoom-out': (command, t) => t('command.view.zoomOut', { zoom: parenthesizedSuffix(command.label)?.replace('%', '') ?? '' }),
'customize-note-list-columns': localizeColumnsCommand,
} satisfies Record<string, CommandLabeler>
}
function localizeViewStateCommand(command: CommandAction, t: Translate): string | null {
return VIEW_STATE_LABELERS[command.id]?.(command, t) ?? null