<script setup lang="ts">
 import { computed } from "vue"
import { useTagsViewStore } from '@/store/modules/tagsView';
import { useRoute, } from 'vue-router';

const tagsViewStore = useTagsViewStore();
 
const router = useRoute();
const routeKey = computed(() => router.path + Math.random());
</script>

<template>
  <section class="app-main">
    <router-view v-slot="{ Component, route }" :key="routeKey">
      <transition name="router-fade" mode="out-in">
        <keep-alive :include="tagsViewStore.cachedViews">
          <component :is="Component" :key="route.fullPath" />
        </keep-alive>
      </transition>
    </router-view>
  </section>
</template>

<style lang="scss" scoped>
.app-main {
  min-height: calc(100vh - 114px);
  width: 100%;
  position: relative;
  overflow: hidden;
  background-color: #f0f2f5;
  padding: 0 16px 16px;
  box-sizing: border-box;
}

.fixed-header + .app-main {
  padding-top: 50px;
}

.hasTagsView {
  .app-main {
    /* 84 = navbar + tags-view = 50 + 34 */
    min-height: calc(100vh - 114px);
  }

  .fixed-header + .app-main {
    padding-top: 84px;
  }
}
</style>
