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"> <div class="buttons">
<% if (user){ %> <% if (user){ %>
<a href="<%=user.getLink() %>" class="btn-outline-primary" > <a href="<%=user.getLink() %>" class="btn-outline-primary" >
<div class="box-username"><%= user.name %> <div class="box-username"><%= user.name %>
<div class="avatar"><img src="<%=user.avatar %>"></div> <div class="avatar"><img src="<%=user.avatar %>"></div>
</div> </div>
</a> </a>
<a id="logout" href="/login" class="btn-primary">Logout</a>
<% } else { %> <% } else { %>

View file

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

View file

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