fix navbar drop down going off the screen and move messages button to the drop down

This commit is contained in:
Ugric committed 2026-04-07 14:55:44 +01:00
1 parent 5b1616d062
commit b8091f5629
3 files changed
+29 -34

No files matched your search

-1
View File
@@ -127,7 +127,6 @@ def init_database():
photoid TEXT photoid TEXT
) )
""") """)
init_accounts_database()
print("Database initialised.") print("Database initialised.")
seed_species() seed_species()
+1 -1
View File
@@ -544,7 +544,7 @@ input:focus {
display: none; display: none;
position: absolute; position: absolute;
top: 100%; top: 100%;
left: 0; right: 0;
background-color: rgb(0, 0, 0); background-color: rgb(0, 0, 0);
min-width: 160px; min-width: 160px;
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1); box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
+28 -32
View File
@@ -24,11 +24,14 @@
</div> </div>
<a href="/admin">Admin</a> <a href="/admin">Admin</a>
{% endif %} {% endif %}
<!-- Messages link with unread badge --> <a href="/about">About</a>
<a href="/messages" class="messages-link" style="position: relative;">
Messages <div class="dropdown">
<span id="unread-badge" style=" <a class="dropbtn">{{user["username"]}} ▾</a>
<div class="dropdown-content">
<a href="/messages">Messages
<span id="unread-badge" style="
background: #e74c3c; background: #e74c3c;
color: white; color: white;
border-radius: 10px; border-radius: 10px;
@@ -36,14 +39,7 @@
font-size: 0.7rem; font-size: 0.7rem;
margin-left: 5px; margin-left: 5px;
display: none; display: none;
">0</span> ">0</span></a>
</a>
<a href="/about">About</a>
<div class="dropdown">
<a class="dropbtn">{{user["username"]}} ▾</a>
<div class="dropdown-content">
<a href="/dashboard">Dashboard</a> <a href="/dashboard">Dashboard</a>
<a href="/settings">Settings</a> <a href="/settings">Settings</a>
<a href="/logout">Logout</a> <a href="/logout">Logout</a>
@@ -57,24 +53,24 @@
</div> </div>
<script> <script>
function updateUnreadCount() { function updateUnreadCount() {
fetch('/messages/unread-count') fetch('/messages/unread-count')
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {
const badge = document.getElementById('unread-badge'); const badge = document.getElementById('unread-badge');
if (data.count > 0) { if (data.count > 0) {
badge.textContent = data.count; badge.textContent = data.count;
badge.style.display = 'inline-block'; badge.style.display = 'inline-block';
} else { } else {
badge.style.display = 'none'; badge.style.display = 'none';
} }
}) })
.catch(error => console.error('Error fetching unread count:', error)); .catch(error => console.error('Error fetching unread count:', error));
} }
// Update immediately on page load // Update immediately on page load
updateUnreadCount(); updateUnreadCount();
// Then update every 30 seconds // Then update every 30 seconds
setInterval(updateUnreadCount, 30000); setInterval(updateUnreadCount, 30000);
</script> </script>