feat(ui): 添加底部状态栏和优化代码编辑器空状态

- 新增 StatusBar 组件,显示 Git 分支、诊断信息和连接状态
- 添加 Git API 端点 (GET /api/files/git) 获取分支和 dirty 状态
- 优化 CodeEditor 空状态,添加图标和引导提示
- 修复 Chat 页面高度问题 (h-screen -> h-full)
This commit is contained in:
2025-12-17 17:04:38 +08:00
parent 250d2cb4b5
commit a3ddc39771
7 changed files with 215 additions and 6 deletions
+20 -3
View File
@@ -13,7 +13,7 @@ import { html } from '@codemirror/lang-html';
import { css } from '@codemirror/lang-css';
import { markdown } from '@codemirror/lang-markdown';
import { oneDark } from '@codemirror/theme-one-dark';
import { X, Save, Circle } from 'lucide-react';
import { X, Save, Circle, FileCode, MousePointerClick } from 'lucide-react';
import { motion, AnimatePresence } from 'framer-motion';
import { toast } from 'sonner';
import { cn } from '../utils/cn.js';
@@ -156,8 +156,25 @@ export function CodeEditor({
if (tabs.length === 0) {
return (
<div className={cn('flex items-center justify-center h-full bg-surface-base text-fg-muted', className)}>
<p>No files open</p>
<div className={cn('flex flex-col items-center justify-center h-full bg-surface-base', className)}>
<motion.div
initial={{ opacity: 0, y: 10 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.3 }}
className="text-center max-w-xs"
>
<div className="w-16 h-16 mx-auto mb-4 rounded-2xl bg-surface-subtle flex items-center justify-center">
<FileCode size={32} className="text-fg-subtle" />
</div>
<h3 className="text-fg font-medium mb-2">No files open</h3>
<p className="text-fg-muted text-sm mb-4">
Select a file from the explorer to view and edit its contents
</p>
<div className="flex items-center justify-center gap-2 text-xs text-fg-subtle">
<MousePointerClick size={14} />
<span>Click a file to open</span>
</div>
</motion.div>
</div>
);
}