2022-08-26 16:27:29 +03:00
|
|
|
<link rel="stylesheet" href="/css/navbar.css" />
|
2022-03-26 23:28:10 +03:00
|
|
|
|
2022-04-03 21:01:55 +03:00
|
|
|
<% if (user?.admin){ %>
|
2022-08-26 16:27:29 +03:00
|
|
|
<div class="admin-bar">
|
|
|
|
<a href="/admin" class="admin-bar">You are admin, and you can go your page!</a>
|
|
|
|
</div>
|
2022-04-03 21:01:55 +03:00
|
|
|
|
|
|
|
<% } %>
|
|
|
|
|
2022-08-26 16:27:29 +03:00
|
|
|
<div class="header">
|
|
|
|
<a class="logo" href="/">AKF <span>FORUM</span></a>
|
|
|
|
<div class="buttons">
|
|
|
|
|
2022-04-03 21:01:55 +03:00
|
|
|
<% if (user){ %>
|
2022-08-26 16:27:29 +03:00
|
|
|
<a href="<%=user.getLink() %>" class="btn-outline-primary" >
|
|
|
|
<div class="box-username"><%= user.name %>
|
|
|
|
<div class="avatar"><img src="<%=user.avatar %>"></div>
|
|
|
|
</div>
|
|
|
|
</a>
|
2022-08-28 19:03:32 +03:00
|
|
|
<a id="logout" href="/login" class="btn-primary">Logout</a>
|
2022-08-31 19:16:43 +03:00
|
|
|
<a onclick="invert()" class="btn-outline-primary"><%=(user.theme === "default" ? "black" : "default" ) + " mode" %></a>
|
|
|
|
<script>
|
|
|
|
async function invert() {
|
|
|
|
await fetch('/api/users/<%= user.id %>',{method:'PATCH',
|
|
|
|
body:JSON.stringify({theme:"<%=user.theme === `default` ? `black` : `default` %>"}),
|
|
|
|
headers: {
|
|
|
|
"Content-Type": "application/json"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
location.reload()
|
|
|
|
}
|
|
|
|
</script>
|
2022-08-26 16:27:29 +03:00
|
|
|
<% } else { %>
|
|
|
|
|
|
|
|
<a id="login" href="/login" class="btn-primary">Login</a>
|
|
|
|
<a href="/register" class="btn-outline-primary">Register</a>
|
|
|
|
<script>
|
|
|
|
document.getElementById("login").href += "?redirect="+window.location.pathname;
|
|
|
|
</script>
|
|
|
|
<% } %>
|
|
|
|
|
|
|
|
</div>
|
2022-03-26 23:28:10 +03:00
|
|
|
</div>
|
2022-08-26 16:27:29 +03:00
|
|
|
<div class="menu">
|
|
|
|
<a href="/threads" class="menu-item">Threads</a>
|
|
|
|
<a href="/users" class="menu-item">Users</a>
|
|
|
|
<a href="/search" class="menu-item">Search</a>
|
|
|
|
<a href="/threads/create/" class="menu-item">Create Thread</a>
|
|
|
|
<script>
|
|
|
|
const menuItems = document.getElementsByClassName("menu-item");
|
|
|
|
|
|
|
|
for (let i = 0; i < menuItems.length; i++)
|
|
|
|
if (menuItems[i].getAttribute("href") == window.location.pathname)
|
|
|
|
menuItems[i].classList.add("active-menu");
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</div>
|