Add admin features, user profile management, and generation capabilities

- Implemented admin dashboard with user management features including role assignment and deletion.
- Added user profile page for updating email and password.
- Created separate routes and templates for text, image, and video generation with appropriate forms.
- Enhanced navigation with dropdown for generation options and loading overlay for better user experience.
- Introduced comprehensive error handling and user feedback through alerts.
- Updated styles for improved UI consistency and responsiveness.

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-04-27 18:48:01 +02:00
parent f2a9f187f2
commit 53d2d2ffef
10 changed files with 1042 additions and 99 deletions
+36
View File
@@ -0,0 +1,36 @@
document.addEventListener('DOMContentLoaded', () => {
// ── Loading overlay ────────────────────────────────────
const overlay = document.getElementById('loading-overlay');
document.querySelectorAll('form').forEach((form) => {
form.addEventListener('submit', () => {
if (overlay) overlay.classList.add('active');
});
});
// ── Hamburger menu ─────────────────────────────────────
const hamburger = document.querySelector('.hamburger');
const navLinks = document.querySelector('.nav-links');
if (hamburger && navLinks) {
hamburger.addEventListener('click', () => {
navLinks.classList.toggle('open');
});
}
// ── Generate dropdown tabs ─────────────────────────────
document.querySelectorAll('.tab-btn').forEach((btn) => {
btn.addEventListener('click', () => {
const target = btn.dataset.tab;
const container = btn.closest('.tabs-container');
if (!container) return;
container.querySelectorAll('.tab-btn').forEach((b) => b.classList.remove('active'));
container.querySelectorAll('.tab-panel').forEach((p) => p.classList.remove('active'));
btn.classList.add('active');
const panel = container.querySelector(`#tab-${target}`);
if (panel) panel.classList.add('active');
});
});
});
+528 -4
View File
@@ -1,3 +1,21 @@
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");
:root {
--bg: #0f1117;
--surface: #1a1d27;
--surface-2: #22263a;
--border: #2e3250;
--text: #e8eaf6;
--text-muted: #8b90b8;
--accent: #7c6ff7;
--accent-hover: #9d97ff;
--danger: #e05a6a;
--danger-hover: #f07080;
--success: #56c489;
--warning: #f0b429;
--radius: 8px;
}
*,
*::before,
*::after {
@@ -8,19 +26,525 @@
body {
font-family:
"Inter",
system-ui,
-apple-system,
sans-serif;
background: #f5f5f5;
color: #222;
background: var(--bg);
color: var(--text);
min-height: 100vh;
line-height: 1.6;
}
/* Nav */
/* ─── Nav ──────────────────────────────────────────────── */
header {
background: #1a1a2e;
background: var(--surface);
border-bottom: 1px solid var(--border);
padding: 0 1.5rem;
position: sticky;
top: 0;
z-index: 100;
}
nav {
display: flex;
align-items: center;
justify-content: space-between;
height: 3.5rem;
max-width: 1100px;
margin: 0 auto;
}
.brand {
color: var(--accent-hover);
font-weight: 700;
text-decoration: none;
font-size: 1.1rem;
letter-spacing: -0.02em;
}
.nav-links {
display: flex;
align-items: center;
gap: 0.25rem;
}
.nav-links a {
color: var(--text-muted);
text-decoration: none;
padding: 0.4rem 0.75rem;
border-radius: var(--radius);
font-size: 0.875rem;
font-weight: 500;
transition:
color 0.15s,
background 0.15s;
}
.nav-links a:hover {
color: var(--text);
background: var(--surface-2);
}
/* Dropdown */
.nav-dropdown {
position: relative;
}
.nav-dropdown-menu {
display: none;
position: absolute;
top: calc(100% + 0.5rem);
left: 0;
min-width: 160px;
background: var(--surface-2);
border: 1px solid var(--border);
border-radius: var(--radius);
overflow: hidden;
z-index: 200;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.open .nav-dropdown-menu {
display: block;
}
.nav-dropdown-menu a {
display: block;
padding: 0.55rem 1rem;
border-radius: 0;
}
/* Hamburger */
.hamburger {
display: none;
flex-direction: column;
gap: 5px;
cursor: pointer;
padding: 0.5rem;
background: none;
border: none;
}
.hamburger span {
display: block;
width: 22px;
height: 2px;
background: var(--text-muted);
border-radius: 2px;
transition:
transform 0.2s,
opacity 0.2s;
}
/* ─── Main layout ──────────────────────────────────────── */
main {
max-width: 800px;
margin: 2rem auto;
padding: 0 1rem;
}
/* ─── Alerts ───────────────────────────────────────────── */
.alert {
padding: 0.75rem 1rem;
border-radius: var(--radius);
margin-bottom: 1rem;
font-size: 0.875rem;
font-weight: 500;
}
.alert-success {
background: rgba(86, 196, 137, 0.15);
color: var(--success);
border: 1px solid rgba(86, 196, 137, 0.3);
}
.alert-error {
background: rgba(224, 90, 106, 0.15);
color: var(--danger);
border: 1px solid rgba(224, 90, 106, 0.3);
}
/* ─── Card ─────────────────────────────────────────────── */
.card {
background: var(--surface);
border: 1px solid var(--border);
border-radius: 12px;
padding: 2rem;
}
.card h1 {
font-size: 1.4rem;
font-weight: 700;
margin-bottom: 1.5rem;
letter-spacing: -0.02em;
}
.card h2 {
font-size: 1.1rem;
font-weight: 600;
margin-bottom: 1rem;
}
/* ─── Forms ────────────────────────────────────────────── */
form label {
display: block;
font-size: 0.8rem;
font-weight: 600;
color: var(--text-muted);
text-transform: uppercase;
letter-spacing: 0.04em;
margin-bottom: 0.35rem;
margin-top: 1.1rem;
}
form input,
form select,
form textarea {
width: 100%;
padding: 0.6rem 0.85rem;
background: var(--surface-2);
border: 1px solid var(--border);
border-radius: var(--radius);
font-size: 0.95rem;
font-family: inherit;
color: var(--text);
transition:
border-color 0.15s,
box-shadow 0.15s;
}
form input::placeholder,
form textarea::placeholder {
color: var(--text-muted);
}
form select option {
background: var(--surface-2);
}
form input:focus,
form select:focus,
form textarea:focus {
outline: none;
border-color: var(--accent);
box-shadow: 0 0 0 3px rgba(124, 111, 247, 0.25);
}
/* ─── Buttons ──────────────────────────────────────────── */
.btn,
button[type="submit"] {
display: inline-flex;
align-items: center;
gap: 0.4rem;
margin-top: 1.25rem;
padding: 0.6rem 1.4rem;
background: var(--accent);
color: #fff;
border: none;
border-radius: var(--radius);
font-size: 0.9rem;
font-weight: 600;
font-family: inherit;
cursor: pointer;
text-decoration: none;
transition:
background 0.15s,
transform 0.1s;
}
.btn:hover,
button[type="submit"]:hover {
background: var(--accent-hover);
}
.btn:active,
button[type="submit"]:active {
transform: scale(0.98);
}
.btn-danger {
background: var(--danger);
}
.btn-danger:hover {
background: var(--danger-hover);
}
.btn-sm {
padding: 0.3rem 0.75rem;
font-size: 0.8rem;
margin-top: 0;
}
/* ─── Tabs ─────────────────────────────────────────────── */
.tabs {
display: flex;
gap: 0.5rem;
margin-bottom: 1.5rem;
border-bottom: 1px solid var(--border);
padding-bottom: 0;
}
.tab-btn {
background: none;
border: none;
border-bottom: 2px solid transparent;
padding: 0.5rem 1rem;
margin-bottom: -1px;
color: var(--text-muted);
font-size: 0.9rem;
font-weight: 500;
cursor: pointer;
margin-top: 0;
transition:
color 0.15s,
border-color 0.15s;
}
.tab-btn:hover {
color: var(--text);
}
.tab-btn.active {
color: var(--accent-hover);
border-bottom-color: var(--accent);
}
.tab-panel {
display: none;
}
.tab-panel.active {
display: block;
}
/* ─── Result ───────────────────────────────────────────── */
.result {
margin-top: 1.75rem;
padding-top: 1.5rem;
border-top: 1px solid var(--border);
}
.result h2 {
font-size: 1rem;
font-weight: 600;
color: var(--text-muted);
text-transform: uppercase;
letter-spacing: 0.05em;
margin-bottom: 0.75rem;
}
pre {
background: var(--surface-2);
border: 1px solid var(--border);
padding: 1rem;
border-radius: var(--radius);
white-space: pre-wrap;
word-break: break-word;
font-size: 0.9rem;
line-height: 1.7;
color: var(--text);
}
.generated-image {
max-width: 100%;
border-radius: var(--radius);
margin-top: 0.5rem;
border: 1px solid var(--border);
}
.generated-video {
max-width: 100%;
border-radius: var(--radius);
margin-top: 0.5rem;
}
/* ─── Admin table ──────────────────────────────────────── */
.stats-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
gap: 1rem;
margin-bottom: 2rem;
}
.stat-box {
background: var(--surface-2);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 1rem 1.25rem;
}
.stat-box .stat-label {
font-size: 0.75rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.05em;
color: var(--text-muted);
}
.stat-box .stat-value {
font-size: 2rem;
font-weight: 700;
color: var(--accent-hover);
line-height: 1.2;
margin-top: 0.25rem;
}
.table-wrap {
overflow-x: auto;
}
table {
width: 100%;
border-collapse: collapse;
font-size: 0.9rem;
}
th {
text-align: left;
padding: 0.5rem 0.75rem;
font-size: 0.75rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.05em;
color: var(--text-muted);
border-bottom: 1px solid var(--border);
}
td {
padding: 0.65rem 0.75rem;
border-bottom: 1px solid var(--border);
vertical-align: middle;
}
tr:last-child td {
border-bottom: none;
}
.role-badge {
display: inline-block;
padding: 0.2rem 0.6rem;
border-radius: 999px;
font-size: 0.75rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.04em;
}
.role-admin {
background: rgba(124, 111, 247, 0.2);
color: var(--accent-hover);
}
.role-user {
background: rgba(139, 144, 184, 0.15);
color: var(--text-muted);
}
.table-actions {
display: flex;
gap: 0.5rem;
align-items: center;
flex-wrap: wrap;
}
/* ─── Loading overlay ──────────────────────────────────── */
#loading-overlay {
display: none;
position: fixed;
inset: 0;
background: rgba(15, 17, 23, 0.75);
z-index: 1000;
align-items: center;
justify-content: center;
flex-direction: column;
gap: 1rem;
}
#loading-overlay.active {
display: flex;
}
.spinner {
width: 40px;
height: 40px;
border: 3px solid var(--border);
border-top-color: var(--accent);
border-radius: 50%;
animation: spin 0.7s linear infinite;
}
.spinner-label {
color: var(--text-muted);
font-size: 0.9rem;
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}
/* ─── Misc ─────────────────────────────────────────────── */
.text-muted {
color: var(--text-muted);
}
.mt-1 {
margin-top: 0.5rem;
}
.mt-2 {
margin-top: 1rem;
}
.section-title {
font-size: 1rem;
font-weight: 600;
color: var(--text-muted);
text-transform: uppercase;
letter-spacing: 0.05em;
margin-bottom: 1rem;
}
/* ─── Responsive ───────────────────────────────────────── */
@media (max-width: 640px) {
.hamburger {
display: flex;
}
.nav-links {
display: none;
flex-direction: column;
align-items: flex-start;
position: absolute;
top: 3.5rem;
left: 0;
right: 0;
background: var(--surface);
border-bottom: 1px solid var(--border);
padding: 0.75rem 1rem;
gap: 0.1rem;
z-index: 99;
}
.nav-links.open {
display: flex;
}
.nav-dropdown-menu {
position: static;
border: none;
background: none;
padding-left: 0.75rem;
}
.card {
padding: 1.25rem;
}
.stats-grid {
grid-template-columns: repeat(2, 1fr);
}
}
nav {
display: flex;
align-items: center;