habits.andr33v.ru/app/layouts/default.vue

116 lines
2.4 KiB
Vue

<template>
<div class="app-container">
<header v-if="isAuthenticated" class="top-bar">
<div class="user-info-top">
<span>{{ user.nickname }}</span>
<span>💰 {{ user.coins }}</span>
<span>✨ {{ user.exp }}</span>
<button @click="handleLogout" class="logout-button">Logout</button>
</div>
</header>
<main class="main-content">
<slot />
</main>
<footer v-if="isAuthenticated" class="bottom-nav">
<NuxtLink to="/" class="nav-item">
<span class="icon">🏠</span>
<span class="label">Главная</span>
</NuxtLink>
<NuxtLink to="/habits" class="nav-item">
<span class="icon">🎯</span>
<span class="label">Привычки</span>
</NuxtLink>
<NuxtLink to="/village" class="nav-item">
<span class="icon">🏞️</span>
<span class="label">Деревня</span>
</NuxtLink>
<NuxtLink to="/leaderboard" class="nav-item">
<span class="icon">🏆</span>
<span class="label">Лидерборд</span>
</NuxtLink>
</footer>
</div>
</template>
<script setup>
const { user, isAuthenticated, logout } = useAuth();
const handleLogout = async () => {
await logout();
};
</script>
<style scoped>
.app-container {
display: flex;
flex-direction: column;
min-height: 100vh;
}
.top-bar {
background-color: #f8f8f8;
padding: 10px 15px;
border-bottom: 1px solid #eee;
display: flex;
justify-content: flex-end; /* Align user info to the right */
align-items: center;
}
.user-info-top {
display: flex;
align-items: center;
gap: 15px;
font-size: 0.9em;
}
.logout-button {
background-color: #dc3545;
color: white;
border: none;
padding: 5px 10px;
border-radius: 5px;
cursor: pointer;
font-size: 0.8em;
}
.main-content {
flex-grow: 1;
padding-bottom: 60px; /* Space for bottom nav */
}
.bottom-nav {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
background-color: #fff;
border-top: 1px solid #eee;
display: flex;
justify-content: space-around;
padding: 5px 0;
box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
z-index: 1000;
}
.nav-item {
display: flex;
flex-direction: column;
align-items: center;
text-decoration: none;
color: #555;
font-size: 0.7em;
padding: 5px;
}
.nav-item .icon {
font-size: 1.5em;
margin-bottom: 2px;
}
.nav-item.router-link-active {
color: #007bff;
}
</style>