Новые правки

This commit is contained in:
Web-serfer 2026-05-07 19:48:36 +05:00
parent bd0ecb4bd3
commit 41d790bfa3

View file

@ -63,6 +63,13 @@ import { COMPANY } from "@constants";
</svg>
</a>
<!-- Блок авторизации для мобильных -->
<div class="mobile-auth-block" id="mobile-auth-block">
<a href="/auth/sign-in" class="mobile-auth-btn" id="mobile-auth-btn">
<span>Войти</span>
</a>
</div>
<button class="burger-btn" id="burger-btn" aria-label="Открыть меню">
<span class="burger-line"></span>
<span class="burger-line"></span>
@ -267,12 +274,81 @@ import { COMPANY } from "@constants";
gap: 16px;
}
/* Мобильный блок авторизации */
.mobile-auth-block {
display: flex;
align-items: center;
gap: 8px;
}
/* Кнопка входа - как в десктопе */
.mobile-auth-btn {
display: flex;
align-items: center;
gap: 6px;
padding: 0.5rem 0.8rem;
background: transparent;
border: 2px solid #1e3050;
border-radius: 8px;
color: #1e3050;
font-weight: 600;
font-size: 0.85rem;
text-decoration: none;
transition: all 0.3s ease;
}
.mobile-auth-btn:hover {
background: #1e3050;
color: #fff;
}
/* Аватар пользователя - как в десктопе */
.mobile-user-avatar {
width: 36px;
height: 36px;
border-radius: 50%;
background: linear-gradient(135deg, #eac26e 0%, #ce9f40 100%);
color: #fff;
display: flex;
align-items: center;
justify-content: center;
font-weight: 700;
font-size: 0.95rem;
cursor: default;
}
/* Кнопка выхода - красная */
.mobile-auth-btn.logout-btn {
display: flex;
align-items: center;
justify-content: center;
width: 36px;
height: 36px;
padding: 0;
background: transparent;
border: 2px solid #ef4444;
border-radius: 50%;
color: #ef4444;
}
.mobile-auth-btn.logout-btn:hover {
background: #ef4444;
color: #fff;
}
/* Скрытие гамбургера при открытом меню */
.burger-btn.active {
opacity: 0;
pointer-events: none;
}
/* Мобильный блок авторизации - только для мобильных */
@media (min-width: 993px) {
.mobile-auth-block {
display: none !important;
}
}
/* --- АНИМАЦИИ ПРИ ЗАГРУЗКЕ --- */
@media (min-width: 993px) {
.mobile-actions {
@ -336,7 +412,8 @@ import { COMPANY } from "@constants";
gap: 16px;
}
.mobile-phone-btn,
.burger-btn {
.burger-btn,
.mobile-auth-block {
display: flex;
}
.header-right {
@ -346,6 +423,16 @@ import { COMPANY } from "@constants";
.header-right > *:not(.mobile-actions) {
display: none;
}
/* Показываем мобильный блок авторизации только на мобильных */
.mobile-auth-block {
display: none;
}
}
@media (max-width: 992px) {
.mobile-auth-block {
display: flex;
}
}
@media (max-width: 767px) {
@ -385,6 +472,31 @@ import { COMPANY } from "@constants";
</button>
</div>
`;
// Обновляем мобильный блок авторизации
const mobileAuthBlock = document.getElementById('mobile-auth-block');
if (mobileAuthBlock) {
mobileAuthBlock.innerHTML = `
<button class="mobile-auth-btn logout-btn" id="mobile-logout-btn">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path>
<polyline points="16 17 21 12 16 7"></polyline>
<line x1="21" y1="12" x2="9" y2="12"></line>
</svg>
</button>
`;
document.getElementById('mobile-logout-btn')?.addEventListener('click', async () => {
try {
await fetch('/api/auth/logout', { method: 'POST' });
} catch (e) {}
localStorage.removeItem('auth_token');
localStorage.removeItem('user');
localStorage.removeItem('pocketbase_auth');
document.querySelector('.header-right')?.classList.remove('auth-active');
window.location.reload();
});
}
// Обработчик выхода
document.getElementById('logout-btn')?.addEventListener('click', async () => {