Refactor: Migration complète vers React/TypeScript

Suppression des anciens fichiers obsolètes suite à la migration vers React/TypeScript:
- Suppression du dossier client/ (ancienne version dupliquée)
- Suppression de public/index.html et public/login.html (anciennes pages HTML)
- Suppression de public/js/* (anciens scripts vanilla JS)
- Suppression de public/css/* (anciens styles CSS)

Mise à jour de la documentation:
- README.md mis à jour pour refléter la stack technique actuelle (React 19 + TypeScript)
- Ajout des nouvelles dépendances frontend (shadcn/ui, TanStack Query, React Router v7)

Le projet utilise désormais exclusivement React/TypeScript avec Vite pour le frontend.
This commit is contained in:
Claude committed 2025-11-12 07:10:55 +00:00
1 parent f7023ed938
commit 6fe6b4c010
39 files changed
+4 -11736

No files matched your search

-154
View File
@@ -1,154 +0,0 @@
/* Animations CSS */
/* Fade in */
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
/* Backdrop fade - GPU accelerated */
@keyframes backdropFade {
from {
opacity: 0;
backdrop-filter: blur(0px);
}
to {
opacity: 1;
backdrop-filter: blur(4px);
}
}
/* Modal open animation - GPU accelerated */
@keyframes modalOpen {
from {
opacity: 0;
transform: scale3d(0.9, 0.9, 1) translateZ(0);
}
to {
opacity: 1;
transform: scale3d(1, 1, 1) translateZ(0);
}
}
/* Slide in from bottom - GPU accelerated */
@keyframes slideInUp {
from {
opacity: 0;
transform: translate3d(0, 20px, 0);
}
to {
opacity: 1;
transform: translate3d(0, 0, 0);
}
}
/* Slide in from right - GPU accelerated */
@keyframes slideInRight {
from {
opacity: 0;
transform: translate3d(20px, 0, 0);
}
to {
opacity: 1;
transform: translate3d(0, 0, 0);
}
}
/* Card hover animation */
@keyframes cardHover {
from {
transform: translateY(0);
}
to {
transform: translateY(-4px);
}
}
/* Pulse animation */
@keyframes pulse {
0%, 100% {
opacity: 1;
}
50% {
opacity: 0.5;
}
}
/* Spin animation */
@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
/* Application des animations */
.modal-backdrop {
animation: backdropFade 0.25s ease-out;
will-change: opacity, backdrop-filter;
}
.modal-content {
animation: modalOpen 0.3s cubic-bezier(0.4, 0, 0.2, 1);
will-change: transform, opacity;
backface-visibility: hidden;
perspective: 1000px;
}
.note-card {
animation: slideInUp 0.25s ease-out;
will-change: transform, opacity;
backface-visibility: hidden;
}
.todo-item {
animation: slideInRight 0.2s ease-out;
will-change: transform, opacity;
backface-visibility: hidden;
}
.user-dropdown {
animation: slideInUp 0.2s ease-out;
will-change: transform, opacity;
backface-visibility: hidden;
}
/* Animation pour le modal image */
.image-modal {
will-change: opacity;
}
.image-modal-content {
will-change: transform, opacity;
backface-visibility: hidden;
}
/* Loading state */
.loading {
animation: pulse 1.5s ease-in-out infinite;
}
.spinning {
animation: spin 1s linear infinite;
}
.spinner {
animation: spin 1s linear infinite;
width: 20px;
height: 20px;
}
/* Smooth transitions */
.smooth-transition {
transition: all var(--transition-base);
}
.smooth-transition-slow {
transition: all var(--transition-slow);
}
File diff suppressed because it is too large. Load diff
-630
View File
@@ -1,630 +0,0 @@
/* Layout - Structure principale */
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: var(--font-family);
font-size: var(--font-size-base);
color: var(--color-text-primary);
background: var(--color-background);
line-height: 1.6;
min-height: 100vh;
}
/* Header */
.header {
position: fixed;
top: 0;
left: 0;
right: 0;
height: var(--header-height);
background: var(--color-card);
border-bottom: 1px solid var(--color-border);
box-shadow: var(--shadow-sm);
z-index: var(--z-header);
}
.header-container {
max-width: var(--max-width);
height: 100%;
margin: 0 auto;
padding: 0 var(--spacing-xl);
display: flex;
align-items: center;
gap: var(--spacing-xl);
}
/* Logo */
.logo {
display: flex;
align-items: center;
gap: var(--spacing-md);
flex-shrink: 0;
}
.logo-icon {
width: 32px;
height: 32px;
color: var(--color-accent);
}
.logo-text {
font-size: var(--font-size-xl);
font-weight: var(--font-weight-bold);
color: var(--color-accent);
letter-spacing: -0.5px;
}
/* Search */
.search-container {
flex: 1;
max-width: 500px;
position: relative;
}
.search-icon {
position: absolute;
left: var(--spacing-md);
top: 50%;
transform: translateY(-50%);
width: 18px;
height: 18px;
color: var(--color-text-secondary);
pointer-events: none;
}
.search-input {
width: 100%;
height: 44px;
padding: 0 var(--spacing-xl) 0 44px;
border: 1px solid var(--color-border);
border-radius: var(--radius-full);
font-size: var(--font-size-base);
background: var(--color-background);
color: var(--color-text-primary);
transition: all var(--transition-base);
}
.search-input:focus {
outline: none;
border-color: var(--color-accent);
background: var(--color-card);
box-shadow: var(--shadow-sm);
}
.search-clear {
position: absolute;
right: var(--spacing-md);
top: 50%;
transform: translateY(-50%);
width: 24px;
height: 24px;
padding: 4px;
border: none;
background: transparent;
cursor: pointer;
color: var(--color-text-secondary);
border-radius: 50%;
transition: all var(--transition-fast);
}
.search-clear:hover {
background: var(--color-hover);
color: var(--color-text-primary);
}
.search-clear svg {
width: 100%;
height: 100%;
}
/* User Menu */
.user-menu {
position: relative;
flex-shrink: 0;
}
.user-button {
display: flex;
align-items: center;
gap: var(--spacing-sm);
padding: var(--spacing-sm) var(--spacing-md);
border: 1px solid var(--color-border);
border-radius: var(--radius-full);
background: var(--color-card);
color: var(--color-text-primary);
font-size: var(--font-size-sm);
font-weight: var(--font-weight-medium);
cursor: pointer;
transition: all var(--transition-base);
}
.user-button:hover {
background: var(--color-hover);
box-shadow: var(--shadow-sm);
}
.user-icon {
width: 20px;
height: 20px;
}
.dropdown-arrow {
width: 16px;
height: 16px;
transition: transform var(--transition-base);
}
.user-menu:hover .dropdown-arrow {
transform: rotate(180deg);
}
.user-dropdown {
position: absolute;
top: calc(100% + var(--spacing-sm));
right: 0;
min-width: 200px;
background: var(--color-card);
border: 1px solid var(--color-border);
border-radius: var(--radius-md);
box-shadow: var(--shadow-lg);
opacity: 0;
visibility: hidden;
transform: translateY(-10px);
transition: all var(--transition-base);
z-index: var(--z-dropdown);
}
.user-menu:hover .user-dropdown {
opacity: 1;
visibility: visible;
transform: translateY(0);
}
.dropdown-item {
display: flex;
align-items: center;
gap: var(--spacing-md);
width: 100%;
padding: var(--spacing-md) var(--spacing-lg);
border: none;
background: transparent;
color: var(--color-text-primary);
font-size: var(--font-size-sm);
font-weight: var(--font-weight-medium);
text-align: left;
cursor: pointer;
transition: background var(--transition-fast);
}
.dropdown-item:first-child {
border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.dropdown-item:last-child {
border-radius: 0 0 var(--radius-md) var(--radius-md);
}
.dropdown-item:hover {
background: var(--color-hover);
}
.dropdown-item svg {
width: 18px;
height: 18px;
}
/* Main Content */
.main-content {
margin-top: var(--header-height);
min-height: calc(100vh - var(--header-height));
padding: var(--spacing-2xl) var(--spacing-xl);
}
.content-container {
max-width: var(--max-width);
margin: 0 auto;
display: grid;
grid-template-columns: 1fr var(--todo-box-width) var(--todo-box-width);
gap: var(--spacing-xl);
align-items: start;
}
/* Notes Section */
.notes-section {
min-width: 0;
}
.section-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: var(--spacing-lg);
gap: var(--spacing-lg);
flex-wrap: wrap;
}
.section-title {
font-size: var(--font-size-2xl);
font-weight: var(--font-weight-bold);
color: var(--color-text-primary);
}
.section-actions {
display: flex;
align-items: center;
gap: var(--spacing-md);
}
.view-filters {
display: flex;
gap: var(--spacing-xs);
background: var(--color-background);
border-radius: var(--radius-md);
padding: 4px;
}
.view-filter {
display: flex;
align-items: center;
gap: var(--spacing-xs);
padding: var(--spacing-sm) var(--spacing-md);
border: none;
border-radius: var(--radius-sm);
background: transparent;
color: var(--color-text-secondary);
font-size: var(--font-size-sm);
font-weight: var(--font-weight-medium);
cursor: pointer;
transition: all var(--transition-fast);
}
.view-filter svg {
width: 16px;
height: 16px;
}
.view-filter:hover {
background: var(--color-hover);
color: var(--color-text-primary);
}
.view-filter.active {
background: var(--color-card);
color: var(--color-accent);
box-shadow: var(--shadow-xs);
}
.btn-new-note {
display: flex;
align-items: center;
gap: var(--spacing-sm);
padding: var(--spacing-md) var(--spacing-lg);
border: none;
border-radius: var(--radius-md);
background: var(--color-accent);
color: white;
font-size: var(--font-size-sm);
font-weight: var(--font-weight-semibold);
cursor: pointer;
transition: all var(--transition-base);
box-shadow: var(--shadow-sm);
}
.btn-new-note:hover {
background: var(--color-accent-hover);
box-shadow: var(--shadow-md);
transform: translateY(-1px);
}
.btn-new-note svg {
width: 18px;
height: 18px;
}
.notes-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(var(--note-width), 1fr));
gap: var(--spacing-lg);
}
/* Todo Box */
.todo-box {
position: sticky;
top: calc(var(--header-height) + var(--spacing-xl));
background: var(--color-card);
border: 1px solid var(--color-border);
border-radius: var(--radius-lg);
padding: var(--spacing-xl);
box-shadow: var(--shadow-md);
max-height: calc(100vh - var(--header-height) - var(--spacing-2xl) * 2);
display: flex;
flex-direction: column;
}
.todo-box-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: var(--spacing-lg);
}
.todo-box-title {
font-size: var(--font-size-xl);
font-weight: var(--font-weight-bold);
color: var(--color-text-primary);
}
.todo-counter {
font-size: var(--font-size-sm);
color: var(--color-text-secondary);
font-weight: var(--font-weight-medium);
}
/* RSS Box */
.rss-box {
position: sticky;
top: calc(var(--header-height) + var(--spacing-xl));
background: var(--color-card);
border: 1px solid var(--color-border);
border-radius: var(--radius-lg);
padding: var(--spacing-xl);
box-shadow: var(--shadow-md);
max-height: calc(100vh - var(--header-height) - var(--spacing-2xl) * 2);
display: flex;
flex-direction: column;
}
.rss-box-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: var(--spacing-lg);
}
.rss-box-title {
font-size: var(--font-size-xl);
font-weight: var(--font-weight-bold);
color: var(--color-text-primary);
}
.btn-summarize {
width: 36px;
height: 36px;
padding: 8px;
border: 1px solid var(--color-border);
border-radius: var(--radius-md);
background: var(--color-accent);
color: white;
cursor: pointer;
transition: all var(--transition-fast);
display: flex;
align-items: center;
justify-content: center;
}
.btn-summarize:hover {
background: var(--color-accent-hover);
box-shadow: var(--shadow-md);
transform: scale(1.05);
}
.btn-summarize svg {
width: 100%;
height: 100%;
}
.rss-articles-list {
flex: 1;
overflow-y: auto;
display: flex;
flex-direction: column;
gap: var(--spacing-md);
}
.rss-empty {
text-align: center;
color: var(--color-text-secondary);
font-size: var(--font-size-sm);
padding: var(--spacing-2xl);
font-style: italic;
}
.rss-article {
padding: var(--spacing-md);
background: var(--color-background);
border-radius: var(--radius-md);
border: 1px solid var(--color-border);
transition: all var(--transition-fast);
cursor: pointer;
}
.rss-article:hover {
background: var(--color-hover);
border-color: var(--color-accent);
box-shadow: var(--shadow-sm);
}
.rss-article-title {
font-size: var(--font-size-sm);
font-weight: var(--font-weight-semibold);
color: var(--color-text-primary);
margin-bottom: var(--spacing-xs);
line-height: 1.4;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.rss-article-meta {
display: flex;
align-items: center;
justify-content: space-between;
font-size: var(--font-size-xs);
color: var(--color-text-secondary);
margin-bottom: var(--spacing-xs);
}
.rss-article-source {
font-weight: var(--font-weight-medium);
}
.rss-article-description {
font-size: var(--font-size-xs);
color: var(--color-text-secondary);
line-height: 1.5;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.rss-summary {
padding: var(--spacing-lg);
background: var(--color-background);
border-radius: var(--radius-md);
border: 1px solid var(--color-border);
margin-bottom: var(--spacing-md);
}
.rss-summary-header {
margin-bottom: var(--spacing-md);
padding-bottom: var(--spacing-sm);
border-bottom: 1px solid var(--color-border);
}
.rss-summary-title {
font-size: var(--font-size-base);
font-weight: var(--font-weight-semibold);
color: var(--color-text-primary);
margin-bottom: var(--spacing-xs);
}
.rss-summary-meta {
display: flex;
gap: var(--spacing-md);
font-size: var(--font-size-xs);
color: var(--color-text-secondary);
}
.rss-summary-content {
font-size: var(--font-size-sm);
color: var(--color-text-primary);
line-height: 1.6;
}
.rss-summary-content h2 {
font-size: var(--font-size-lg);
font-weight: var(--font-weight-bold);
color: var(--color-text-primary);
margin: var(--spacing-md) 0 var(--spacing-sm) 0;
}
.rss-summary-content h3 {
font-size: var(--font-size-base);
font-weight: var(--font-weight-semibold);
color: var(--color-text-primary);
margin: var(--spacing-sm) 0 var(--spacing-xs) 0;
}
.rss-summary-content ul,
.rss-summary-content ol {
margin: var(--spacing-sm) 0;
padding-left: var(--spacing-xl);
}
.rss-summary-content li {
margin-bottom: var(--spacing-xs);
}
.rss-summary-content strong {
font-weight: var(--font-weight-semibold);
color: var(--color-text-primary);
}
.rss-summary-content em {
font-style: italic;
}
.rss-summary-content a.rss-link {
color: var(--color-accent);
text-decoration: none;
font-weight: var(--font-weight-medium);
transition: all var(--transition-fast);
border-bottom: 1px solid transparent;
}
.rss-summary-content a.rss-link:hover {
border-bottom-color: var(--color-accent);
opacity: 0.8;
}
/* Nouveau style pour résumés par article */
.rss-summary-article {
padding: var(--spacing-md);
background: var(--color-background);
border-radius: var(--radius-md);
border: 1px solid var(--color-border);
margin-bottom: var(--spacing-md);
transition: all var(--transition-fast);
}
.rss-summary-article:hover {
border-color: var(--color-accent);
box-shadow: var(--shadow-sm);
}
.rss-summary-article .rss-summary-content {
font-size: var(--font-size-sm);
line-height: 1.6;
}
.rss-summary-article .rss-summary-meta {
margin-top: var(--spacing-sm);
padding-top: var(--spacing-sm);
border-top: 1px solid var(--color-border);
display: flex;
gap: var(--spacing-md);
font-size: var(--font-size-xs);
color: var(--color-text-secondary);
}
/* Responsive */
@media (max-width: 1200px) {
.content-container {
grid-template-columns: 1fr;
}
.todo-box,
.rss-box {
position: static;
max-height: none;
}
}
@media (max-width: 768px) {
.header-container {
padding: 0 var(--spacing-md);
}
.search-container {
max-width: 300px;
}
.logo-text {
display: none;
}
.main-content {
padding: var(--spacing-lg) var(--spacing-md);
}
.notes-grid {
grid-template-columns: 1fr;
}
}
-46
View File
@@ -1,46 +0,0 @@
/* Reset CSS pour normaliser les styles entre navigateurs */
*, *::before, *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html {
-webkit-text-size-adjust: 100%;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
body {
min-height: 100vh;
line-height: 1.5;
}
img, picture, video, canvas, svg {
display: block;
max-width: 100%;
}
input, button, textarea, select {
font: inherit;
}
p, h1, h2, h3, h4, h5, h6 {
overflow-wrap: break-word;
}
button {
cursor: pointer;
border: none;
background: none;
}
ul, ol {
list-style: none;
}
a {
text-decoration: none;
color: inherit;
}
-381
View File
@@ -1,381 +0,0 @@
/* Skeleton Loaders pour améliorer la fluidité perçue */
.skeleton {
background: linear-gradient(
90deg,
var(--color-border) 25%,
#f0f0f0 50%,
var(--color-border) 75%
);
background-size: 200% 100%;
animation: loading 1.5s ease-in-out infinite;
border-radius: var(--radius-md);
}
@keyframes loading {
0% {
background-position: 200% 0;
}
100% {
background-position: -200% 0;
}
}
.skeleton-note-card {
height: 200px;
margin-bottom: var(--spacing-lg);
}
.skeleton-todo {
height: 40px;
margin-bottom: var(--spacing-sm);
}
.skeleton-rss-article {
height: 80px;
margin-bottom: var(--spacing-md);
}
/* Loading indicators */
.loading-spinner {
display: inline-block;
width: 20px;
height: 20px;
border: 3px solid rgba(102, 126, 234, 0.1);
border-radius: 50%;
border-top-color: var(--color-accent);
animation: spinner 0.6s linear infinite;
}
@keyframes spinner {
to {
transform: rotate(360deg);
}
}
.loading-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(255, 255, 255, 0.8);
display: flex;
align-items: center;
justify-content: center;
z-index: 9999;
opacity: 0;
pointer-events: none;
transition: opacity 0.2s;
}
.loading-overlay.active {
opacity: 1;
pointer-events: all;
}
.loading-content {
text-align: center;
padding: 30px;
background: white;
border-radius: var(--radius-lg);
box-shadow: var(--shadow-lg);
}
.loading-content .loading-spinner {
width: 50px;
height: 50px;
border-width: 4px;
margin-bottom: 15px;
}
.loading-content p {
margin: 0;
color: var(--color-text-secondary);
font-size: var(--font-size-sm);
}
/* Refresh indicator */
.refresh-indicator {
position: fixed;
top: 80px;
right: 20px;
background: var(--color-accent);
color: white;
padding: 8px 16px;
border-radius: var(--radius-lg);
font-size: var(--font-size-xs);
box-shadow: var(--shadow-md);
display: flex;
align-items: center;
gap: 8px;
opacity: 0;
transform: translateY(-10px);
transition: all 0.3s;
pointer-events: none;
z-index: 1000;
}
.refresh-indicator.active {
opacity: 1;
transform: translateY(0);
}
.refresh-indicator .loading-spinner {
width: 14px;
height: 14px;
border-width: 2px;
border-color: rgba(255, 255, 255, 0.3);
border-top-color: white;
}
/* Optimistic UI */
.optimistic-update {
opacity: 0.6;
pointer-events: none;
}
/* Smooth fade in */
.fade-in {
animation: fadeIn 0.3s ease-in;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* Empty state avec animation */
.empty-state {
text-align: center;
padding: 60px 20px;
color: var(--color-text-secondary);
animation: fadeIn 0.5s ease-in;
}
.empty-state-icon {
font-size: 48px;
margin-bottom: 16px;
opacity: 0.5;
}
.empty-state-text {
font-size: var(--font-size-base);
margin-bottom: 8px;
}
.empty-state-hint {
font-size: var(--font-size-sm);
opacity: 0.7;
}
/* Système de notifications */
.notifications-container {
position: fixed;
top: calc(var(--header-height) + 20px);
right: 20px;
z-index: 300;
display: flex;
flex-direction: column;
gap: 12px;
max-width: 400px;
pointer-events: none;
}
.notification {
background: var(--color-card);
border: 1px solid var(--color-border);
border-radius: var(--radius-md);
padding: 16px 20px;
box-shadow: var(--shadow-lg);
display: flex;
align-items: center;
gap: 12px;
opacity: 0;
transform: translate3d(400px, 0, 0);
animation: slideInRight 0.3s ease-out forwards;
pointer-events: auto;
min-width: 300px;
position: relative;
will-change: transform, opacity;
backface-visibility: hidden;
}
.notification.closing {
animation: slideOutRight 0.3s ease-in forwards;
will-change: transform, opacity;
}
.notification-icon {
width: 24px;
height: 24px;
flex-shrink: 0;
}
.notification-success {
border-left: 4px solid var(--color-success);
}
.notification-success .notification-icon {
color: var(--color-success);
}
.notification-error {
border-left: 4px solid var(--color-danger);
}
.notification-error .notification-icon {
color: var(--color-danger);
}
.notification-warning {
border-left: 4px solid var(--color-warning);
}
.notification-warning .notification-icon {
color: var(--color-warning);
}
.notification-info {
border-left: 4px solid var(--color-info);
}
.notification-info .notification-icon {
color: var(--color-info);
}
.notification-content {
flex: 1;
font-size: var(--font-size-sm);
color: var(--color-text-primary);
line-height: 1.4;
}
.notification-close {
width: 24px;
height: 24px;
padding: 4px;
border: none;
background: transparent;
color: var(--color-text-secondary);
cursor: pointer;
border-radius: 50%;
transition: all var(--transition-fast);
flex-shrink: 0;
}
.notification-close:hover {
background: var(--color-hover);
color: var(--color-text-primary);
}
@keyframes slideInRight {
from {
opacity: 0;
transform: translate3d(400px, 0, 0);
}
to {
opacity: 1;
transform: translate3d(0, 0, 0);
}
}
@keyframes slideOutRight {
from {
opacity: 1;
transform: translate3d(0, 0, 0);
}
to {
opacity: 0;
transform: translate3d(400px, 0, 0);
}
}
/* Modal pour agrandir les images - GPU accelerated */
.image-modal {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0);
z-index: 400;
display: none;
align-items: center;
justify-content: center;
padding: 40px;
cursor: pointer;
transition: background 0.25s ease-out;
will-change: background;
}
.image-modal.active {
display: flex;
background: rgba(0, 0, 0, 0.9);
animation: fadeIn 0.25s ease-out;
}
.image-modal-content {
position: relative;
max-width: 90vw;
max-height: 90vh;
cursor: default;
transform: scale3d(0.95, 0.95, 1);
opacity: 0;
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease-out;
will-change: transform, opacity;
backface-visibility: hidden;
}
.image-modal.active .image-modal-content {
transform: scale3d(1, 1, 1);
opacity: 1;
}
.image-modal-img {
max-width: 100%;
max-height: 90vh;
object-fit: contain;
border-radius: var(--radius-md);
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
transform: translateZ(0);
backface-visibility: hidden;
}
.image-modal-close {
position: fixed;
top: 20px;
right: 20px;
width: 48px;
height: 48px;
border: none;
background: rgba(255, 255, 255, 0.1);
color: white;
font-size: 32px;
cursor: pointer;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
transition: all var(--transition-fast);
backdrop-filter: blur(10px);
will-change: transform, background;
backface-visibility: hidden;
transform: translateZ(0);
}
.image-modal-close:hover {
background: rgba(255, 255, 255, 0.2);
transform: scale3d(1.1, 1.1, 1) translateZ(0);
}
.image-modal-close svg {
width: 24px;
height: 24px;
}
-174
View File
@@ -1,174 +0,0 @@
@import 'tailwindcss/base';
@import 'tailwindcss/components';
@import 'tailwindcss/utilities';
/* Base styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
:root {
--primary-color: #3B82F6;
--background-color: #FAFAFA;
--card-background: #FFFFFF;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
line-height: 1.5;
color: #111827;
background-color: var(--background-color);
}
/* Utility classes */
.hidden {
display: none !important;
}
/* Transitions */
.transition {
transition: all 200ms ease-in-out;
}
/* Form elements */
input[type="text"],
input[type="password"],
textarea {
width: 100%;
padding: 0.5rem 0.75rem;
border: 1px solid #E5E7EB;
border-radius: 0.375rem;
background-color: white;
}
input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus {
outline: none;
border-color: var(--primary-color);
ring: 2px var(--primary-color);
}
/* Buttons */
.btn {
padding: 0.5rem 1rem;
border-radius: 0.375rem;
font-weight: 500;
cursor: pointer;
transition: all 200ms;
}
.btn-primary {
background-color: var(--primary-color);
color: white;
}
.btn-primary:hover {
background-color: #2563EB;
}
/* Note item in sidebar */
.note-item {
padding: 0.75rem;
border-radius: 0.375rem;
cursor: pointer;
transition: background-color 200ms;
}
.note-item:hover {
background-color: #F3F4F6;
}
.note-item.active {
background-color: #EFF6FF;
border-left: 3px solid var(--primary-color);
}
/* Todo items */
.todo-item {
display: flex;
align-items: center;
padding: 0.5rem;
border-radius: 0.375rem;
background-color: #F9FAFB;
}
.todo-item input[type="checkbox"] {
margin-right: 0.75rem;
}
.todo-item.completed {
text-decoration: line-through;
color: #6B7280;
}
/* Image thumbnails */
.image-thumbnail {
position: relative;
aspect-ratio: 1;
border-radius: 0.375rem;
overflow: hidden;
}
.image-thumbnail img {
width: 100%;
height: 100%;
object-fit: cover;
}
.image-thumbnail .delete-btn {
position: absolute;
top: 0.25rem;
right: 0.25rem;
padding: 0.25rem;
background-color: rgba(0, 0, 0, 0.5);
border-radius: 9999px;
color: white;
cursor: pointer;
}
/* Admin panel styles */
.user-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.75rem;
background-color: #F9FAFB;
border-radius: 0.375rem;
}
.user-item .actions {
display: flex;
gap: 0.5rem;
}
/* Animations */
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
.fade-in {
animation: fadeIn 200ms ease-in-out;
}
/* Responsive adjustments */
@media (max-width: 768px) {
aside {
width: 100%;
height: auto;
position: relative;
}
main {
margin-left: 0;
}
.note-editor {
margin: 1rem;
}
}
-82
View File
@@ -1,82 +0,0 @@
/* Variables CSS globales - Thème clair moderne */
:root {
/* Couleurs principales */
--color-background: #F8F9FA;
--color-card: #FFFFFF;
--color-accent: #000000;
--color-accent-hover: #333333;
--color-text-primary: #000000;
--color-text-secondary: #6C757D;
--color-border: #DEE2E6;
--color-success: #28A745;
--color-danger: #DC3545;
--color-warning: #FFC107;
--color-info: #17A2B8;
/* Couleurs spécifiques */
--color-hover: #F1F3F5;
--color-active: #E9ECEF;
--color-disabled: #ADB5BD;
/* Typographie */
--font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
--font-size-xs: 11px;
--font-size-sm: 13px;
--font-size-base: 15px;
--font-size-lg: 17px;
--font-size-xl: 20px;
--font-size-2xl: 28px;
--font-size-3xl: 36px;
--font-weight-normal: 400;
--font-weight-medium: 500;
--font-weight-semibold: 600;
--font-weight-bold: 700;
/* Spacing */
--spacing-xs: 4px;
--spacing-sm: 8px;
--spacing-md: 16px;
--spacing-lg: 24px;
--spacing-xl: 32px;
--spacing-2xl: 48px;
--spacing-3xl: 64px;
/* Border radius */
--radius-sm: 6px;
--radius-md: 10px;
--radius-lg: 14px;
--radius-xl: 20px;
--radius-full: 9999px;
/* Shadows - Style moderne élégant */
--shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
--shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.06);
--shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
--shadow-lg: 0 8px 20px rgba(0, 0, 0, 0.1);
--shadow-xl: 0 16px 40px rgba(0, 0, 0, 0.12);
--shadow-2xl: 0 24px 60px rgba(0, 0, 0, 0.15);
/* Shadow hover effects */
--shadow-hover: 0 6px 16px rgba(0, 0, 0, 0.12);
--shadow-active: 0 2px 8px rgba(0, 0, 0, 0.1);
/* Transitions */
--transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
--transition-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
--transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
/* Dimensions - Optimisé pour 1920x1080 */
--header-height: 70px;
--max-width: 1800px;
--note-width: 320px;
--note-expanded-width: 680px;
--todo-box-width: 420px;
/* Z-index */
--z-header: 100;
--z-modal: 200;
--z-dropdown: 150;
--z-tooltip: 250;
}
-324
View File
@@ -1,324 +0,0 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>NoteFlow - Notes & Tasks</title>
<!-- Favicon -->
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
<!-- CSS -->
<link rel="stylesheet" href="/css/reset.css">
<link rel="stylesheet" href="/css/variables.css">
<link rel="stylesheet" href="/css/layout.css">
<link rel="stylesheet" href="/css/components.css">
<link rel="stylesheet" href="/css/animations.css">
<link rel="stylesheet" href="/css/skeleton.css">
</head>
<body>
<!-- Header -->
<header class="header">
<div class="header-container">
<!-- Logo -->
<div class="logo">
<svg class="logo-icon" viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg">
<rect x="8" y="6" width="24" height="28" rx="2" fill="currentColor"/>
<rect x="10" y="8" width="20" height="24" rx="1" fill="white"/>
<line x1="13" y1="13" x2="27" y2="13" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
<line x1="13" y1="18" x2="24" y2="18" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
<line x1="13" y1="23" x2="27" y2="23" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
<circle cx="15" cy="28" r="2" fill="none" stroke="currentColor" stroke-width="1.2"/>
<path d="M 14 28 L 14.8 28.8 L 16.5 27" stroke="currentColor" stroke-width="1.2" fill="none" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
<span class="logo-text">NoteFlow</span>
</div>
<!-- Search -->
<div class="search-container">
<svg class="search-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="11" cy="11" r="8"></circle>
<path d="m21 21-4.35-4.35"></path>
</svg>
<input type="text" id="searchInput" placeholder="Rechercher des notes..." class="search-input">
<button id="searchClear" class="search-clear" style="display: none;">
<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>
<!-- User -->
<div class="user-menu">
<button class="user-button" id="userInfo">
<svg class="user-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<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="userName">User</span>
<svg class="dropdown-arrow" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="6 9 12 15 18 9"></polyline>
</svg>
</button>
<div class="user-dropdown" id="userDropdown">
<button class="dropdown-item" id="adminBtn" style="display: none;">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="3"></circle>
<path d="M12 1v6m0 6v6m5.657-13.657L14 9l-2.343-2.343M9 14l-3.657 3.657M1 12h6m6 0h6m-13.657 5.657L9 14l2.343 2.343M14 9l3.657-3.657"></path>
</svg>
Administration
</button>
<button class="dropdown-item" id="logoutBtn">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<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>
</div>
</div>
</header>
<!-- Main Content -->
<main class="main-content">
<div class="content-container">
<!-- Notes Section -->
<div class="notes-section">
<div class="section-header">
<h2 class="section-title">Notes</h2>
<div class="section-actions">
<div class="view-filters">
<button class="view-filter active" data-view="active">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"/>
</svg>
Actives
</button>
<button class="view-filter" data-view="archived">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="21 8 21 21 3 21 3 8"></polyline>
<rect x="1" y="3" width="22" height="5"></rect>
<line x1="10" y1="12" x2="14" y2="12"></line>
</svg>
Archivées
</button>
</div>
<button class="btn-new-note" id="newNoteBtn">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<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>
</div>
<div class="notes-grid" id="notesGrid">
<!-- Notes will be inserted here dynamically -->
</div>
</div>
<!-- Todo Box -->
<div class="todo-box">
<div class="todo-box-header">
<h2 class="todo-box-title">À faire</h2>
<span class="todo-counter" id="todoCounter">0 tâches</span>
</div>
<div class="todo-input-wrapper">
<input type="text" id="todoInput" class="todo-input" placeholder="Ajouter une tâche...">
<button id="addTodoBtn" class="btn-add-todo">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<line x1="12" y1="5" x2="12" y2="19"></line>
<line x1="5" y1="12" x2="19" y2="12"></line>
</svg>
</button>
</div>
<div class="todo-filters">
<button class="filter-btn active" data-filter="all">Toutes</button>
<button class="filter-btn" data-filter="active">Actives</button>
<button class="filter-btn" data-filter="completed">Terminées</button>
</div>
<div class="todo-list" id="todoList">
<!-- Todos will be inserted here -->
</div>
</div>
<!-- RSS Box -->
<div class="rss-box">
<div class="rss-box-header">
<h2 class="rss-box-title">📰 Actualités</h2>
<button class="btn-summarize" id="summarizeRssBtn" title="Générer un résumé avec IA">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M12 2L2 7l10 5 10-5-10-5z"></path>
<path d="M2 17l10 5 10-5"></path>
<path d="M2 12l10 5 10-5"></path>
</svg>
</button>
</div>
<div class="rss-articles-list" id="rssArticlesList">
<p class="rss-empty">Aucun article pour le moment</p>
</div>
</div>
</div>
</main>
<!-- Modal Admin -->
<div class="modal-backdrop" id="adminModal" style="display: none;">
<div class="modal-content admin-modal">
<div class="modal-header">
<h2>Administration</h2>
<button class="modal-close" id="closeAdminModal">✕</button>
</div>
<div class="admin-tabs">
<button class="admin-tab active" data-tab="users">👥 Utilisateurs</button>
<button class="admin-tab" data-tab="rss">📰 Flux RSS</button>
<button class="admin-tab" data-tab="openrouter">🤖 OpenRouter</button>
</div>
<!-- Onglet Utilisateurs -->
<div class="admin-tab-content" id="tab-users">
<div class="admin-actions">
<button class="action-btn" id="createUserBtn">+ Créer un utilisateur</button>
</div>
<div class="users-table-container">
<table class="users-table" id="usersTable">
<thead>
<tr>
<th>ID</th>
<th>Nom d'utilisateur</th>
<th>Admin</th>
<th>Créé le</th>
<th>Actions</th>
</tr>
</thead>
<tbody id="usersTableBody">
<!-- Users will be inserted here -->
</tbody>
</table>
</div>
</div>
<!-- Onglet RSS -->
<div class="admin-tab-content" id="tab-rss" style="display: none;">
<div class="admin-actions">
<input type="url" id="rssUrlInput" class="rss-url-input" placeholder="https://example.com/feed.xml">
<button class="action-btn" id="addRssFeedBtn">+ Ajouter un flux</button>
<button class="action-btn btn-secondary" id="fetchRssBtn">🔄 Récupérer les articles</button>
</div>
<div class="rss-feeds-list" id="rssFeedsList">
<!-- Feeds will be inserted here -->
</div>
</div>
<!-- Onglet OpenRouter -->
<div class="admin-tab-content" id="tab-openrouter" style="display: none;">
<div class="openrouter-settings">
<div class="setting-group">
<label for="openrouterApiKey">Clé API OpenRouter</label>
<input type="password" id="openrouterApiKey" class="setting-input" placeholder="sk-or-...">
<small>Obtenez votre clé sur <a href="https://openrouter.ai" target="_blank">openrouter.ai</a></small>
</div>
<div class="setting-group">
<label for="openrouterModel">Modèle</label>
<input type="text" id="modelSearch" class="setting-input" placeholder="Rechercher un modèle...">
<select id="openrouterModel" class="setting-select" size="8">
<!-- Models will be inserted here -->
</select>
</div>
<div class="setting-group">
<label for="rssSummaryEnabled">
<input type="checkbox" id="rssSummaryEnabled">
Activer les résumés automatiques
</label>
</div>
<div class="setting-group">
<label for="rssSummaryPrompt">Prompt de résumé</label>
<textarea id="rssSummaryPrompt" class="setting-textarea" rows="10" placeholder="Le prompt sera chargé..."></textarea>
</div>
<button class="action-btn" id="saveOpenRouterSettings">💾 Sauvegarder les paramètres</button>
</div>
</div>
</div>
</div>
<!-- Modal Change Password -->
<div class="modal-backdrop" id="changePasswordModal" style="display: none;">
<div class="modal-content small-modal">
<div class="modal-header">
<h3>Changer le mot de passe</h3>
<button class="modal-close" id="closeChangePasswordModal">✕</button>
</div>
<div class="modal-body">
<p id="changePasswordUsername"></p>
<div class="form-group">
<label for="newPassword">Nouveau mot de passe</label>
<input type="password" id="newPassword" class="form-input" placeholder="Minimum 6 caractères">
</div>
<div class="form-group">
<label for="confirmPassword">Confirmer le mot de passe</label>
<input type="password" id="confirmPassword" class="form-input">
</div>
<div class="modal-actions">
<button class="btn-cancel" id="cancelChangePassword">Annuler</button>
<button class="btn-confirm" id="confirmChangePassword">Changer</button>
</div>
</div>
</div>
</div>
<!-- Modal de Confirmation -->
<div class="modal-backdrop" id="confirmModal" style="display: none;">
<div class="modal-content confirm-modal">
<div class="confirm-icon" id="confirmIcon">⚠️</div>
<h3 class="confirm-title" id="confirmTitle">Confirmer l'action</h3>
<p class="confirm-message" id="confirmMessage">Êtes-vous sûr de vouloir continuer ?</p>
<div class="confirm-actions">
<button class="btn-cancel" id="confirmCancel">Annuler</button>
<button class="btn-confirm" id="confirmOk">Confirmer</button>
</div>
</div>
</div>
<!-- Hidden file input -->
<input type="file" id="imageInput" accept="image/*" style="display: none;">
<input type="file" id="fileInput" style="display: none;">
<!-- Refresh indicator -->
<div class="refresh-indicator" id="refreshIndicator">
<div class="loading-spinner"></div>
<span>Mise à jour...</span>
</div>
<!-- Conteneur de notifications -->
<div class="notifications-container" id="notificationsContainer"></div>
<!-- Modal pour agrandir les images -->
<div class="image-modal" id="imageModal">
<div class="image-modal-content">
<img src="" alt="" class="image-modal-img" id="imageModalImg">
</div>
<button class="image-modal-close" id="imageModalClose">
<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>
<!-- JavaScript -->
<script src="/js/complete-app.js"></script>
</body>
</html>
-169
View File
@@ -1,169 +0,0 @@
class AdminService {
constructor() {
// Check if auth exists and user is admin
if (!window.auth || !window.auth.user || !window.auth.user.is_admin) return;
this.adminPanel = document.getElementById('admin-panel');
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();
}
}
setupEventListeners() {
if (this.closeAdminBtn) {
this.closeAdminBtn.addEventListener('click', () => this.closePanel());
}
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() {
if (!window.auth || !window.auth.getHeaders) return;
try {
const response = await fetch('/api/users', {
headers: window.auth.getHeaders()
});
const users = await response.json();
this.renderUsersList(users);
} catch (error) {
console.error('Error loading users:', error);
}
}
renderUsersList(users) {
if (!this.usersList || !Array.isArray(users)) return;
this.usersList.innerHTML = '';
users.forEach(user => {
if (!user || typeof user !== 'object') return;
const userElement = document.createElement('div');
userElement.className = 'user-item';
userElement.innerHTML = `
<div>
<span class="font-medium">${user.username || 'Utilisateur'}</span>
${user.is_admin ? '<span class="ml-2 text-sm text-blue-600">Admin</span>' : ''}
</div>
<div class="actions">
${user.id !== 1 ? `
<button class="text-gray-600 hover:text-blue-600" onclick="if(window.admin && typeof window.admin.changePassword === 'function') window.admin.changePassword(${user.id})">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4"></path></svg>
</button>
<button class="text-gray-600 hover:text-blue-600" onclick="if(window.admin && typeof window.admin.toggleAdmin === 'function') window.admin.toggleAdmin(${user.id}, ${user.is_admin ? 'true' : 'false'})">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"></path></svg>
</button>
<button class="text-gray-600 hover:text-red-600" onclick="if(window.admin && typeof window.admin.deleteUser === 'function') window.admin.deleteUser(${user.id})">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path><line x1="10" y1="11" x2="10" y2="17"></line><line x1="14" y1="11" x2="14" y2="17"></line></svg>
</button>
` : ''}
</div>
`;
this.usersList.appendChild(userElement);
});
}
showAddUserForm() {
const username = prompt('Nom d\'utilisateur:');
if (!username) return;
const password = prompt('Mot de passe:');
if (!password) return;
const isAdmin = confirm('Donner les droits administrateur ?');
this.createUser(username, password, isAdmin);
}
async createUser(username, password, isAdmin) {
if (!window.auth || !window.auth.getHeaders) return;
try {
const response = await fetch('/api/users', {
method: 'POST',
headers: window.auth.getHeaders(),
body: JSON.stringify({ username, password, is_admin: isAdmin })
});
if (!response.ok) {
const error = await response.json();
throw new Error(error.message || 'Erreur lors de la création de l\'utilisateur');
}
this.loadUsers();
} catch (error) {
alert(error.message || 'Erreur lors de la création de l\'utilisateur');
}
}
async changePassword(userId) {
if (!window.auth || !window.auth.getHeaders) return;
const password = prompt('Nouveau mot de passe:');
if (!password) return;
try {
await fetch(`/api/users/${userId}`, {
method: 'PUT',
headers: window.auth.getHeaders(),
body: JSON.stringify({ password })
});
alert('Mot de passe modifié');
} catch (error) {
console.error('Error changing password:', error);
}
}
async toggleAdmin(userId, currentStatus) {
if (!window.auth || !window.auth.getHeaders) return;
try {
await fetch(`/api/users/${userId}`, {
method: 'PUT',
headers: window.auth.getHeaders(),
body: JSON.stringify({ is_admin: !currentStatus })
});
this.loadUsers();
} catch (error) {
console.error('Error toggling admin status:', error);
}
}
async deleteUser(userId) {
if (!window.auth || !window.auth.getHeaders) return;
if (!confirm('Êtes-vous sûr de vouloir supprimer cet utilisateur ?')) return;
try {
await fetch(`/api/users/${userId}`, {
method: 'DELETE',
headers: window.auth.getHeaders()
});
this.loadUsers();
} catch (error) {
console.error('Error deleting user:', error);
}
}
closePanel() {
if (this.adminPanel) {
this.adminPanel.classList.add('hidden');
}
}
}
// Initialize admin service
window.admin = new AdminService();
-31
View File
@@ -1,31 +0,0 @@
class App {
constructor() {
// Initialize app components
this.auth = window.auth;
this.notes = window.notes;
this.admin = window.admin;
}
init() {
// Load initial data if authenticated
if (this.auth && this.auth.token) {
if (this.notes && typeof this.notes.loadNotes === 'function') {
this.notes.loadNotes();
}
if (this.auth.user && this.auth.user.is_admin && this.admin && typeof this.admin.loadUsers === 'function') {
this.admin.loadUsers();
}
}
}
}
// Initialize main app
window.app = new App();
// Initialize app when DOM is loaded
document.addEventListener('DOMContentLoaded', () => {
if (window.app && typeof window.app.init === 'function') {
window.app.init();
}
});
-106
View File
@@ -1,106 +0,0 @@
class AuthService {
constructor() {
this.token = localStorage.getItem('token');
this.user = JSON.parse(localStorage.getItem('user') || 'null');
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();
}
setupEventListeners() {
if (this.loginForm) {
this.loginForm.addEventListener('submit', (e) => this.handleLogin(e));
}
if (this.logoutBtn) {
this.logoutBtn.addEventListener('click', () => this.handleLogout());
}
}
async handleLogin(e) {
e.preventDefault();
const username = document.getElementById('username').value;
const password = document.getElementById('password').value;
try {
const response = await fetch('/api/auth/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ username, password })
});
const data = await response.json();
if (!response.ok) {
throw new Error(data.message || 'Erreur de connexion');
}
this.token = data.token;
this.user = data.user;
localStorage.setItem('token', this.token);
localStorage.setItem('user', JSON.stringify(this.user));
this.updateUI();
if (window.app && typeof window.app.init === 'function') {
window.app.init(); // Initialize main app after login
}
} catch (error) {
alert(error.message);
}
}
handleLogout() {
localStorage.removeItem('token');
localStorage.removeItem('user');
this.token = null;
this.user = null;
this.updateUI();
window.location.reload();
}
updateUI() {
const authContainer = document.getElementById('auth-container');
const appContainer = document.getElementById('app-container');
// 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');
if (appContainer) appContainer.classList.remove('hidden');
if (this.userInfo) this.userInfo.textContent = this.user.username;
// Show admin panel button if user is admin
if (this.user.is_admin) {
const adminBtnExists = document.querySelector('.admin-btn');
if (!adminBtnExists && this.userInfo && this.userInfo.parentNode) {
const adminBtn = document.createElement('button');
adminBtn.className = 'admin-btn ml-4 text-sm text-gray-600 hover:text-gray-900';
adminBtn.textContent = 'Admin';
adminBtn.onclick = () => {
if (this.adminPanel) this.adminPanel.classList.remove('hidden');
};
this.userInfo.parentNode.insertBefore(adminBtn, this.logoutBtn);
}
}
} else {
if (authContainer) authContainer.classList.remove('hidden');
if (appContainer) appContainer.classList.add('hidden');
}
}
getHeaders() {
return {
'Authorization': `Bearer ${this.token || ''}`,
'Content-Type': 'application/json'
};
}
}
// Initialize auth service
window.auth = new AuthService();
File diff suppressed because it is too large. Load diff
-1
View File
@@ -1 +0,0 @@
// Fichier vide pour éviter les erreurs - les icônes sont maintenant directement intégrées en SVG
-364
View File
@@ -1,364 +0,0 @@
class NotesService {
constructor() {
this.currentNote = null;
this.notes = [];
// DOM Elements
this.notesList = document.getElementById('notes-list');
this.noteEditor = document.getElementById('note-editor');
this.noteTitle = document.getElementById('note-title');
this.noteContent = document.getElementById('note-content');
this.todosList = document.getElementById('todos-list');
this.imagesList = document.getElementById('images-list');
this.searchInput = document.getElementById('search-notes');
this.newNoteBtn = document.getElementById('new-note-btn');
this.archiveNoteBtn = document.getElementById('archive-note-btn');
this.deleteNoteBtn = document.getElementById('delete-note-btn');
this.addTodoBtn = document.getElementById('add-todo-btn');
this.imageUpload = document.getElementById('image-upload');
this.setupEventListeners();
}
setupEventListeners() {
if (this.newNoteBtn) {
this.newNoteBtn.addEventListener('click', () => this.createNewNote());
}
if (this.archiveNoteBtn) {
this.archiveNoteBtn.addEventListener('click', () => this.toggleArchiveNote());
}
if (this.deleteNoteBtn) {
this.deleteNoteBtn.addEventListener('click', () => this.deleteNote());
}
if (this.addTodoBtn) {
this.addTodoBtn.addEventListener('click', () => this.addTodo());
}
if (this.imageUpload) {
this.imageUpload.addEventListener('change', (e) => this.handleImageUpload(e));
}
if (this.searchInput) {
this.searchInput.addEventListener('input', (e) => this.handleSearch(e));
}
// Auto-save on content changes
if (this.noteTitle) {
this.noteTitle.addEventListener('input', () => this.autoSave());
}
if (this.noteContent) {
this.noteContent.addEventListener('input', () => this.autoSave());
}
}
async loadNotes() {
if (!window.auth || !window.auth.token) {
console.log('Not authenticated, skipping notes loading');
return;
}
try {
const response = await fetch('/api/notes', {
headers: window.auth.getHeaders()
});
if (!response.ok) {
throw new Error(`Failed to load notes: ${response.status}`);
}
this.notes = await response.json();
this.renderNotesList();
} catch (error) {
console.error('Error loading notes:', error);
}
}
renderNotesList(searchTerm = '') {
if (!this.notesList) return;
this.notesList.innerHTML = '';
if (!this.notes || !this.notes.length) {
this.notesList.innerHTML = '<div class="p-2 text-gray-500">Aucune note</div>';
return;
}
const filteredNotes = searchTerm
? this.notes.filter(note =>
(note.title && note.title.toLowerCase().includes(searchTerm.toLowerCase())) ||
(note.content && note.content.toLowerCase().includes(searchTerm.toLowerCase()))
)
: this.notes;
filteredNotes.forEach(note => {
if (!note) return;
const noteElement = document.createElement('div');
noteElement.className = `note-item ${note.id === (this.currentNote && this.currentNote.id) ? 'active' : ''}`;
noteElement.innerHTML = `
<h3 class="font-medium">${note.title || 'Sans titre'}</h3>
<p class="text-sm text-gray-500 truncate">${note.content || ''}</p>
`;
noteElement.addEventListener('click', () => this.selectNote(note));
this.notesList.appendChild(noteElement);
});
}
selectNote(note) {
if (!note) return;
this.currentNote = note;
if (this.noteTitle) this.noteTitle.value = note.title || '';
if (this.noteContent) this.noteContent.innerHTML = note.content || '';
this.renderTodos();
this.renderImages();
this.renderNotesList(); // Update active state
}
renderTodos() {
if (!this.todosList || !this.currentNote) return;
const todos = this.currentNote.todos || [];
this.todosList.innerHTML = '';
todos.forEach((todo, index) => {
if (!todo) return;
const todoElement = document.createElement('div');
todoElement.className = `todo-item ${todo.completed ? 'completed' : ''}`;
todoElement.innerHTML = `
<input type="checkbox" ${todo.completed ? 'checked' : ''}>
<span>${todo.text || ''}</span>
<button class="ml-auto text-gray-400 hover:text-red-500">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>
</button>
`;
const checkbox = todoElement.querySelector('input');
if (checkbox) {
checkbox.addEventListener('change', () => this.toggleTodo(index));
}
const deleteBtn = todoElement.querySelector('button');
if (deleteBtn) {
deleteBtn.addEventListener('click', () => this.deleteTodo(index));
}
this.todosList.appendChild(todoElement);
});
}
renderImages() {
if (!this.imagesList || !this.currentNote) return;
const images = this.currentNote.images || [];
this.imagesList.innerHTML = '';
images.forEach((image, index) => {
if (!image || !image.filename) return;
const imageElement = document.createElement('div');
imageElement.className = 'image-thumbnail';
imageElement.innerHTML = `
<img src="/uploads/${image.filename}" alt="Note image">
<button class="delete-btn">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>
</button>
`;
const deleteBtn = imageElement.querySelector('button');
if (deleteBtn) {
deleteBtn.addEventListener('click', () => this.deleteImage(image.id));
}
this.imagesList.appendChild(imageElement);
});
}
async createNewNote() {
if (!window.auth || !window.auth.getHeaders) return;
try {
const response = await fetch('/api/notes', {
method: 'POST',
headers: window.auth.getHeaders(),
body: JSON.stringify({
title: 'Nouvelle note',
content: '',
todos: []
})
});
const newNote = await response.json();
if (newNote) {
this.notes.unshift(newNote);
this.renderNotesList();
this.selectNote(newNote);
}
} catch (error) {
console.error('Error creating note:', error);
}
}
async autoSave() {
if (!this.currentNote || !window.auth || !window.auth.getHeaders) return;
clearTimeout(this.saveTimeout);
this.saveTimeout = setTimeout(async () => {
try {
if (!this.noteTitle || !this.noteContent) return;
await fetch(`/api/notes/${this.currentNote.id}`, {
method: 'PUT',
headers: window.auth.getHeaders(),
body: JSON.stringify({
title: this.noteTitle.value || '',
content: this.noteContent.innerHTML || '',
todos: this.currentNote.todos || []
})
});
// Update local note
this.currentNote.title = this.noteTitle.value || '';
this.currentNote.content = this.noteContent.innerHTML || '';
this.renderNotesList();
} catch (error) {
console.error('Error saving note:', error);
}
}, 1000);
}
async toggleArchiveNote() {
if (!this.currentNote || !window.auth || !window.auth.getHeaders) return;
try {
await fetch(`/api/notes/${this.currentNote.id}`, {
method: 'PUT',
headers: window.auth.getHeaders(),
body: JSON.stringify({
...this.currentNote,
archived: !this.currentNote.archived
})
});
this.currentNote.archived = !this.currentNote.archived;
this.renderNotesList();
} catch (error) {
console.error('Error archiving note:', error);
}
}
async deleteNote() {
if (!this.currentNote || !window.auth || !window.auth.getHeaders) return;
if (!confirm('Êtes-vous sûr de vouloir supprimer cette note ?')) return;
try {
await fetch(`/api/notes/${this.currentNote.id}`, {
method: 'DELETE',
headers: window.auth.getHeaders()
});
const index = this.notes.findIndex(n => n.id === this.currentNote.id);
if (index !== -1) {
this.notes.splice(index, 1);
}
this.currentNote = null;
this.renderNotesList();
if (this.noteTitle) this.noteTitle.value = '';
if (this.noteContent) this.noteContent.innerHTML = '';
if (this.todosList) this.todosList.innerHTML = '';
if (this.imagesList) this.imagesList.innerHTML = '';
} catch (error) {
console.error('Error deleting note:', error);
}
}
async addTodo() {
if (!this.currentNote) return;
const text = prompt('Nouveau todo:');
if (!text) return;
if (!this.currentNote.todos) {
this.currentNote.todos = [];
}
this.currentNote.todos.push({ text, completed: false });
this.renderTodos();
this.autoSave();
}
async toggleTodo(index) {
if (!this.currentNote || !this.currentNote.todos) return;
if (index < 0 || index >= this.currentNote.todos.length) return;
this.currentNote.todos[index].completed = !this.currentNote.todos[index].completed;
this.renderTodos();
this.autoSave();
}
async deleteTodo(index) {
if (!this.currentNote || !this.currentNote.todos) return;
if (index < 0 || index >= this.currentNote.todos.length) return;
this.currentNote.todos.splice(index, 1);
this.renderTodos();
this.autoSave();
}
async handleImageUpload(event) {
if (!this.currentNote || !event.target || !event.target.files || !event.target.files.length) return;
if (!window.auth || !window.auth.getHeaders) return;
const formData = new FormData();
formData.append('image', event.target.files[0]);
try {
const response = await fetch(`/api/notes/${this.currentNote.id}/images`, {
method: 'POST',
headers: { 'Authorization': window.auth.getHeaders().Authorization },
body: formData
});
const image = await response.json();
if (!this.currentNote.images) {
this.currentNote.images = [];
}
this.currentNote.images.push(image);
this.renderImages();
} catch (error) {
console.error('Error uploading image:', error);
}
if (event.target) {
event.target.value = ''; // Reset input
}
}
async deleteImage(imageId) {
if (!this.currentNote || !this.currentNote.images) return;
if (!window.auth || !window.auth.getHeaders) return;
if (!confirm('Supprimer cette image ?')) return;
try {
await fetch(`/api/notes/${this.currentNote.id}/images/${imageId}`, {
method: 'DELETE',
headers: window.auth.getHeaders()
});
const index = this.currentNote.images.findIndex(img => img.id === imageId);
if (index !== -1) {
this.currentNote.images.splice(index, 1);
}
this.renderImages();
} catch (error) {
console.error('Error deleting image:', error);
}
}
handleSearch(event) {
if (!event || !event.target) return;
this.renderNotesList(event.target.value || '');
}
}
// Initialize notes service
window.notes = new NotesService();
-222
View File
@@ -1,222 +0,0 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Connexion - NoteFlow</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
color: #1F2937;
}
.login-container {
background: white;
padding: 48px;
border-radius: 16px;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
width: 100%;
max-width: 400px;
animation: slideIn 0.4s ease-out;
}
@keyframes slideIn {
from {
opacity: 0;
transform: translateY(-20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.login-logo {
text-align: center;
margin-bottom: 32px;
}
.login-logo h1 {
font-size: 32px;
font-weight: bold;
color: #667eea;
}
.login-logo p {
color: #6B7280;
margin-top: 8px;
}
.form-group {
margin-bottom: 20px;
}
.form-group label {
display: block;
margin-bottom: 8px;
font-weight: 500;
color: #374151;
}
.form-group input {
width: 100%;
padding: 12px 16px;
border: 2px solid #E5E7EB;
border-radius: 8px;
font-size: 16px;
transition: border-color 0.2s;
}
.form-group input:focus {
outline: none;
border-color: #667eea;
}
.error-message {
background: #FEE2E2;
color: #991B1B;
padding: 12px 16px;
border-radius: 8px;
margin-bottom: 20px;
display: none;
}
.error-message.show {
display: block;
}
.login-btn {
width: 100%;
padding: 14px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border: none;
border-radius: 8px;
font-size: 16px;
font-weight: 600;
cursor: pointer;
transition: transform 0.2s, box-shadow 0.2s;
}
.login-btn:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}
.login-btn:active {
transform: translateY(0);
}
.login-btn:disabled {
opacity: 0.6;
cursor: not-allowed;
transform: none;
}
.default-credentials {
margin-top: 24px;
padding: 16px;
background: #F3F4F6;
border-radius: 8px;
font-size: 14px;
color: #6B7280;
}
.default-credentials strong {
color: #374151;
}
</style>
</head>
<body>
<div class="login-container">
<div class="login-logo">
<h1>📝 NoteFlow</h1>
<p>Gérez vos notes et tâches efficacement</p>
</div>
<div id="errorMessage" class="error-message"></div>
<form id="loginForm">
<div class="form-group">
<label for="username">Nom d'utilisateur</label>
<input type="text" id="username" name="username" required autocomplete="username">
</div>
<div class="form-group">
<label for="password">Mot de passe</label>
<input type="password" id="password" name="password" required autocomplete="current-password">
</div>
<button type="submit" class="login-btn" id="loginBtn">Se connecter</button>
</form>
<div class="default-credentials">
<strong>Identifiants par défaut:</strong><br>
Username: admin<br>
Password: admin
</div>
</div>
<script>
// Rediriger si déjà connecté
const token = localStorage.getItem('token');
if (token) {
window.location.href = '/';
}
const loginForm = document.getElementById('loginForm');
const errorMessage = document.getElementById('errorMessage');
const loginBtn = document.getElementById('loginBtn');
loginForm.addEventListener('submit', async (e) => {
e.preventDefault();
const username = document.getElementById('username').value;
const password = document.getElementById('password').value;
errorMessage.classList.remove('show');
loginBtn.disabled = true;
loginBtn.textContent = 'Connexion...';
try {
const response = await fetch('/api/auth/login', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ username, password })
});
const data = await response.json();
if (response.ok) {
localStorage.setItem('token', data.token);
localStorage.setItem('user', JSON.stringify(data.user));
window.location.href = '/';
} else {
errorMessage.textContent = data.error || 'Identifiants invalides';
errorMessage.classList.add('show');
}
} catch (error) {
errorMessage.textContent = 'Erreur de connexion au serveur';
errorMessage.classList.add('show');
} finally {
loginBtn.disabled = false;
loginBtn.textContent = 'Se connecter';
}
});
</script>
</body>
</html>