refac
This commit is contained in:
1 parent
f3f76095d1
commit
c1c81f8127
2 files changed
+11
-9
No files matched your search
@@ -67,12 +67,6 @@
|
|||||||
const chatContextAvailable = (terminal: any) => chatContext(terminal) !== false;
|
const chatContextAvailable = (terminal: any) => chatContext(terminal) !== false;
|
||||||
const chatContextNeedsSavedChat = (terminal: any) =>
|
const chatContextNeedsSavedChat = (terminal: any) =>
|
||||||
chatContext(terminal)?.context_id === 'chat_id';
|
chatContext(terminal)?.context_id === 'chat_id';
|
||||||
function showFilesOnTerminalSelect(largeScreen: boolean) {
|
|
||||||
activeTab = 'files';
|
|
||||||
if (largeScreen) {
|
|
||||||
showControls.set($settings?.showFilesOnTerminalSelect ?? true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$: selectedSystemTerminal = ($terminalServers ?? []).find(
|
$: selectedSystemTerminal = ($terminalServers ?? []).find(
|
||||||
(t) => t.id && t.id === $selectedTerminalId
|
(t) => t.id && t.id === $selectedTerminalId
|
||||||
);
|
);
|
||||||
@@ -110,9 +104,9 @@
|
|||||||
showControls.set(true);
|
showControls.set(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Auto-open Files tab when a terminal is selected (suppress panel open when full-screen)
|
// Keep Files selected when a terminal is active; opening the panel is handled by selection UI.
|
||||||
$: if ($selectedTerminalId && terminalFilesAvailable) {
|
$: if ($selectedTerminalId && terminalFilesAvailable) {
|
||||||
showFilesOnTerminalSelect(largeScreen);
|
activeTab = 'files';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear selected direct terminal if user lost permission
|
// Clear selected direct terminal if user lost permission
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
import {
|
import {
|
||||||
chatId as activeChatId,
|
chatId as activeChatId,
|
||||||
settings,
|
settings,
|
||||||
|
showControls,
|
||||||
showSettings,
|
showSettings,
|
||||||
terminalServers,
|
terminalServers,
|
||||||
selectedTerminalId,
|
selectedTerminalId,
|
||||||
@@ -63,6 +64,9 @@
|
|||||||
const selectDirect = async (terminal: (typeof directTerminals)[0]) => {
|
const selectDirect = async (terminal: (typeof directTerminals)[0]) => {
|
||||||
const newId = $selectedTerminalId === terminal.url ? null : terminal.url;
|
const newId = $selectedTerminalId === terminal.url ? null : terminal.url;
|
||||||
selectedTerminalId.set(newId);
|
selectedTerminalId.set(newId);
|
||||||
|
if (newId && window.matchMedia('(min-width: 1024px)').matches) {
|
||||||
|
showControls.set($settings?.showFilesOnTerminalSelect ?? true);
|
||||||
|
}
|
||||||
|
|
||||||
// Enable the selected direct terminal, disable all others
|
// Enable the selected direct terminal, disable all others
|
||||||
const updatedServers = ($settings?.terminalServers ?? []).map((s) => ({
|
const updatedServers = ($settings?.terminalServers ?? []).map((s) => ({
|
||||||
@@ -82,7 +86,11 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const selectSystem = async (terminal: (typeof systemTerminals)[0]) => {
|
const selectSystem = async (terminal: (typeof systemTerminals)[0]) => {
|
||||||
selectedTerminalId.set($selectedTerminalId === terminal.id ? null : terminal.id);
|
const newId = $selectedTerminalId === terminal.id ? null : terminal.id;
|
||||||
|
selectedTerminalId.set(newId);
|
||||||
|
if (newId && window.matchMedia('(min-width: 1024px)').matches) {
|
||||||
|
showControls.set($settings?.showFilesOnTerminalSelect ?? true);
|
||||||
|
}
|
||||||
|
|
||||||
// Disable all direct terminals when switching to a system terminal
|
// Disable all direct terminals when switching to a system terminal
|
||||||
if ($settings?.terminalServers?.some((s) => s.enabled)) {
|
if ($settings?.terminalServers?.some((s) => s.enabled)) {
|
||||||
|
|||||||
Reference in new issue
Block a user