Started work on new navbar, just needs user count

This commit is contained in:
rainbow napkin 2026-10-17 02:07:58 -04:00
parent 17e256e038
commit b9bfa5271e
3 changed files with 45 additions and 11 deletions

View file

@ -17,27 +17,34 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. %>
<span class="navbar-item">
<%#<a class="navbar-item" href="/" id="instance-title">%><%#= instance %><%#</a><p class="navbar-item"> - <a class="navbar-item" href="/about">about</a></p>%>
<a class="navbar-item" href="/" id="instance-title"><%= instance %></a>
<p class="navbar-item" id="right-controls">
<span class="navbar-item-seperator first"> - </span><a class="navbar-item first" href="javascript:">Channel Guide</a>
<% for(link of Object.keys(links)){ %>
<span class="navbar-item-seperator"> - </span><a target="_blank" class="navbar-item" href="<%- links[link] %>"><%= link %></a>
<% } %>
</p>
</span>
<span class="navbar-item" id="right-controls">
<% if(user){ %>
<p class="navbar-item">Welcome, <a class="navbar-item" id="username" href="/profile"><%= user.user %></a> - <% if(user.rank == "admin"){ %>
<a href="/adminPanel" title="Admin Panel" class="bi bi-server navbar-item"></a> -
<p class="navbar-item">Welcome, <a class="navbar-item" id="username" href="/profile"><%= user.user %></a> -
<% if(user.rank == "mod" || user.rank == "admin"){ %>
<a target="_blank" href="/adminPanel" title="Admin Panel" class="bi bi-server navbar-item"></a> -
<% } %>
<% for(link of Object.keys(links)){ %>
<a target="_blank" class="navbar-item" href="<%- links[link] %>"><%= link %></a> -
<% } %>
<span id="channel-settings-button-span" class="navbar-item" style="display: none;">
<a target="_blank" href="" title="Channel Settings" class="bi bi-projector-fill navbar-item"></a>
-
</span>
<a class="navbar-item" href="javascript:" id="logout-button">Logout</a></p>
<a class="navbar-item" href="javascript:" id="logout-button">Logout</a>
</p>
<% }else{ %>
<p class="navbar-item">Remember Me:</p>
<input class="navbar-item login-prompt" id="remember-me" type="checkbox">
<input class="navbar-item login-prompt" id="username-prompt" placeholder="username">
<input class="navbar-item login-prompt" id="password-prompt" placeholder="password" type="password">
<p class="navbar-item"><a class="navbar-item" href="javascript:" id="login-button">Login</a> - <a class="navbar-item" href="/passwordReset">Forgot Password</a> - <a class="navbar-item" href="/register">Register</a>
<% for(link of Object.keys(links)){ %>
- <a target="_blank" class="navbar-item" href="<%- links[link] %>"><%= link %></a>
<% } %></p>
</p>
<% } %>
</span>
</div>

View file

@ -336,6 +336,14 @@ input.control-prompt, input.control-prompt:focus{
padding-right: 0.5em;
}
.navbar-item.first{
margin-left: 0.25em;
}
.navbar-item-seperator.first{
display: none;
}
/* index */
.channel-guide-entry{
background-color: var(--bg1);

View file

@ -145,11 +145,19 @@ class channel{
this.user.permMap.chan = new Map(data.user.permMap.chan);
//If we can read the schedule
if(client.user.permMap.chan.get('readSchedule')){
if(this.user.permMap.chan.get('readSchedule')){
//Display the queue icon
this.chatBox.adminIcon.style.display = "";
}
//If we can manage the channel
if(this.user.permMap.chan.get('manageChannel')){
//Unhide the channel settings button
document.querySelector('.navbar-item#channel-settings-button-span').style.display = "";
//Annoyingly, there isn't a good way in html to set a links relative filepath to use the current 'file' as a directory
document.querySelector('.navbar-item#channel-settings-button-span a').href = `${document.URL}/settings`;
}
//Tell the chatbox to handle client info
//should it have its own event listener instead? Guess it's a stylistic choice :P
this.chatBox.handleClientInfo(data);
@ -218,6 +226,17 @@ class channel{
return results;
}
insertSettingsIcon(){
const settingsIcon = document.createElement('i');
settingsIcon.classList.add('navbar-item', 'bi-projector-fill');
settingsIcon.id = "channel-settings-button";
//Insert settings icon into navbar
document.querySelector('.navbar-item#logout-button').insertAdjacentElement('beforebegin', settingsIcon);
//Insert icon seperator
settingsIcon.insertAdjacentText('afterend', ' - ');
}
/**
* Processes and applies default config on any unset settings
* @param {Boolean} force - Whether or not to forcefully reset already set settings