design: улучшения дизайна
🚀 Create and publish a Docker image / Detect changes in backend and frontend (push) Successful in 11s
🚀 Create and publish a Docker image / Build & publish backend image (push) Successful in 13s
🚀 Create and publish a Docker image / Build & publish frontend image (push) Failing after 20s
🚀 Create and publish a Docker image / Update stack on Portainer (push) Successful in 9s

This commit is contained in:
2026-05-14 02:16:18 +03:00
parent fef6962fa7
commit a42a305a12
3 changed files with 187 additions and 82 deletions
+9 -69
View File
@@ -1,15 +1,13 @@
<script setup lang="ts">
import { computed } from 'vue'
import { useRouter, useRoute } from 'vue-router'
import { useRoute } from 'vue-router'
import { useAuthStore } from '@/stores/auth'
import AppIcon from '@/components/ui/AppIcon.vue'
const auth = useAuthStore()
const router = useRouter()
const route = useRoute()
interface NavItem { label: string; icon: string; to: string; roles: string[] }
type AppRole = 'student' | 'teacher' | 'admin'
const navItems: NavItem[] = [
{ label: 'Главная', icon: 'home', to: '/', roles: ['student'] },
@@ -34,29 +32,6 @@ const visible = computed(() =>
navItems.filter(n => auth.user && n.roles.includes(auth.user.activeRole))
)
const roleButtons = computed(() => {
if (!auth.user) return []
const labels: Record<AppRole, string> = {
student: 'Студент',
teacher: 'Преподаватель',
admin: 'Администратор',
}
const targets: Record<AppRole, string> = {
student: '/',
teacher: '/teacher',
admin: '/admin',
}
return auth.user.roles
.filter(role => role !== auth.user?.activeRole)
.map(role => ({ role, label: labels[role], to: targets[role] }))
})
function switchToRole(role: AppRole, to: string) {
if (auth.setActiveRole(role)) {
router.push(to)
}
}
function isActive(to: string) {
if (to === '/') return route.path === '/'
return route.path.startsWith(to) && to !== '/'
@@ -79,20 +54,7 @@ function isActive(to: string) {
</nav>
<div class="sidebar-footer">
<div class="role-switches" v-if="roleButtons.length">
<button
v-for="item in roleButtons"
:key="item.role"
class="role-switch-btn"
@click="switchToRole(item.role, item.to)"
>
Перейти: {{ item.label }}
</button>
</div>
<button class="logout-btn" @click="auth.logout().then(() => router.push('/login'))">
<AppIcon class="logout-icon" icon="logout" :size="16" />
Выйти
</button>
<span class="copyright">© 2026 UniVerse</span>
</div>
</aside>
</template>
@@ -144,38 +106,16 @@ function isActive(to: string) {
box-shadow: 0 2px 8px rgba(34,197,94,0.12);
}
.nav-icon { flex-shrink: 0; color: currentColor; }
.sidebar-footer { padding: 10px 18px 8px; display: flex; flex-direction: column; gap: 8px; }
.role-switches { display: flex; flex-direction: column; gap: 6px; }
.role-switch-btn {
width: 100%;
background: rgba(34,197,94,0.08);
border: 1px solid rgba(34,197,94,0.2);
border-radius: var(--radius-sm);
padding: 8px 10px;
.sidebar-footer {
padding: 10px 18px 8px;
display: flex;
justify-content: center;
}
.copyright {
color: var(--color-text-secondary);
font-size: 12px;
font-weight: 600;
color: var(--color-primary-dark);
cursor: pointer;
transition: all 0.2s;
}
.role-switch-btn:hover { background: rgba(34,197,94,0.15); }
.logout-btn {
width: 100%;
background: rgba(239,68,68,0.08);
border: 1px solid rgba(239,68,68,0.2);
border-radius: var(--radius-sm);
padding: 9px 12px;
font-size: 13px;
font-weight: 600;
color: #991B1B;
cursor: pointer;
transition: all 0.2s;
display: flex;
align-items: center;
gap: 6px;
}
.logout-icon { color: currentColor; }
.logout-btn:hover { background: rgba(239,68,68,0.15); }
@media (max-width: 768px) { .sidebar { display: none; } }
</style>