<script setup lang="ts">
import {Flight, User} from "@/Types/types";
import ProfileHeader from "@/Components/FlightsGoneBy/ProfileHeader.vue";
import PlaneLoader from "@/Components/FlightsGoneBy/PlaneLoader.vue";

defineProps<{
    user: User
    flightCount?: number
    achievementCount? : number
    isFollowing: boolean
    loading: boolean
}>()
</script>

<template>
    <div class="board-wrapper">
        <ProfileHeader :is-following="isFollowing" :user="user" :flightCount="flightCount" />
        <div v-if="loading" class="loading-state">
            <PlaneLoader />
        </div>
        <slot v-else />
    </div>
</template>

<style scoped>
.board-wrapper {
    min-height: 100dvh;
    padding: 2.5rem 2rem;
    font-family: 'Barlow', sans-serif;
    width: 100%;
}

.loading-state {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 50dvh;
}

.spinner {
    display: block;
    width: 2.5rem;
    height: 2.5rem;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 1200px) {
    .board-wrapper {
        padding: 1em 0.25em;
    }
}
</style>
