mirror of
https://github.com/NanmiCoder/claude-code-haha.git
synced 2026-10-10 20:03:13 +08:00
cfed362e89
The trace list lives inside Settings, but opening a row jumps to a sibling top-level tab with no return path: the detail header only offered copy/refresh/open-window, so getting back to the list meant finding a tab labelled "Settings" — which does not match the mental model of someone reading a trace. Add a "back to list" control to the detail header that returns to the Settings trace section and closes the tab it came from, mirroring returnFromWorkbench. It stays available in the loading and error states, where being stranded hurts most. Along the same path: - Tag trace tabs with the account_tree glyph, so the title can carry the session name instead of a truncated "Model trace: " prefix. - Scroll the selected Settings rail entry into view. Settings remounts on re-entry with the rail scrolled to the top, which left the selected section highlighted off-screen after returning. - Drop the row action that duplicated the row click. - Fall back to a browser tab for "open in separate window" outside the desktop shell, where it was a dead button. Navigation is consolidated in lib/traceNavigation.ts so the list, deep links, and the return path share one definition.
38 lines
1.6 KiB
TypeScript
38 lines
1.6 KiB
TypeScript
import { t } from '../i18n'
|
|
import { SETTINGS_TAB_ID, useTabStore } from '../stores/tabStore'
|
|
import { useUIStore } from '../stores/uiStore'
|
|
|
|
/**
|
|
* The trace list lives inside Settings, so "show the list" and "go back to the
|
|
* list" are the same action: focus the Settings tab and select its Trace
|
|
* section. Routing every entry point through here keeps the return path one hop
|
|
* regardless of where the detail tab was opened from — the list, a deep link,
|
|
* or a restored tab.
|
|
*/
|
|
export function openTraceList(): void {
|
|
useUIStore.getState().setPendingSettingsTab('trace')
|
|
useTabStore.getState().openTab(SETTINGS_TAB_ID, t('sidebar.settings'), 'settings')
|
|
}
|
|
|
|
/** The capture switches themselves live one section over, under General. */
|
|
export function openTraceCaptureSettings(): void {
|
|
useUIStore.getState().setPendingSettingsTab('general')
|
|
useTabStore.getState().openTab(SETTINGS_TAB_ID, t('sidebar.settings'), 'settings')
|
|
}
|
|
|
|
/** Drill into one session's trace. The tab is titled with the session it traces. */
|
|
export function openTraceDetail(sessionId: string, title: string): string {
|
|
return useTabStore.getState().openTraceTab(sessionId, title)
|
|
}
|
|
|
|
/**
|
|
* Leave a detail tab the way `returnFromWorkbench` leaves a workbench tab: land
|
|
* on the list first, then drop the tab we came from, so browsing several traces
|
|
* in a row does not leave a trail of dead tabs behind. Ordering matters — the
|
|
* close runs after the switch so the tab bar never flashes an interim tab.
|
|
*/
|
|
export function returnToTraceList(tabId: string): void {
|
|
openTraceList()
|
|
useTabStore.getState().closeTab(tabId)
|
|
}
|