GUI: fix sidebar icons and create modal with template selection

- Add TemplateIcon.svelte with SVG icons for folder/project/client/document/recipe
- TreeNode.svelte: render type-based icon before each node label
- Create modal: show template selection cards (translate titles via t())
- Context menu: use TemplateIcon + translated template names
- i18n (ru/en): add template.* translation keys
- Fix white capsule issue: tree-toggle arrow at 10px rendered oddly
  without icon presence; replaced with proper SVG icons
This commit is contained in:
2026-06-03 02:29:11 +08:00
parent d285f9ad8b
commit b26b757d80
5 changed files with 114 additions and 5 deletions
+40
View File
@@ -0,0 +1,40 @@
<script>
export let kind = 'generic'
export let size = 18
</script>
<svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg">
{#if kind === 'folder'}
<path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"/>
{:else if kind === 'project'}
<rect x="3" y="3" width="7" height="7" rx="1"/>
<rect x="14" y="3" width="7" height="4" rx="1"/>
<rect x="14" y="10" width="7" height="11" rx="1"/>
<rect x="3" y="14" width="7" height="7" rx="1"/>
{:else if kind === 'client'}
<path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/>
<circle cx="12" cy="7" r="4"/>
{:else if kind === 'document'}
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
<polyline points="14 2 14 8 20 8"/>
<line x1="16" y1="13" x2="8" y2="13"/>
<line x1="16" y1="17" x2="8" y2="17"/>
{:else if kind === 'recipe'}
<path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"/>
<path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"/>
<line x1="8" y1="7" x2="16" y2="7"/>
<line x1="8" y1="11" x2="14" y2="11"/>
<line x1="8" y1="15" x2="12" y2="15"/>
{:else if kind === 'note'}
<path d="M12 20h9"/>
<path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"/>
{:else if kind === 'file'}
<path d="M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"/>
<polyline points="13 2 13 9 20 9"/>
{:else}
<circle cx="12" cy="12" r="10"/>
<line x1="12" y1="16" x2="12" y2="12"/>
<line x1="12" y1="8" x2="12.01" y2="8"/>
{/if}
</svg>
+9
View File
@@ -80,6 +80,15 @@ export default {
'sync.notConnected': 'Not connected',
'sync.disabled': 'Disabled',
'template.optionNone': 'No template',
'template.optional': 'Template (optional)',
'template.folder': 'Folder',
'template.project': 'Project',
'template.client': 'Client',
'template.document': 'Document',
'template.recipe': 'Recipe',
'template.select': 'Select template',
'error.generic': 'An error occurred',
'error.invalidCredentials': 'Invalid username or password',
}
+6
View File
@@ -216,6 +216,12 @@ export default {
'template.optionNone': 'Без шаблона',
'template.optional': 'Шаблон (опционально)',
'template.folder': 'Папка',
'template.project': 'Проект',
'template.client': 'Клиент',
'template.document': 'Документ',
'template.recipe': 'Рецепт',
'template.select': 'Выберите шаблон',
'mime.jpeg': 'Изображение JPEG',
'mime.png': 'Изображение PNG',