<template>
    <router-view v-slot="{ Component }">
        <transition :duration="{ enter: 200, leave: 200 }" name="route-fade" mode="out-in">
            <!-- The above durations should be kept in sync with the global css class "fade-on-route-transition" -->
            <component :is="Component" @focusin="handleAnyComponentFocus" />
        </transition>
    </router-view>
    <loadingModal
        :showLoader="shouldShowLoader"
        :showTextCarousel="shouldShowTextCarousel" />
</template>

<script>
import { handleAnyComponentFocus } from "@/helpers/button-question-focus-helper";
import loadingModal from "@/fmg-components/loading-modal/loading-modal.vue";
import { showFmgLoadingModal } from "@/helpers/loading-modal-helper";
export default {
    name: "app",
    setup() {
        const { globalNonpersistedState } = showFmgLoadingModal();
        return { globalNonpersistedState };
    },
    methods: {
        handleAnyComponentFocus: handleAnyComponentFocus,
    },
    computed: {
        shouldShowLoader() {
            return this.globalNonpersistedState.showLoadingModal;
        },
        shouldShowTextCarousel() {
            return this.globalNonpersistedState.showTextCarousel;
        },
    },
    components: {
        loadingModal,
    },
};
</script>

<style lang="scss">
@import "./node_modules/bootstrap/scss/bootstrap";
@import "@/styles/common-styles.scss";
@import "@/styles/common-typography-styles.scss";
@import "@/styles/common-error-styles.scss";
@import "@/styles/common-animations.scss";
@import "@/styles/shared-input-button-styles.scss";
</style>
