+ };
+
+ return iconMap[ext] || ;
+}
+
// 获取文件类型和图标
function getFileType(filename: string): { type: string; icon: React.ReactNode; color: string } {
const ext = filename.split('.').pop()?.toLowerCase() || '';
@@ -52,8 +131,9 @@ function getFileType(filename: string): { type: string; icon: React.ReactNode; c
const imageExts = ['png', 'jpg', 'jpeg', 'gif', 'bmp', 'svg', 'webp'];
const videoExts = ['mp4', 'avi', 'mkv', 'mov', 'wmv', 'flv', 'webm'];
const audioExts = ['mp3', 'wav', 'flac', 'ogg', 'aac', 'm4a'];
- const textExts = ['txt', 'md', 'readme'];
- const codeExts = ['js', 'ts', 'jsx', 'tsx', 'py', 'java', 'cpp', 'c', 'cs', 'php', 'rb', 'go', 'rs', 'html', 'css', 'scss', 'less', 'json', 'xml', 'yaml', 'yml', 'toml', 'ini', 'conf', 'sh', 'bash', 'zsh', 'sql', 'vue', 'svelte'];
+ const textExts = ['txt', 'readme'];
+ const yamlExts = ['yaml', 'yml'];
+ const codeExts = ['js', 'ts', 'jsx', 'tsx', 'py', 'java', 'cpp', 'c', 'cs', 'php', 'rb', 'go', 'rs', 'html', 'css', 'scss', 'less', 'json', 'xml', 'toml', 'ini', 'conf', 'sh', 'bash', 'zsh', 'sql', 'vue', 'svelte', 'md'];
if (imageExts.includes(ext)) {
return { type: 'image', icon: , color: 'text-yellow-500' };
+ } else if (yamlExts.includes(ext)) {
+ return { type: 'yaml', icon: getLanguageIcon(filename), color: 'text-red-400' };
+ } else if (codeExts.includes(ext) || ['md'].includes(ext)) {
+ return { type: 'code', icon: getLanguageIcon(filename), color: 'text-yellow-500' };
} else {
return { type: 'unknown', icon: