feat: 工作空间文件预览改为侧边栏内嵌面板

- 将文件预览从模态弹窗改为侧边栏内嵌面板,不打断用户操作流程
- 支持双拖动调整:外部调整整体宽度(400-800px),内部调整文件树宽度(180-300px)
- 左右分栏布局:左侧文件树 + 右侧预览面板
- 对话区域保留最小宽度 480px,保证可用性
- 新建 FilePreviewPanel 组件,删除 FilePreviewModal 组件
- 更新相关样式和规格文档
This commit is contained in:
2026-04-17 19:34:29 +08:00
parent 5f333b116a
commit ff4217c72a
8 changed files with 548 additions and 208 deletions

View File

@@ -4,14 +4,16 @@
// 工作空间侧边栏
.workspace-sidebar {
width: 240px;
width: 500px;
min-width: 400px;
max-width: 800px;
background: var(--color-bg-2);
border-left: 1px solid var(--color-border-2);
display: flex;
flex-direction: column;
height: 100%;
flex-shrink: 0;
transition: width 0.3s ease, opacity 0.3s ease;
transition: width 0.3s ease;
position: relative;
&--collapsed {
@@ -119,11 +121,57 @@
}
}
// ========== Content - 左右分栏 ==========
&__content {
flex: 1;
display: flex;
overflow: hidden;
min-height: 0;
}
// ========== FileTree ==========
&__file-tree {
min-width: 180px;
max-width: 300px;
flex-shrink: 0;
overflow-y: auto;
padding: 8px;
min-height: 0;
background: var(--color-bg-2);
}
// ========== 分隔线(可拖动) ==========
&__divider {
width: 1px;
background: var(--color-border-2);
flex-shrink: 0;
cursor: ew-resize;
position: relative;
transition: background 0.2s;
// 增加可拖动区域
&::before {
content: '';
position: absolute;
top: 0;
left: -4px;
right: -4px;
bottom: 0;
cursor: ew-resize;
}
&:hover {
background: var(--color-primary);
}
}
// ========== Preview Panel ==========
&__preview {
flex: 1;
min-width: 200px;
display: flex;
flex-direction: column;
overflow: hidden;
background: var(--color-bg-1);
}
&__resize-handle {
@@ -366,6 +414,144 @@
}
}
// ========== 文件预览面板 ==========
.file-preview-panel {
display: flex;
flex-direction: column;
height: 100%;
overflow: hidden;
// Header
&__header {
display: flex;
align-items: center;
padding: 12px 16px;
border-bottom: 1px solid var(--color-border-2);
gap: 8px;
flex-shrink: 0;
background: var(--color-bg-2);
}
&__icon {
font-size: 20px;
flex-shrink: 0;
}
&__name {
flex: 1;
font-size: 14px;
font-weight: 600;
color: var(--color-text-1);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
&__close {
width: 24px;
height: 24px;
display: flex;
align-items: center;
justify-content: center;
border-radius: var(--radius-sm);
cursor: pointer;
color: var(--color-text-3);
transition: all 0.2s;
flex-shrink: 0;
&:hover {
background: var(--color-bg-1);
color: var(--color-text-1);
}
}
// Info
&__info {
padding: 12px 16px;
background: var(--color-bg-2);
border-bottom: 1px solid var(--color-border-2);
flex-shrink: 0;
}
&__info-item {
display: flex;
font-size: 13px;
margin-bottom: 6px;
&:last-child {
margin-bottom: 0;
}
.label {
width: 60px;
color: var(--color-text-3);
flex-shrink: 0;
}
.value {
flex: 1;
color: var(--color-text-1);
}
}
// Content Wrapper
&__content-wrapper {
flex: 1;
overflow-y: auto;
min-height: 0;
}
// Content
&__content {
padding: 16px;
}
&__code {
font-family: 'Courier New', Courier, monospace;
font-size: 13px;
line-height: 1.6;
color: var(--color-text-1);
white-space: pre-wrap;
word-break: break-all;
background: var(--color-bg-2);
padding: 12px;
border-radius: var(--radius-sm);
margin: 0;
}
// Placeholder
&__placeholder {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 32px 16px;
text-align: center;
color: var(--color-text-3);
min-height: 200px;
}
&__placeholder-icon {
font-size: 48px;
margin-bottom: 12px;
opacity: 0.5;
}
&__placeholder-text {
font-size: 13px;
}
// Actions
&__actions {
padding: 12px 16px;
border-top: 1px solid var(--color-border-2);
display: flex;
gap: 8px;
flex-shrink: 0;
background: var(--color-bg-2);
}
}
// 文件右键菜单
.file-context-menu {
position: absolute;

View File

@@ -245,6 +245,7 @@
background: var(--color-bg-1);
min-height: 0;
overflow: hidden;
min-width: 480px; // 保证对话区域最小宽度
}
.chat-content__messages,