309 lines
9.5 KiB
HTML
309 lines
9.5 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>DiscoBase - Dashboard</title>
|
|
<link rel="shortcut icon" href="https://i.ibb.co/1QRfxtD/Untitled-design.png" type="image/x-icon">
|
|
<style>
|
|
:root {
|
|
--primary-color: #a69cec;
|
|
--secondary-color: #00cec9;
|
|
--background-color: #2d3436;
|
|
--card-background: rgba(255, 255, 255, 0.1);
|
|
--text-color: #ffffff;
|
|
--card-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
background: linear-gradient(135deg, var(--background-color), #4834d4);
|
|
color: var(--text-color);
|
|
line-height: 1.6;
|
|
min-height: 100vh;
|
|
}
|
|
|
|
.navbar {
|
|
background-color: rgba(255, 255, 255, 0.1);
|
|
backdrop-filter: blur(10px);
|
|
padding: 1rem 2rem;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
position: fixed;
|
|
height: 70px;
|
|
width: 100%;
|
|
top: 0;
|
|
z-index: 1000;
|
|
}
|
|
|
|
.logo {
|
|
font-size: 1.5rem;
|
|
font-weight: bold;
|
|
color: var(--text-color);
|
|
}
|
|
|
|
nav ul {
|
|
list-style-type: none;
|
|
display: flex;
|
|
gap: 2rem;
|
|
align-items: center;
|
|
}
|
|
|
|
.nav-link {
|
|
color: var(--text-color);
|
|
text-decoration: none;
|
|
font-weight: bold;
|
|
transition: color 0.3s ease, border-bottom 0.3s ease;
|
|
padding-bottom: 0.25rem;
|
|
}
|
|
|
|
.nav-link:hover {
|
|
color: var(--secondary-color);
|
|
border-bottom: 2px solid var(--secondary-color);
|
|
}
|
|
|
|
.container {
|
|
max-width: 1200px;
|
|
margin: 0 auto;
|
|
padding: 6rem 2rem 2rem;
|
|
}
|
|
|
|
.title {
|
|
text-align: center;
|
|
margin-bottom: 2rem;
|
|
font-size: 2.5rem;
|
|
color: var(--secondary-color);
|
|
}
|
|
|
|
.dashboard-cards {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
|
gap: 1.5rem;
|
|
margin-bottom: 2rem;
|
|
}
|
|
|
|
.dashboard-card {
|
|
background-color: var(--card-background);
|
|
border-radius: 10px;
|
|
padding: 1.5rem;
|
|
box-shadow: var(--card-shadow);
|
|
transition: transform 0.3s ease, box-shadow 0.3s ease;
|
|
opacity: 0;
|
|
transform: translateY(20px);
|
|
animation: fadeInUp 0.5s ease forwards;
|
|
}
|
|
|
|
.dashboard-card:hover {
|
|
transform: translateY(-5px);
|
|
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
|
|
}
|
|
|
|
.dashboard-card h3 {
|
|
color: var(--primary-color);
|
|
margin-bottom: 0.5rem;
|
|
font-size: 1.2rem;
|
|
}
|
|
|
|
.dashboard-card p {
|
|
font-size: 1.8rem;
|
|
font-weight: bold;
|
|
color: var(--secondary-color);
|
|
}
|
|
|
|
.recent-activity {
|
|
background-color: var(--card-background);
|
|
border-radius: 10px;
|
|
padding: 1.5rem;
|
|
box-shadow: var(--card-shadow);
|
|
}
|
|
|
|
.recent-activity h2 {
|
|
color: var(--secondary-color);
|
|
margin-bottom: 1rem;
|
|
font-size: 1.5rem;
|
|
}
|
|
|
|
.activity-list {
|
|
list-style-type: none;
|
|
}
|
|
|
|
.activity-item {
|
|
background-color: rgba(255, 255, 255, 0.05);
|
|
border-radius: 5px;
|
|
padding: 1rem;
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
|
|
.bot-button {
|
|
display: flex;
|
|
align-items: center;
|
|
margin-left: 2rem;
|
|
/* Adjust spacing as needed */
|
|
}
|
|
|
|
.bot-button .nav-link {
|
|
display: flex;
|
|
align-items: center;
|
|
background-color: var(--secondary-color);
|
|
padding: 0.5rem 1rem;
|
|
border-radius: 20px;
|
|
color: var(--text-color);
|
|
transition: background-color 0.3s ease;
|
|
}
|
|
|
|
.bot-button .nav-link:hover {
|
|
background-color: #009999;
|
|
/* Darker shade for hover effect */
|
|
}
|
|
|
|
.bot-icon {
|
|
width: 40px;
|
|
height: 40px;
|
|
border-radius: 50%;
|
|
overflow: hidden;
|
|
margin-right: 0.5rem;
|
|
}
|
|
|
|
.bot-icon img {
|
|
width: 100%;
|
|
height: 100%;
|
|
object-fit: cover;
|
|
}
|
|
|
|
.bot-name {
|
|
font-weight: bold;
|
|
}
|
|
|
|
|
|
|
|
@keyframes fadeInUp {
|
|
to {
|
|
opacity: 1;
|
|
transform: translateY(0);
|
|
}
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.container {
|
|
padding: 5rem 1rem 1rem;
|
|
}
|
|
|
|
.dashboard-cards {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<div class="navbar">
|
|
<h1 class="logo">DiscoBase</h1>
|
|
<nav>
|
|
<ul>
|
|
<li><a href="/" class="nav-link">Home</a></li>
|
|
<li><a href="/config" class="nav-link">Manage Configuration</a></li>
|
|
<li><a href="/commands" class="nav-link">Commands</a></li>
|
|
<li><a href="/errors" class="nav-link">Error</a></li>
|
|
<li><a href="/guilds" class="nav-link">Guilds</a></li>
|
|
<li class="bot-button">
|
|
<a href="/bot" class="nav-link">
|
|
<div class="bot-icon">
|
|
<img id="botIcon" src="" alt="Bot Icon" />
|
|
</div>
|
|
<span class="bot-name" id="bot-name">Loading..</span>
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</nav>
|
|
</div>
|
|
|
|
<div class="container">
|
|
<h1 class="title">Dashboard</h1>
|
|
|
|
<div class="dashboard-cards">
|
|
<div class="dashboard-card">
|
|
<h3>Total Servers</h3>
|
|
<p id="total-servers">0</p>
|
|
</div>
|
|
<div class="dashboard-card">
|
|
<h3>Total Users</h3>
|
|
<p id="total-users">0</p>
|
|
</div>
|
|
<div class="dashboard-card">
|
|
<h3>Total Commands (Prefix & Slash)</h3>
|
|
<p id="total-commands">0</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="recent-activity">
|
|
<h2>Recent Activity</h2>
|
|
<ul class="activity-list" id="activity-list">
|
|
<!-- Activity items will be dynamically added here -->
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
window.onload = function () {
|
|
fetch('/api/bot-stats')
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
document.getElementById('total-servers').textContent = data.totalServers;
|
|
document.getElementById('total-users').textContent = data.totalUsers;
|
|
document.getElementById('total-commands').textContent = data.totalCommands;
|
|
document.getElementById('bot-name').innerHTML = data.botName;
|
|
document.getElementById('botIcon').src = data.botIcon;
|
|
console.log(data.botIcon)
|
|
}).catch(error => console.error('Error fetching dashboard stats:', error));
|
|
|
|
fetch('/api/activities')
|
|
.then(response => response.json())
|
|
.then(activities => {
|
|
const activityList = document.getElementById('activity-list');
|
|
activities.forEach(activity => {
|
|
const li = document.createElement('li');
|
|
li.className = 'activity-item';
|
|
|
|
// Change color based on the action
|
|
if (activity.action === 'added') {
|
|
li.style.backgroundColor = '#d4edda'; // Light green for added
|
|
li.style.color = 'black'
|
|
} else if (activity.action === 'removed') {
|
|
li.style.backgroundColor = '#f8d7da'; // Light red for removed
|
|
li.style.color = 'black'
|
|
|
|
} else if (activity.action === 'changed') {
|
|
li.style.backgroundColor = '#fff3cd'; // Light yellow for changed
|
|
li.style.color = 'black'
|
|
|
|
}
|
|
|
|
const details = document.createElement('div');
|
|
details.className = 'activity-details';
|
|
details.innerHTML = `<strong>${activity.action}</strong> - ${activity.filePath}`;
|
|
|
|
const timestamp = document.createElement('span');
|
|
timestamp.className = 'timestamp';
|
|
timestamp.textContent = new Date(activity.timestamp).toLocaleString();
|
|
|
|
li.appendChild(details);
|
|
li.appendChild(timestamp);
|
|
|
|
// Insert new activity items at the top
|
|
activityList.prepend(li);
|
|
});
|
|
})
|
|
.catch(error => console.error('Error fetching activities:', error));
|
|
}
|
|
</script>
|
|
</body>
|
|
|
|
</html> |