diff --git a/app/pages/flightlab/index.vue b/app/pages/flightlab/index.vue index 91acc4a..06ebab8 100644 --- a/app/pages/flightlab/index.vue +++ b/app/pages/flightlab/index.vue @@ -99,10 +99,6 @@ Starten - - - Instructor Panel - diff --git a/app/pages/flightlab/takeoff.vue b/app/pages/flightlab/takeoff.vue index 4243889..d878b88 100644 --- a/app/pages/flightlab/takeoff.vue +++ b/app/pages/flightlab/takeoff.vue @@ -8,20 +8,13 @@ /> - - - - - - + +
@@ -164,10 +163,10 @@ - +
-
+
- +
- - -
-
- {{ sync.sessionCode.value }} -
- - -
- - - Join - -
- - - - - - - - - -
@@ -235,14 +184,6 @@
- - -
- -

Pausiert - der Instructor setzt gleich fort

-
-
-
- -
-

Instructor-Hinweis

-

{{ currentPhase.instructorNote }}

-
@@ -412,20 +348,6 @@ - - - - Nochmal von vorne? - - Der aktuelle Fortschritt geht verloren. - - - - Abbrechen - Neustart - - -
@@ -434,7 +356,6 @@ import { ref, computed, watch, onMounted, onBeforeUnmount } from 'vue' import { takeoffEddf } from '~~/shared/data/flightlab/takeoff-eddf' import { useFlightLabEngine } from '~~/shared/composables/flightlab/useFlightLabEngine' import { useFlightLabAudio } from '~~/shared/composables/flightlab/useFlightLabAudio' -import { useFlightLabSync } from '~~/shared/composables/flightlab/useFlightLabSync' import type { FlightLabButton, SimCondition, FlightLabTelemetryState } from '~~/shared/data/flightlab/types' import { useAuthStore } from '~/stores/auth' @@ -443,20 +364,17 @@ useHead({ title: 'FlightLab - Dein erster Start' }) const engine = useFlightLabEngine(takeoffEddf) const audio = useFlightLabAudio() -const sync = useFlightLabSync() const authStore = useAuthStore() -const joinCode = ref('') -const showRestartConfirm = ref(false) const showDetails = ref(false) -const sidebarOpen = ref(false) +const sidebarOpen = ref(true) // --- Direct Bridge Telemetry Polling (solo mode, no WS session) --- let telemetryPollInterval: ReturnType | null = null function startTelemetryPolling() { stopTelemetryPolling() - if (!authStore.accessToken || sync.isConnected.value) return + if (!authStore.accessToken) return telemetryPollInterval = setInterval(async () => { try { const res = await $fetch<{ telemetry: FlightLabTelemetryState | null }>('/api/flightlab/telemetry', { @@ -478,7 +396,7 @@ function stopTelemetryPolling() { // Start polling when phase has simConditions (solo mode only) watch(() => engine.currentPhase.value, (phase) => { - if (phase?.simConditions && !sync.isConnected.value) { + if (phase?.simConditions) { startTelemetryPolling() } else { stopTelemetryPolling() @@ -563,9 +481,6 @@ function getPhaseStepClass(phaseId: string, idx: number): string { function handlePhaseJump(phaseId: string) { engine.goToPhase(phaseId) - if (sync.isConnected.value) { - sync.sendParticipantAction(engine.currentPhaseId.value, 'jump', phaseId) - } } // --- SimBridge Condition Helpers --- @@ -688,33 +603,6 @@ function getButtonColor(type?: string) { function handleButtonPress(btn: FlightLabButton) { if (engine.isPaused.value || audio.isSpeaking.value) return engine.selectOption(btn) - if (sync.isConnected.value) { - sync.sendParticipantAction(engine.currentPhaseId.value, btn.id, btn.next) - } -} - -async function handleJoin() { - if (joinCode.value.length !== 4) return - try { - await sync.joinSession(joinCode.value) - // Switch to WS-based telemetry - stopTelemetryPolling() - if (authStore.user?.id) { - sync.subscribeTelemetry(authStore.user.id) - } - } catch (e) { - console.error('[FlightLab] Join failed:', e) - } -} - -function handleRestart() { - showRestartConfirm.value = false - audio.stopAllSounds() - audio.clearReplayCache() - engine.restart() - if (sync.isConnected.value) { - sync.sendParticipantAction('restart', 'restart', 'welcome') - } } // --- Help message TTS callback --- @@ -735,29 +623,6 @@ watch(() => engine.currentPhaseId.value, async (newId, oldId) => { } }) -// Listen for telemetry from WebSocket (bridge → server → here) -sync.onTelemetry((data: any) => { - engine.updateTelemetry(data as FlightLabTelemetryState) -}) - -// Listen for instructor commands via WebSocket -sync.onStateChange((state) => { - if (state.currentPhaseId !== engine.currentPhaseId.value) { - engine.goToPhase(state.currentPhaseId) - } - engine.isPaused.value = state.isPaused -}) - -sync.onInstructorMessage(async (text, withRadioEffect) => { - if (withRadioEffect) { - await audio.speakAtcMessage(text, { speed: 0.9, readability: 5 }) - } -}) - -sync.onError((msg) => { - console.warn('[FlightLab] WS error:', msg) -}) - onMounted(async () => { await audio.preloadSounds(allSoundIds.value) @@ -774,7 +639,6 @@ onBeforeUnmount(() => { stopTelemetryPolling() engine.cleanup() audio.dispose() - sync.disconnect() }) @@ -784,16 +648,6 @@ onBeforeUnmount(() => { box-shadow: 0 0 12px rgba(34, 211, 238, 0.4), 0 0 4px rgba(34, 211, 238, 0.2); } -/* ═══════ Sidebar transition ═══════ */ -.sidebar-enter-active, -.sidebar-leave-active { - transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1); -} -.sidebar-enter-from, -.sidebar-leave-to { - transform: translateX(-100%); -} - .sidebar-scroll::-webkit-scrollbar { width: 4px; } diff --git a/app/pages/flightlab/takeoff/instructor.vue b/app/pages/flightlab/takeoff/instructor.vue deleted file mode 100644 index 922cf85..0000000 --- a/app/pages/flightlab/takeoff/instructor.vue +++ /dev/null @@ -1,413 +0,0 @@ - - - diff --git a/shared/composables/flightlab/useFlightLabEngine.ts b/shared/composables/flightlab/useFlightLabEngine.ts index 91fc6c9..32d54a6 100644 --- a/shared/composables/flightlab/useFlightLabEngine.ts +++ b/shared/composables/flightlab/useFlightLabEngine.ts @@ -9,7 +9,7 @@ export function useFlightLabEngine(scenario: FlightLabScenario) { const startedAt = ref(Date.now()) // --- Auto-Advance / SimConnect --- - const autoAdvanceEnabled = ref(false) + const autoAdvanceEnabled = ref(true) const currentTelemetry = ref(null) const showingHelpMessage = ref(false) const helpMessageText = ref(null)