mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-10-09 15:58:34 +00:00
45 lines
1.1 KiB
TypeScript
45 lines
1.1 KiB
TypeScript
export type WindowCommandCloseIntent =
|
|
| { kind: 'closeTab' }
|
|
| { kind: 'closeLogView'; tabId: string }
|
|
| { kind: 'closeWindow' };
|
|
|
|
interface ResolveWindowCommandCloseIntentInput {
|
|
activeTabId: string | null;
|
|
editorTabIds: string[];
|
|
sessionIds: string[];
|
|
workspaceIds: string[];
|
|
logViewIds: string[];
|
|
pluginViewTabIds?: string[];
|
|
}
|
|
|
|
export function resolveWindowCommandCloseIntent({
|
|
activeTabId,
|
|
editorTabIds,
|
|
sessionIds,
|
|
workspaceIds,
|
|
logViewIds,
|
|
pluginViewTabIds = [],
|
|
}: ResolveWindowCommandCloseIntentInput): WindowCommandCloseIntent {
|
|
if (!activeTabId) {
|
|
return { kind: 'closeWindow' };
|
|
}
|
|
|
|
if (editorTabIds.includes(activeTabId) || pluginViewTabIds.includes(activeTabId)) {
|
|
return { kind: 'closeTab' };
|
|
}
|
|
|
|
if (sessionIds.includes(activeTabId) || workspaceIds.includes(activeTabId)) {
|
|
return { kind: 'closeTab' };
|
|
}
|
|
|
|
if (logViewIds.includes(activeTabId)) {
|
|
return { kind: 'closeLogView', tabId: activeTabId };
|
|
}
|
|
|
|
if (activeTabId === 'vault' || activeTabId === 'sftp') {
|
|
return { kind: 'closeWindow' };
|
|
}
|
|
|
|
return { kind: 'closeWindow' };
|
|
}
|