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

defineProps<{
    user: User
    flightCount?: number
    achievementCount? : number
    followStatus: string
    loading: boolean
    canView: boolean
    title?: string
    showCount?: boolean
}>()
</script>

<template>
    <div class="board-wrapper">
        <Head :title="title" />
        <ProfileHeader :showCount="showCount" :show="achievementCount && achievementCount > 0 ? 'achievements' : 'flights'" :followStatus="followStatus" :user="user" :flightCount="flightCount" :achievementCount="achievementCount" />
        <div v-if="loading" class="loading-state">
            <PlaneLoader />
        </div>
        <slot v-else-if="canView" />
        <PrivateProfileMessage :name="user.name" v-else />
    </div>
</template>

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

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

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