main page fixed

This commit is contained in:
Akif9748 2022-08-28 19:03:32 +03:00
parent d6f301da72
commit 20b00af256
3 changed files with 45 additions and 39 deletions

View File

@ -12,13 +12,13 @@
<div class="buttons">
<% if (user){ %>
<a href="<%=user.getLink() %>" class="btn-outline-primary" >
<div class="box-username"><%= user.name %>
<div class="avatar"><img src="<%=user.avatar %>"></div>
</div>
</a>
<a id="logout" href="/login" class="btn-primary">Logout</a>
<% } else { %>

View File

@ -4,7 +4,9 @@
<%- include("extra/meta", {title: "Welcome to the Akf-forum!" }) %>
<body style="text-align: center;">
<body >
<link rel="stylesheet" href="/css/user.css" />
<%- include("extra/navbar") %>
<% if (user) { %>
@ -24,29 +26,29 @@
</h1>
<% } %>
<h1 style="color: #606060;">Statistics:</h1>
<ul>
<li>
<h3>Message count: <b>
<%= messages %>
</b></h3>
</li>
<li>
<h3>User count: <b>
<%= users %>
</b></h3>
</li>
<li>
<h3>Thread count: <b>
<%= threads %>
</b></h3>
</li>
<li>
<h3>Memory usage: <b>
<%= mem.toFixed(2); %> MB
</b></h3>
</li>
</ul>
<div class="content">
<div class="box">
<h2 class="box-title">Message count:</h2>
<h2 class="box-title"> <%= messages %></h2>
</div>
<div class="box">
<h2 class="box-title">User count: </h2>
<h2 class="box-title"> <%= users %> </h2>
</div>
<div class="box">
<h2 class="box-title">Thread count:</h2>
<h2 class="box-title"><%= threads %></h2>
</div>
<div class="box">
<h2 class="box-title"> Memory usage: </h2>
<h2 class="box-title"><%= mem.toFixed(2); %> MB</h2>
</div>
</div>
</body>
</html>

View File

@ -3,9 +3,10 @@
<%- include("extra/meta", {title: member.name }) %>
<body>
<link rel="stylesheet" href="/css/user.css" />
<body >
<%- include("extra/navbar") %>
<div class="content">
@ -13,8 +14,7 @@
<img style="width:100px;height:100px;border-radius:50%;" src="<%=member.avatar %>">
</div>
<div class="box">
<h2 class="box-title">Name: <%= member.name %>
</h2>
<h2 class="box-title">Name:</h2>
<h2 class="box-title">
<%= member.name %>
</h2>
@ -53,17 +53,15 @@
<%= counts.thread %>
</h2>
</div>
</div>
<% if (user?.admin && !member.deleted) {%>
<a class="big" id="admin">Give admin permissions!</a>
<a class="big" id="delete">Delete user!</a>
<% if (user?.admin && !member.deleted) {%>
<a class="btn-outline-primary" id="admin">Give admin permissions!</a>
<a class="btn-outline-primary" id="delete">Delete user!</a>
<script type="module">
import request from "../../js/request.js";
document.addEventListener("click", async e => {
e.preventDefault();
if (e.target.id == "admin") {
const response = await request("/api/users/<%= member.id %>/admin");
@ -71,14 +69,18 @@
if (response.admin)
return alert("Making admin of " + response.name + " is success!");
}
}else if (e.target.id == "delete") {
const response = await request("/api/users/<%= member.id %>/delete");
const response = await request("/api/users/<%= member.id %>/delete");
if (!response.deleted) return
if (!response.deleted) return
alert("User is deleted!");
location.reload()
}
});
@ -86,14 +88,14 @@
<% }; %>
<% if (member.deleted) {%>
<h1>This user has been deleted!</h1>
<a onclick="undelete();" type="">Undelete user! </a>
<a onclick="undelete();" class="btn-primary" >Undelete user! </a>
<script type="module">
import request from "../../js/request.js";
async function undelete(params) {
window.undelete= async function undelete(params) {
const response = await request("/api/users/<%= member.id %>/undelete");
@ -106,6 +108,8 @@
</script>
<% }; %>
</div>
</body>
</html>