[dyad] wrote 4 file(s)

This commit is contained in:
Michael committed 2025-11-06 16:05:46 +01:00
1 parent 11dca3824c
commit 52664951c3
3 files changed
+17 -405

No files matched your search

+2 -403
View File
@@ -4,411 +4,10 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Notes & Todos</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600&display=swap');
:root {
/* Colors */
--bg-gradient: linear-gradient(to bottom right, #f8fafc, #f1f5f9);
--primary: #0ea5e9;
--primary-light: #e0f2fe;
--primary-dark: #0369a1;
--surface: #ffffff;
--text: #0f172a;
--text-light: #64748b;
--border: #e2e8f0;
--success: #10b981;
--error: #ef4444;
/* Effects */
--shadow-sm: 0 2px 8px -2px rgba(0, 0, 0, 0.05);
--shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.08);
--shadow-lg: 0 8px 24px -4px rgba(0, 0, 0, 0.12);
--glow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Plus Jakarta Sans', sans-serif;
background: var(--bg-gradient);
color: var(--text);
min-height: 100vh;
line-height: 1.6;
-webkit-font-smoothing: antialiased;
}
/* Top Navigation */
.top-nav {
background: var(--surface);
border-bottom: 1px solid var(--border);
padding: 0.75rem 1.5rem;
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 50;
display: flex;
justify-content: space-between;
align-items: center;
box-shadow: var(--shadow-sm);
}
.nav-brand {
font-size: 1.25rem;
font-weight: 600;
color: var(--text);
text-decoration: none;
display: flex;
align-items: center;
gap: 0.5rem;
}
.nav-brand svg {
width: 24px;
height: 24px;
color: var(--primary);
}
.user-menu {
display: flex;
align-items: center;
gap: 1rem;
}
.user-info {
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.5rem 1rem;
background: var(--primary-light);
border-radius: 8px;
color: var(--primary-dark);
font-weight: 500;
}
.user-info svg {
width: 18px;
height: 18px;
}
/* Layout */
.app {
display: grid;
grid-template-columns: 320px 1fr;
gap: 1rem;
height: 100vh;
padding-top: 4rem; /* Space for top nav */
}
/* Sidebar */
.sidebar {
background: var(--surface);
border-radius: 16px;
padding: 1.5rem;
display: flex;
flex-direction: column;
gap: 1.5rem;
box-shadow: var(--shadow);
height: calc(100vh - 5rem);
margin: 0.5rem;
border: 1px solid var(--border);
}
/* Main Content */
.main-content {
background: var(--surface);
border-radius: 16px;
padding: 2rem;
box-shadow: var(--shadow);
height: calc(100vh - 5rem);
margin: 0.5rem;
border: 1px solid var(--border);
overflow-y: auto;
}
/* Search */
.search-container {
position: relative;
}
.search-input {
width: 100%;
padding: 0.875rem 1rem 0.875rem 2.75rem;
border: 1px solid var(--border);
border-radius: 12px;
font-size: 0.9375rem;
background: var(--bg-gradient);
transition: all 0.2s ease;
}
.search-input:focus {
outline: none;
border-color: var(--primary);
box-shadow: var(--glow);
background: var(--surface);
}
/* Notes List */
.notes-list {
display: flex;
flex-direction: column;
gap: 0.75rem;
overflow-y: auto;
padding: 0.5rem;
}
.note-item {
padding: 1rem;
background: var(--bg-gradient);
border: 1px solid var(--border);
border-radius: 12px;
cursor: pointer;
transition: all 0.2s ease;
}
.note-item:hover {
transform: translateY(-2px);
border-color: var(--primary);
box-shadow: var(--shadow);
}
.note-item.active {
background: var(--primary-light);
border-color: var(--primary);
}
/* Editor */
.editor {
background: var(--surface);
border-radius: 12px;
border: 1px solid var(--border);
box-shadow: var(--shadow);
}
.editor-title {
width: 100%;
padding: 1.5rem;
font-size: 1.5rem;
font-weight: 600;
border: none;
border-bottom: 1px solid var(--border);
background: transparent;
}
.editor-content {
padding: 1.5rem;
min-height: 300px;
}
/* Admin Panel */
.admin-panel {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.5);
display: flex;
align-items: center;
justify-content: center;
z-index: 100;
}
.admin-content {
background: var(--surface);
border-radius: 16px;
padding: 2rem;
width: 600px;
max-width: 90vw;
max-height: 90vh;
overflow-y: auto;
box-shadow: var(--shadow-lg);
border: 1px solid var(--border);
}
.admin-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 2rem;
padding-bottom: 1rem;
border-bottom: 1px solid var(--border);
}
.user-list {
display: flex;
flex-direction: column;
gap: 1rem;
}
.user-card {
background: var(--bg-gradient);
border: 1px solid var(--border);
border-radius: 12px;
padding: 1rem;
display: flex;
justify-content: space-between;
align-items: center;
}
/* Buttons */
.btn {
padding: 0.75rem 1.5rem;
border-radius: 8px;
font-weight: 500;
font-size: 0.9375rem;
transition: all 0.2s ease;
border: 1px solid transparent;
cursor: pointer;
display: inline-flex;
align-items: center;
gap: 0.5rem;
}
.btn-primary {
background: var(--primary);
color: white;
border-color: var(--primary-dark);
}
.btn-primary:hover {
background: var(--primary-dark);
transform: translateY(-1px);
box-shadow: var(--shadow);
}
.btn-secondary {
background: var(--surface);
color: var(--text);
border-color: var(--border);
}
.btn-secondary:hover {
background: var(--bg-gradient);
border-color: var(--primary);
}
.btn-icon {
padding: 0.5rem;
border-radius: 8px;
color: var(--text-light);
border: 1px solid var(--border);
background: var(--surface);
transition: all 0.2s ease;
}
.btn-icon:hover {
background: var(--primary-light);
color: var(--primary);
border-color: var(--primary);
}
/* Responsive */
@media (max-width: 768px) {
.app {
grid-template-columns: 1fr;
}
.sidebar {
display: none;
}
.main-content {
margin: 0.5rem;
}
}
</style>
<link rel="stylesheet" href="/css/styles.css">
</head>
<body>
<!-- Top Navigation -->
<nav class="top-nav">
<a href="/" class="nav-brand">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"></path>
</svg>
Notes App
</a>
<div class="user-menu">
<div class="user-info">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path>
<circle cx="12" cy="7" r="4"></circle>
</svg>
<span id="user-info">Utilisateur</span>
</div>
<button class="btn btn-secondary admin-btn" id="admin-btn">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M12 2a10 10 0 0 0-7.743 16.33l-1.964 1.963A12 12 0 1 1 14.243 3.71L12 6"></path>
<path d="M12 8v4l3 3"></path>
</svg>
Admin
</button>
<button class="btn btn-secondary" id="logout-btn">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path>
<polyline points="16 17 21 12 16 7"></polyline>
<line x1="21" y1="12" x2="9" y2="12"></line>
</svg>
Déconnexion
</button>
</div>
</nav>
<!-- Main App -->
<div class="app">
<aside class="sidebar">
<div class="search-container">
<input type="text" class="search-input" placeholder="Rechercher une note...">
</div>
<button class="btn btn-primary" id="new-note-btn">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="12" y1="5" x2="12" y2="19"></line>
<line x1="5" y1="12" x2="19" y2="12"></line>
</svg>
Nouvelle Note
</button>
<div class="notes-list" id="notes-list">
<!-- Notes will be dynamically inserted here -->
</div>
</aside>
<main class="main-content">
<div class="editor">
<input type="text" class="editor-title" placeholder="Titre de la note" id="note-title">
<div class="editor-content" contenteditable="true" id="note-content"></div>
</div>
</main>
</div>
<!-- Admin Panel -->
<div id="admin-panel" class="admin-panel hidden">
<div class="admin-content">
<div class="admin-header">
<h2>Administration</h2>
<button class="btn-icon" id="close-admin-btn">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="18" y1="6" x2="6" y2="18"></line>
<line x1="6" y1="6" x2="18" y2="18"></line>
</svg>
</button>
</div>
<button class="btn btn-primary" id="add-user-btn">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path>
<circle cx="8.5" cy="7" r="4"></circle>
<line x1="20" y1="8" x2="20" y2="14"></line>
<line x1="23" y1="11" x2="17" y2="11"></line>
</svg>
Ajouter un utilisateur
</button>
<div class="user-list" id="users-list">
<!-- Users will be dynamically inserted here -->
</div>
</div>
</div>
<div id="root"></div>
<script src="/js/auth.js"></script>
<script src="/js/notes.js"></script>
<script src="/js/admin.js"></script>
+8
View File
@@ -7,6 +7,7 @@ class AdminService {
this.closeAdminBtn = document.getElementById('close-admin-btn');
this.addUserBtn = document.getElementById('add-user-btn');
this.usersList = document.getElementById('users-list');
this.adminBtn = document.getElementById('admin-btn');
if (this.adminPanel && this.closeAdminBtn && this.addUserBtn && this.usersList) {
this.setupEventListeners();
@@ -20,6 +21,13 @@ class AdminService {
if (this.addUserBtn) {
this.addUserBtn.addEventListener('click', () => this.showAddUserForm());
}
if (this.adminBtn) {
this.adminBtn.addEventListener('click', () => {
if (this.adminPanel) {
this.adminPanel.classList.remove('hidden');
}
});
}
}
async loadUsers() {
+7 -2
View File
@@ -5,6 +5,7 @@ class AuthService {
this.loginForm = document.getElementById('login-form');
this.logoutBtn = document.getElementById('logout-btn');
this.userInfo = document.getElementById('user-info');
this.adminPanel = document.getElementById('admin-panel');
this.setupEventListeners();
this.updateUI();
@@ -63,7 +64,11 @@ class AuthService {
updateUI() {
const authContainer = document.getElementById('auth-container');
const appContainer = document.getElementById('app-container');
const adminPanel = document.getElementById('admin-panel');
// S'assurer que le panneau d'administration est caché au démarrage
if (this.adminPanel) {
this.adminPanel.classList.add('hidden');
}
if (this.token && this.user) {
if (authContainer) authContainer.classList.add('hidden');
@@ -78,7 +83,7 @@ class AuthService {
adminBtn.className = 'admin-btn ml-4 text-sm text-gray-600 hover:text-gray-900';
adminBtn.textContent = 'Admin';
adminBtn.onclick = () => {
if (adminPanel) adminPanel.classList.remove('hidden');
if (this.adminPanel) this.adminPanel.classList.remove('hidden');
};
this.userInfo.parentNode.insertBefore(adminBtn, this.logoutBtn);
}