Initial local commit

This commit is contained in:
2025-09-03 11:07:29 +02:00
commit e6cf08893e
20 changed files with 11387 additions and 0 deletions

319
public/dashboard.html Normal file
View File

@@ -0,0 +1,319 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ninja Server - Admin Dashboard</title>
<script src="https://unpkg.com/@supabase/supabase-js@2"></script>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
}
.header {
background: rgba(255, 255, 255, 0.95);
backdrop-filter: blur(10px);
padding: 1rem 2rem;
box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
display: flex;
justify-content: space-between;
align-items: center;
}
.logo {
display: flex;
align-items: center;
gap: 0.5rem;
}
.logo h1 {
color: #333;
font-size: 1.5rem;
font-weight: 700;
}
.nav-buttons {
display: flex;
gap: 1rem;
align-items: center;
}
.btn {
padding: 0.5rem 1rem;
border: none;
border-radius: 8px;
font-size: 0.9rem;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
text-decoration: none;
display: inline-block;
}
.btn-primary {
background: #007bff;
color: white;
}
.btn-primary:hover {
background: #0056b3;
transform: translateY(-1px);
}
.btn-logout {
background: #dc3545;
color: white;
}
.btn-logout:hover {
background: #c82333;
transform: translateY(-1px);
}
.container {
max-width: 1200px;
margin: 2rem auto;
padding: 0 2rem;
}
.welcome-card {
background: white;
border-radius: 20px;
padding: 2rem;
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
margin-bottom: 2rem;
text-align: center;
}
.dashboard-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 2rem;
margin-bottom: 2rem;
}
.card {
background: white;
border-radius: 15px;
padding: 1.5rem;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
transition: transform 0.3s ease;
}
.card:hover {
transform: translateY(-5px);
}
.card h3 {
color: #333;
font-size: 1.3rem;
margin-bottom: 1rem;
display: flex;
align-items: center;
gap: 0.5rem;
}
.card p {
color: #666;
line-height: 1.6;
}
.loading {
text-align: center;
padding: 2rem;
color: #666;
}
.spinner {
border: 3px solid #f3f3f3;
border-top: 3px solid #667eea;
border-radius: 50%;
width: 40px;
height: 40px;
animation: spin 1s linear infinite;
margin: 0 auto 1rem;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.user-info {
display: flex;
align-items: center;
gap: 0.5rem;
color: #666;
font-size: 0.9rem;
}
.user-avatar {
width: 30px;
height: 30px;
border-radius: 50%;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
display: flex;
align-items: center;
justify-content: center;
color: white;
font-weight: bold;
font-size: 0.8rem;
}
@media (max-width: 768px) {
.header {
padding: 1rem;
flex-direction: column;
gap: 1rem;
}
.nav-buttons {
flex-wrap: wrap;
justify-content: center;
}
.container {
padding: 0 1rem;
}
.dashboard-grid {
grid-template-columns: 1fr;
}
}
</style>
</head>
<body>
<div class="header">
<div class="logo">
<h1>🥷 Ninja Server - Admin</h1>
</div>
<div class="nav-buttons">
<div class="user-info">
<div class="user-avatar" id="userAvatar">U</div>
<span id="userEmail">user@example.com</span>
</div>
<a href="index.html" class="btn btn-primary">Back to Times</a>
<button class="btn btn-logout" onclick="logout()">Logout</button>
</div>
</div>
<div class="container">
<div id="loading" class="loading">
<div class="spinner"></div>
<p>Loading dashboard...</p>
</div>
<div id="dashboardContent" style="display: none;">
<div class="welcome-card">
<h2>Admin Dashboard 🥷</h2>
<p>Welcome to the admin panel! Manage your ninja server from here.</p>
</div>
<div class="dashboard-grid">
<div class="card">
<h3>📊 Analytics</h3>
<p>Track your performance and monitor key metrics. This section will show detailed analytics once we implement the functionality.</p>
</div>
<div class="card">
<h3>⚡ Quick Actions</h3>
<p>Common tasks and shortcuts will be available here. We'll add buttons for creating new records, managing settings, and more.</p>
</div>
<div class="card">
<h3><EFBFBD><EFBFBD> Settings</h3>
<p>Configure your account preferences, security settings, and application options. This will be fully functional in the next phase.</p>
</div>
<div class="card">
<h3>📝 Recent Activity</h3>
<p>View your recent actions and system events. This will show a timeline of your activities once we connect it to the database.</p>
</div>
</div>
</div>
</div>
<script>
// Supabase configuration
const SUPABASE_URL = 'https://lfxlplnypzvjrhftaoog.supabase.co';
const SUPABASE_ANON_KEY = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImxmeGxwbG55cHp2anJoZnRhb29nIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDkyMTQ3NzIsImV4cCI6MjA2NDc5MDc3Mn0.XR4preBqWAQ1rT4PFbpkmRdz57BTwIusBI89fIxDHM8';
// Initialize Supabase client
const supabase = window.supabase.createClient(SUPABASE_URL, SUPABASE_ANON_KEY);
// Check authentication and load dashboard
async function initDashboard() {
try {
const { data: { session }, error } = await supabase.auth.getSession();
if (error) {
console.error('Error checking authentication:', error);
window.location.href = 'login.html';
return;
}
if (!session) {
// No session, redirect to login
window.location.href = 'login.html';
return;
}
// User is authenticated, show dashboard
displayUserInfo(session.user);
showDashboard();
} catch (error) {
console.error('An unexpected error occurred:', error);
window.location.href = 'login.html';
}
}
// Display user information
function displayUserInfo(user) {
const userEmail = document.getElementById('userEmail');
const userAvatar = document.getElementById('userAvatar');
userEmail.textContent = user.email;
userAvatar.textContent = user.email.charAt(0).toUpperCase();
}
// Show dashboard content
function showDashboard() {
document.getElementById('loading').style.display = 'none';
document.getElementById('dashboardContent').style.display = 'block';
}
// Logout function
async function logout() {
try {
const { error } = await supabase.auth.signOut();
if (error) {
console.error('Error logging out:', error);
} else {
window.location.href = 'index.html';
}
} catch (error) {
console.error('Error during logout:', error);
}
}
// Listen for auth state changes
supabase.auth.onAuthStateChange((event, session) => {
if (event === 'SIGNED_OUT' || !session) {
window.location.href = 'login.html';
}
});
// Initialize dashboard when page loads
initDashboard();
</script>
</body>
</html>