🐛 fix(vscode): 改动 tab 默认统一视图并保留阅读位置

This commit is contained in:
cruldra committed 2026-07-25 11:08:48 +08:00
1 parent 84a5cda8d2
commit d68603ee06
9 files changed
+213 -20

No files matched your search

+31 -12
View File
@@ -1,10 +1,13 @@
/**
* 底部 panel:左侧垂直 tab 切换两个 property grid。
* 底部 panel:左侧垂直 tab 切换四个内容区。
*
* - tab 1 「工单」:现有 IssueDetailPanel(基于 PropertyGrid)
* - tab 2 「Profile」:工作区 KV 表 ProfileGrid
* - tab 3 「会话」:ManagedSessionsPanel
* - tab 4 「改动」:PrFilesPanel
*
* tab 状态用 useState,无持久化;激活态加左侧 2px 高亮条。
* 四个内容始终挂载,非当前用 hidden 隐藏,避免切 tab 卸载导致阅读态(选中文件、
* 树滚动/折叠、diff scroll)丢失。tab 状态用 useState,无持久化;激活态加左侧 2px 高亮条。
*/
import type { ClaudeProfile } from '../hooks/useIssues'
@@ -99,9 +102,13 @@ export function BottomTabs(props: BottomTabsProps) {
/>
</div>
{/* 右侧内容 */}
<div className="min-w-0 flex-1 overflow-hidden">
{tab === 'issue' && (
{/* 右侧内容:始终挂载,非当前 hidden,保留阅读态 */}
<div className="relative min-w-0 flex-1 overflow-hidden">
<div
className={`h-full w-full ${tab === 'issue' ? '' : 'hidden'}`}
aria-hidden={tab !== 'issue'}
inert={tab !== 'issue' ? true : undefined}
>
<IssueDetailPanel
issue={props.issue}
allIssues={props.allIssues}
@@ -130,15 +137,23 @@ export function BottomTabs(props: BottomTabsProps) {
profiles={props.profiles}
onOpenLogs={props.onOpenLogs}
/>
)}
{tab === 'profile' && (
</div>
<div
className={`h-full w-full ${tab === 'profile' ? '' : 'hidden'}`}
aria-hidden={tab !== 'profile'}
inert={tab !== 'profile' ? true : undefined}
>
<ProfileGrid
data={props.profileData}
onSave={props.onProfileSave}
onOpen={props.onProfileOpen}
/>
)}
{tab === 'sessions' && (
</div>
<div
className={`h-full w-full ${tab === 'sessions' ? '' : 'hidden'}`}
aria-hidden={tab !== 'sessions'}
inert={tab !== 'sessions' ? true : undefined}
>
<ManagedSessionsPanel
data={props.managedSessions}
profiles={props.profiles}
@@ -152,10 +167,14 @@ export function BottomTabs(props: BottomTabsProps) {
onListImportable={props.onListImportableSessions}
onImport={props.onImportNamedSession}
/>
)}
{tab === 'changes' && (
</div>
<div
className={`h-full w-full ${tab === 'changes' ? '' : 'hidden'}`}
aria-hidden={tab !== 'changes'}
inert={tab !== 'changes' ? true : undefined}
>
<PrFilesPanel issue={props.issue} />
)}
</div>
</div>
</div>
)