diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 90c73d5..b9bb9b6 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -82,6 +82,9 @@ let voicePTTTimeout: number | null = null const keyboardVisible = ref(false) // Virtual keyboard visible +// Whether any terminal exists (T1+) +const hasTerminals = computed(() => sessionState.terminalRegistry.length > 0) + // Extra terminals (T2-T5) from Pinia store — fully reactive, no template ref dependency const extraTerminals = computed(() => { const reg = sessionState.terminalRegistry @@ -107,6 +110,12 @@ function trackMouse(e: MouseEvent) { } function handleFabTerminalSelect(sessionId: string) { + const isActive = transcriptDebugRef.value?.activeTerminalSessionId === sessionId + if (showTranscriptDebug.value && isActive) { + // Already showing this terminal — close + showTranscriptDebug.value = false + return + } if (transcriptDebugRef.value) { transcriptDebugRef.value.switchToTerminal(sessionId) } @@ -121,10 +130,21 @@ function handleFabCreateSession() { } function handleMainFabClick() { - if (transcriptDebugRef.value?.openTerminals?.length) { - transcriptDebugRef.value.switchToTerminal(transcriptDebugRef.value.openTerminals[0].sessionId) + const terminals = transcriptDebugRef.value?.openTerminals + if (!terminals?.length) return + + const firstSessionId = terminals[0].sessionId + const isActive = transcriptDebugRef.value?.activeTerminalSessionId === firstSessionId + + if (showTranscriptDebug.value && isActive) { + // Already showing terminal 1 — close + showTranscriptDebug.value = false + return } - showTranscriptDebug.value = !showTranscriptDebug.value + + // Switch to terminal 1 and open + transcriptDebugRef.value?.switchToTerminal(firstSessionId) + showTranscriptDebug.value = true } function handleGlobalKeydown(e: KeyboardEvent) { @@ -340,7 +360,7 @@ watch(() => route.name, (newPage) => { @select="handleFabTerminalSelect" @create-session="handleFabCreateSession" /> -