diff --git a/src/lib/components/chat/FileNav.svelte b/src/lib/components/chat/FileNav.svelte
index 2c82ef9abe..c4e645bbd2 100644
--- a/src/lib/components/chat/FileNav.svelte
+++ b/src/lib/components/chat/FileNav.svelte
@@ -30,8 +30,6 @@
type TerminalCwd
} from '$lib/apis/terminal';
import { isCodeFile } from '$lib/utils/codeHighlight';
- import Folder from '../icons/Folder.svelte';
- import Document from '../icons/Document.svelte';
import PenAlt from '../icons/PenAlt.svelte';
import ZoomReset from '../icons/ZoomReset.svelte';
import { isSavedChatId, isTemporaryChatId } from '$lib/utils/chatId';
@@ -43,6 +41,8 @@
import FileNavToolbar from './FileNav/FileNavToolbar.svelte';
import FilePreview from './FileNav/FilePreview.svelte';
import FileEntryRow from './FileNav/FileEntryRow.svelte';
+ import Icon from './FileNav/Icon.svelte';
+ import FileTypeIcon from './FileNav/FileTypeIcon.svelte';
import BulkActionBar from './FileNav/BulkActionBar.svelte';
import PortList from './FileNav/PortList.svelte';
import PortPreview from './FileNav/PortPreview.svelte';
@@ -1014,14 +1014,14 @@
-
+
{$i18n.t('Start the chat to use this terminal.')}
{:else if !selectedTerminal}
-
+
{$i18n.t('No Terminal connection configured.')}
@@ -1451,7 +1451,7 @@
{#if !loading && !error && !uploading && !($selectedTerminalId && $terminalServers === null)}
{#if creatingFolder}
-
+
-
+
-
+
{$i18n.t('Terminal')}
{#if terminalExpanded}
diff --git a/src/lib/components/chat/FileNav/FileEntryRow.svelte b/src/lib/components/chat/FileNav/FileEntryRow.svelte
index 0dff841d37..defdaab477 100644
--- a/src/lib/components/chat/FileNav/FileEntryRow.svelte
+++ b/src/lib/components/chat/FileNav/FileEntryRow.svelte
@@ -6,11 +6,11 @@
import Dropdown from '$lib/components/common/Dropdown.svelte';
import DropdownMenu from '$lib/components/common/DropdownMenu.svelte';
- import Folder from '../../icons/Folder.svelte';
import EllipsisHorizontal from '../../icons/EllipsisHorizontal.svelte';
import GarbageBin from '../../icons/GarbageBin.svelte';
import Pencil from '../../icons/Pencil.svelte';
import Clipboard from '../../icons/Clipboard.svelte';
+ import FileTypeIcon from './FileTypeIcon.svelte';
const i18n: any = getContext('i18n');
@@ -250,24 +250,7 @@
{/if}
{/if}
- {#if entry.type === 'directory'}
-
- {:else}
-
- {/if}
+
{#if renaming}
+ import Icon from './Icon.svelte';
+ import { fileIconName } from './fileIcon';
+
+ export let name = '';
+ export let type = 'file';
+ export let size = 14;
+ export let strokeWidth = 1.4;
+
+ $: iconName = fileIconName(name, type);
+ $: tone =
+ type === 'directory' ? 'text-gray-500 dark:text-gray-400' : 'text-gray-400 dark:text-gray-500';
+
+
+
diff --git a/src/lib/components/chat/FileNav/Icon.svelte b/src/lib/components/chat/FileNav/Icon.svelte
new file mode 100644
index 0000000000..1227ad1713
--- /dev/null
+++ b/src/lib/components/chat/FileNav/Icon.svelte
@@ -0,0 +1,703 @@
+
+
+
diff --git a/src/lib/components/chat/FileNav/fileIcon.ts b/src/lib/components/chat/FileNav/fileIcon.ts
new file mode 100644
index 0000000000..b7c12397dd
--- /dev/null
+++ b/src/lib/components/chat/FileNav/fileIcon.ts
@@ -0,0 +1,162 @@
+/**
+ * Shared file icon name resolver.
+ * Maps file names/extensions to Icon component names.
+ */
+
+export function fileIconName(name: string, type: string = 'file'): string {
+ if (type === 'directory') return 'folder';
+ const base = name.split('/').pop() ?? name;
+ const lower = base.toLowerCase();
+ const ext = base.includes('.') ? (base.split('.').pop()?.toLowerCase() ?? '') : '';
+
+ if (lower === 'dockerfile' || lower === 'containerfile') return 'docker';
+ if (lower === 'license' || lower === 'license.md') return 'page-text';
+ if (lower === 'package.json' || lower === 'npm-shrinkwrap.json' || lower === 'bunfig.toml') {
+ return 'npm';
+ }
+ if (
+ lower.endsWith('.lock') ||
+ lower === 'package-lock.json' ||
+ lower === 'pnpm-lock.yaml' ||
+ lower === 'yarn.lock'
+ ) {
+ return 'package-lock';
+ }
+
+ switch (ext) {
+ case 'md':
+ case 'mdx':
+ case 'markdown':
+ return 'markdown-logo';
+ case 'ts':
+ return 'typescript-logo';
+ case 'tsx':
+ return 'react';
+ case 'js':
+ case 'mjs':
+ case 'cjs':
+ return 'javascript-logo';
+ case 'jsx':
+ return 'react';
+ case 'py':
+ case 'pyw':
+ return 'python';
+ case 'rs':
+ return 'rust';
+ case 'go':
+ return 'go-logo';
+ case 'java':
+ return 'java-logo';
+ case 'c':
+ case 'h':
+ return 'c-logo';
+ case 'cpp':
+ case 'cc':
+ case 'cxx':
+ case 'hpp':
+ case 'hh':
+ case 'hxx':
+ return 'cpp-logo';
+ case 'cs':
+ return 'c-sharp-logo';
+ case 'rb':
+ return 'ruby-logo';
+ case 'php':
+ return 'php-logo';
+ case 'swift':
+ return 'apple-swift';
+ case 'kt':
+ case 'kts':
+ return 'kotlin-logo';
+ case 'svelte':
+ return 'svelte-logo';
+ case 'vue':
+ return 'vue-js';
+ case 'json':
+ case 'jsonc':
+ case 'json5':
+ return 'json-logo';
+ case 'yaml':
+ case 'yml':
+ return 'yaml-logo';
+ case 'toml':
+ case 'ini':
+ case 'cfg':
+ case 'conf':
+ case 'env':
+ return 'settings';
+ case 'sh':
+ case 'bash':
+ case 'zsh':
+ case 'fish':
+ return 'shell-logo';
+ case 'html':
+ case 'htm':
+ return 'html5';
+ case 'css':
+ case 'scss':
+ case 'sass':
+ case 'less':
+ return 'css3';
+ case 'xml':
+ return 'xml-logo';
+ case 'svg':
+ return 'svg-format';
+ case 'sql':
+ case 'sqlite':
+ case 'sqlite3':
+ case 'db':
+ case 'db3':
+ return 'database-script';
+ case 'csv':
+ case 'tsv':
+ return 'csv-logo';
+ case 'pdf':
+ return 'pdf-logo';
+ case 'jpg':
+ case 'jpeg':
+ case 'png':
+ case 'gif':
+ case 'webp':
+ case 'bmp':
+ case 'ico':
+ case 'avif':
+ case 'tiff':
+ return 'image';
+ case 'mp4':
+ case 'webm':
+ case 'mov':
+ case 'ogv':
+ case 'avi':
+ case 'mkv':
+ return 'play';
+ case 'mp3':
+ case 'wav':
+ case 'ogg':
+ case 'flac':
+ case 'm4a':
+ case 'aac':
+ case 'opus':
+ case 'wma':
+ return 'speaker';
+ case 'zip':
+ case 'tar':
+ case 'gz':
+ case 'tgz':
+ case 'bz2':
+ case 'xz':
+ case '7z':
+ case 'rar':
+ return 'archive';
+ case 'docx':
+ case 'txt':
+ return 'page-text';
+ case 'xlsx':
+ case 'xls':
+ return 'table';
+ case 'pptx':
+ return 'page';
+ default:
+ return 'empty-page';
+ }
+}