added admin control panel
This commit is contained in:
47
frontend/src/pages/admin/index.astro
Normal file
47
frontend/src/pages/admin/index.astro
Normal file
@@ -0,0 +1,47 @@
|
||||
---
|
||||
import Layout from '../../layouts/Layout.astro';
|
||||
---
|
||||
|
||||
<Layout title="Admin Dashboard">
|
||||
<div class="glass p-12 mb-12" id="admin-content" style="display: none;">
|
||||
<header class="mb-12 border-b border-white/5 pb-12 flex justify-between items-center">
|
||||
<h1 class="text-4xl font-extrabold text-mauve">
|
||||
Admin Dashboard
|
||||
</h1>
|
||||
<button id="logout-btn" class="text-red hover:text-maroon transition-colors font-medium">
|
||||
Logout
|
||||
</button>
|
||||
</header>
|
||||
|
||||
<div class="grid md:grid-cols-2 gap-8">
|
||||
<a href="/admin/editor" class="group">
|
||||
<div class="bg-surface0/50 p-8 rounded-xl border border-white/5 transition-all hover:bg-surface0 hover:scale-[1.02] h-full">
|
||||
<h2 class="text-2xl font-bold text-lavender mb-2 group-hover:text-mauve transition-colors">Write a Post</h2>
|
||||
<p class="text-subtext0">Create or edit markdown posts and upload images.</p>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<a href="/admin/settings" class="group">
|
||||
<div class="bg-surface0/50 p-8 rounded-xl border border-white/5 transition-all hover:bg-surface0 hover:scale-[1.02] h-full">
|
||||
<h2 class="text-2xl font-bold text-blue mb-2 group-hover:text-sky transition-colors">Site Settings</h2>
|
||||
<p class="text-subtext0">Update the blog title, favicon, and theme configuration.</p>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const token = localStorage.getItem('admin_token');
|
||||
if (!token) {
|
||||
window.location.href = '/admin/login';
|
||||
} else {
|
||||
const content = document.getElementById('admin-content');
|
||||
if (content) content.style.display = 'block';
|
||||
}
|
||||
|
||||
document.getElementById('logout-btn')?.addEventListener('click', () => {
|
||||
localStorage.removeItem('admin_token');
|
||||
window.location.href = '/';
|
||||
});
|
||||
</script>
|
||||
</Layout>
|
||||
Reference in New Issue
Block a user