Update
This commit is contained in:
parent
1bd9fe7e88
commit
feb360afd8
@ -539,7 +539,7 @@ img {
|
|||||||
.topnav-icon { position: relative; padding: 0.375rem; color: var(--text-secondary); font-size: 1.25rem; background: none; border: none; cursor: pointer; font-family: inherit; line-height: 1; }
|
.topnav-icon { position: relative; padding: 0.375rem; color: var(--text-secondary); font-size: 1.25rem; background: none; border: none; cursor: pointer; font-family: inherit; line-height: 1; }
|
||||||
.topnav-icon:hover { color: var(--text-primary); }
|
.topnav-icon:hover { color: var(--text-primary); }
|
||||||
.nav-badge {
|
.nav-badge {
|
||||||
position: absolute; top: 0; right: 0; min-width: 16px; height: 16px;
|
position: absolute; top: 0; right: 0; z-index: 1; min-width: 16px; height: 16px;
|
||||||
padding: 0 0.25rem; border-radius: 8px; background: var(--accent); color: var(--white);
|
padding: 0 0.25rem; border-radius: 8px; background: var(--accent); color: var(--white);
|
||||||
font-size: 0.6875rem; font-weight: 700;
|
font-size: 0.6875rem; font-weight: 700;
|
||||||
display: flex; align-items: center; justify-content: center;
|
display: flex; align-items: center; justify-content: center;
|
||||||
@ -568,7 +568,8 @@ img {
|
|||||||
padding: 0.25rem 0;
|
padding: 0.25rem 0;
|
||||||
z-index: 1001;
|
z-index: 1001;
|
||||||
}
|
}
|
||||||
.topnav-user-dropdown:hover .dropdown-menu { display: block; }
|
.topnav-user-dropdown:hover .dropdown-menu,
|
||||||
|
.topnav-user-dropdown.open .dropdown-menu { display: block; }
|
||||||
.dropdown-item {
|
.dropdown-item {
|
||||||
display: block;
|
display: block;
|
||||||
padding: 0.5rem 0.875rem;
|
padding: 0.5rem 0.875rem;
|
||||||
|
|||||||
@ -3,6 +3,7 @@ export class MobileNav {
|
|||||||
this.initMobileNav();
|
this.initMobileNav();
|
||||||
this.initMessagesResponsive();
|
this.initMessagesResponsive();
|
||||||
this.initMessageThread();
|
this.initMessageThread();
|
||||||
|
this.initProfileDropdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
initMobileNav() {
|
initMobileNav() {
|
||||||
@ -92,4 +93,28 @@ export class MobileNav {
|
|||||||
const thread = document.querySelector(".messages-thread");
|
const thread = document.querySelector(".messages-thread");
|
||||||
if (thread) thread.scrollTop = thread.scrollHeight;
|
if (thread) thread.scrollTop = thread.scrollHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
initProfileDropdown() {
|
||||||
|
const dropdown = document.querySelector(".topnav-user-dropdown");
|
||||||
|
if (!dropdown) return;
|
||||||
|
const btn = dropdown.querySelector(".topnav-user");
|
||||||
|
if (!btn) return;
|
||||||
|
|
||||||
|
btn.addEventListener("click", (e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
dropdown.classList.toggle("open");
|
||||||
|
});
|
||||||
|
|
||||||
|
document.addEventListener("click", (e) => {
|
||||||
|
if (!dropdown.contains(e.target)) {
|
||||||
|
dropdown.classList.remove("open");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
document.addEventListener("keydown", (e) => {
|
||||||
|
if (e.key === "Escape") {
|
||||||
|
dropdown.classList.remove("open");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -81,14 +81,15 @@
|
|||||||
<span class="nav-badge" data-counter-badge {% if unread_count == 0 %}hidden{% endif %}>{{ unread_count }}</span>
|
<span class="nav-badge" data-counter-badge {% if unread_count == 0 %}hidden{% endif %}>{{ unread_count }}</span>
|
||||||
</a>
|
</a>
|
||||||
<div class="topnav-user-dropdown">
|
<div class="topnav-user-dropdown">
|
||||||
<a href="/profile/{{ user['username'] }}" class="topnav-user">
|
<button type="button" class="topnav-user" aria-label="User menu">
|
||||||
<img src="{{ avatar_url('multiavatar', user['username'], 32) }}" class="avatar-img avatar-sm" alt="{{ user['username'] }}" loading="lazy">
|
<img src="{{ avatar_url('multiavatar', user['username'], 32) }}" class="avatar-img avatar-sm" alt="{{ user['username'] }}" loading="lazy">
|
||||||
<div class="topnav-user-info">
|
<div class="topnav-user-info">
|
||||||
<span class="topnav-user-name">{{ user['username'] }}</span>
|
<span class="topnav-user-name">{{ user['username'] }}</span>
|
||||||
{% if is_admin(user) %}<span class="topnav-user-role">{{ user['role'] }}</span>{% endif %}
|
{% if is_admin(user) %}<span class="topnav-user-role">{{ user['role'] }}</span>{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
|
<a href="/profile/{{ user['username'] }}" class="dropdown-item"><span class="icon">👤</span> Profile</a>
|
||||||
<a href="/devii/" class="dropdown-item" data-devii-open><span class="icon">🤖</span> Devii</a>
|
<a href="/devii/" class="dropdown-item" data-devii-open><span class="icon">🤖</span> Devii</a>
|
||||||
<a href="/bookmarks/saved" class="dropdown-item"><span class="icon">🔖</span> Saved</a>
|
<a href="/bookmarks/saved" class="dropdown-item"><span class="icon">🔖</span> Saved</a>
|
||||||
<a href="/auth/logout" class="dropdown-item"><span class="icon">🚪</span> Logout</a>
|
<a href="/auth/logout" class="dropdown-item"><span class="icon">🚪</span> Logout</a>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user