feat: hide main FAB when no terminals exist, only show with active sessions
This commit is contained in:
@@ -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"
|
||||
/>
|
||||
<div class="fab-button-area">
|
||||
<div v-if="hasTerminals" class="fab-button-area">
|
||||
<span class="fab-bubble b1"></span>
|
||||
<span class="fab-bubble b2"></span>
|
||||
<span class="fab-bubble b3"></span>
|
||||
|
||||
Reference in New Issue
Block a user