<script setup lang="ts">
import { onMounted, onUnmounted } from 'vue';
import { useConnectionStore } from './stores/connection';
import ConnectionStatus from './components/ConnectionStatus.vue';

const connectionStore = useConnectionStore();

onMounted(() => {
  connectionStore.connect();
});

onUnmounted(() => {
  connectionStore.disconnect();
});
</script>

<template>
  <div class="app-container">
    <ConnectionStatus />
    <router-view v-slot="{ Component }">
      <transition name="fade" mode="out-in">
        <component :is="Component" />
      </transition>
    </router-view>
  </div>
</template>

<style lang="scss">
.app-container {
  min-height: 100vh;
  background: linear-gradient(180deg, #fff5f5 0%, #ffffff 100%);
}

.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.2s ease;
}

.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}
</style>
