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

+4 -1
View File
@@ -34,7 +34,10 @@ Application web moderne de gestion de notes et de tâches, Dockerisée, avec aut
- **Backend** : Node.js 20 + Express
- **Base de données** : SQLite3
- **Authentification** : JWT + bcrypt
- **Frontend** : HTML5/CSS3/JavaScript vanilla
- **Frontend** : React 19 + TypeScript + Vite
- **UI Components** : shadcn/ui + Tailwind CSS
- **Routing** : React Router v7
- **State Management** : TanStack Query (React Query)
- **Sécurité** : Helmet.js, rate limiting, validation des entrées
- **Logging** : Winston
- **Upload** : Multer
-24
View File
@@ -1,24 +0,0 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
-73
View File
@@ -1,73 +0,0 @@
# React + TypeScript + Vite
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
## React Compiler
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
## Expanding the ESLint configuration
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
```js
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Remove tseslint.configs.recommended and replace with this
tseslint.configs.recommendedTypeChecked,
// Alternatively, use this for stricter rules
tseslint.configs.strictTypeChecked,
// Optionally, add this for stylistic rules
tseslint.configs.stylisticTypeChecked,
// Other configs...
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])
```
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
```js
// eslint.config.js
import reactX from 'eslint-plugin-react-x'
import reactDom from 'eslint-plugin-react-dom'
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Enable lint rules for React
reactX.configs['recommended-typescript'],
// Enable lint rules for React DOM
reactDom.configs.recommended,
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])
```
-23
View File
@@ -1,23 +0,0 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'
import { defineConfig, globalIgnores } from 'eslint/config'
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
js.configs.recommended,
tseslint.configs.recommended,
reactHooks.configs['recommended-latest'],
reactRefresh.configs.vite,
],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
},
])
-13
View File
@@ -1,13 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>client</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
-3759
View File
File diff suppressed because it is too large. Load diff
-32
View File
@@ -1,32 +0,0 @@
{
"name": "client",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"lint": "eslint .",
"preview": "vite preview"
},
"dependencies": {
"axios": "^1.13.2",
"react": "^19.2.0",
"react-dom": "^19.2.0",
"react-router-dom": "^7.9.5"
},
"devDependencies": {
"@eslint/js": "^9.39.1",
"@types/node": "^24.10.0",
"@types/react": "^19.2.2",
"@types/react-dom": "^19.2.2",
"@vitejs/plugin-react": "^5.1.0",
"eslint": "^9.39.1",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.4.24",
"globals": "^16.5.0",
"typescript": "~5.9.3",
"typescript-eslint": "^8.46.3",
"vite": "^7.2.2"
}
}
-1
View File
@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>

Before

Width:  |  Height:  |  Size: 1.5 KiB

-42
View File
@@ -1,42 +0,0 @@
#root {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
text-align: center;
}
.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
transition: filter 300ms;
}
.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.react:hover {
filter: drop-shadow(0 0 2em #61dafbaa);
}
@keyframes logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
@media (prefers-reduced-motion: no-preference) {
a:nth-of-type(2) .logo {
animation: logo-spin infinite 20s linear;
}
}
.card {
padding: 2em;
}
.read-the-docs {
color: #888;
}
-62
View File
@@ -1,62 +0,0 @@
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
import { AuthProvider, useAuth } from './contexts/AuthContext';
import Login from './pages/Login';
import Dashboard from './pages/Dashboard';
// Protected Route Component
function ProtectedRoute({ children }: { children: React.ReactNode }) {
const { isAuthenticated } = useAuth();
if (!isAuthenticated) {
return <Navigate to="/login" replace />;
}
return <>{children}</>;
}
// Public Route Component (redirect if already logged in)
function PublicRoute({ children }: { children: React.ReactNode }) {
const { isAuthenticated } = useAuth();
if (isAuthenticated) {
return <Navigate to="/" replace />;
}
return <>{children}</>;
}
function AppRoutes() {
return (
<Routes>
<Route
path="/login"
element={
<PublicRoute>
<Login />
</PublicRoute>
}
/>
<Route
path="/"
element={
<ProtectedRoute>
<Dashboard />
</ProtectedRoute>
}
/>
<Route path="*" element={<Navigate to="/" replace />} />
</Routes>
);
}
function App() {
return (
<BrowserRouter>
<AuthProvider>
<AppRoutes />
</AuthProvider>
</BrowserRouter>
);
}
export default App;
-1
View File
@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>

Before

Width:  |  Height:  |  Size: 4.0 KiB

-66
View File
@@ -1,66 +0,0 @@
import { createContext, useContext, useState, useEffect, ReactNode } from 'react';
import { authApi } from '../services/api';
import type { User, AuthContextType } from '../types';
const AuthContext = createContext<AuthContextType | null>(null);
export const AuthProvider = ({ children }: { children: ReactNode }) => {
const [user, setUser] = useState<User | null>(null);
const [token, setToken] = useState<string | null>(null);
const [loading, setLoading] = useState(true);
useEffect(() => {
// Récupérer le token et user du localStorage au démarrage
const storedToken = localStorage.getItem('token');
const storedUser = localStorage.getItem('user');
if (storedToken && storedUser) {
setToken(storedToken);
setUser(JSON.parse(storedUser));
}
setLoading(false);
}, []);
const login = async (username: string, password: string) => {
const data = await authApi.login(username, password);
setToken(data.token);
setUser(data.user);
localStorage.setItem('token', data.token);
localStorage.setItem('user', JSON.stringify(data.user));
};
const logout = () => {
setToken(null);
setUser(null);
localStorage.removeItem('token');
localStorage.removeItem('user');
authApi.logout().catch(() => {});
};
const value: AuthContextType = {
user,
token,
login,
logout,
isAuthenticated: !!token,
};
if (loading) {
return <div className="loading">Chargement...</div>;
}
return <AuthContext.Provider value={value}>{children}</AuthContext.Provider>;
};
export const useAuth = () => {
const context = useContext(AuthContext);
if (!context) {
throw new Error('useAuth must be used within AuthProvider');
}
return context;
};
-37
View File
@@ -1,37 +0,0 @@
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
color: #1a202c;
background: #f7fafc;
}
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}
:root {
--color-primary: #667eea;
--color-secondary: #764ba2;
--color-text: #1a202c;
--color-text-light: #718096;
--color-border: #e2e8f0;
--color-bg: #f7fafc;
--color-card: #ffffff;
--shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}
#root {
min-height: 100vh;
}
-10
View File
@@ -1,10 +0,0 @@
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import './index.css'
import App from './App.tsx'
createRoot(document.getElementById('root')!).render(
<StrictMode>
<App />
</StrictMode>,
)
-303
View File
@@ -1,303 +0,0 @@
.dashboard {
min-height: 100vh;
background: #f7fafc;
}
.dashboard-header {
background: white;
border-bottom: 1px solid #e2e8f0;
padding: 16px 24px;
display: flex;
justify-content: space-between;
align-items: center;
position: sticky;
top: 0;
z-index: 100;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.header-left h1 {
margin: 0;
font-size: 24px;
color: #1a202c;
}
.header-right {
display: flex;
align-items: center;
gap: 16px;
}
.user-name {
color: #4a5568;
font-weight: 500;
}
.btn-logout {
padding: 8px 16px;
background: #e2e8f0;
border: none;
border-radius: 6px;
cursor: pointer;
transition: background 0.2s;
}
.btn-logout:hover {
background: #cbd5e0;
}
.dashboard-main {
padding: 24px;
max-width: 1800px;
margin: 0 auto;
}
.content-grid {
display: grid;
grid-template-columns: 1fr 320px 320px;
gap: 24px;
align-items: start;
}
.section-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.section-header h2 {
margin: 0;
font-size: 20px;
font-weight: 600;
color: #1a202c;
}
.btn-primary {
padding: 8px 16px;
background: #667eea;
color: white;
border: none;
border-radius: 6px;
cursor: pointer;
font-weight: 500;
transition: all 0.2s;
}
.btn-primary:hover {
background: #5a67d8;
transform: translateY(-1px);
}
/* Notes Section */
.notes-section {
background: transparent;
}
.notes-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
gap: 16px;
}
.note-card {
background: white;
padding: 20px;
border-radius: 12px;
border: 1px solid #e2e8f0;
cursor: pointer;
transition: all 0.2s;
}
.note-card:hover {
border-color: #667eea;
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
transform: translateY(-2px);
}
.note-card h3 {
margin: 0 0 12px 0;
font-size: 16px;
font-weight: 600;
color: #1a202c;
}
.note-card p {
margin: 0;
color: #718096;
font-size: 14px;
line-height: 1.5;
}
.note-todos-preview {
margin-top: 12px;
padding-top: 12px;
border-top: 1px solid #e2e8f0;
font-size: 13px;
color: #667eea;
font-weight: 500;
}
/* Todos Sidebar */
.todos-sidebar,
.rss-sidebar {
background: white;
border-radius: 12px;
border: 1px solid #e2e8f0;
padding: 20px;
position: sticky;
top: 88px;
max-height: calc(100vh - 112px);
overflow-y: auto;
}
.todo-input-container {
margin-bottom: 16px;
}
.todo-input-container input {
width: 100%;
padding: 10px 12px;
border: 2px solid #e2e8f0;
border-radius: 8px;
font-size: 14px;
transition: border-color 0.2s;
}
.todo-input-container input:focus {
outline: none;
border-color: #667eea;
}
.todos-list {
display: flex;
flex-direction: column;
gap: 8px;
}
.todo-item {
display: flex;
align-items: center;
gap: 10px;
padding: 10px;
background: #f7fafc;
border-radius: 6px;
transition: background 0.2s;
}
.todo-item:hover {
background: #edf2f7;
}
.todo-item input[type="checkbox"] {
cursor: pointer;
}
.todo-item span {
flex: 1;
font-size: 14px;
color: #2d3748;
}
.todo-item span.completed {
text-decoration: line-through;
color: #a0aec0;
}
.btn-delete {
padding: 4px 8px;
background: transparent;
border: none;
color: #cbd5e0;
cursor: pointer;
border-radius: 4px;
transition: all 0.2s;
}
.btn-delete:hover {
background: #fed7d7;
color: #c53030;
}
/* RSS Sidebar */
.rss-content {
display: flex;
flex-direction: column;
gap: 12px;
}
.rss-article,
.rss-summary {
padding: 12px;
background: #f7fafc;
border-radius: 8px;
cursor: pointer;
transition: all 0.2s;
border: 1px solid transparent;
}
.rss-article:hover {
background: #edf2f7;
border-color: #667eea;
}
.rss-article h4,
.rss-summary h4 {
margin: 0 0 8px 0;
font-size: 14px;
font-weight: 600;
color: #1a202c;
line-height: 1.4;
}
.rss-article p,
.rss-summary p {
margin: 8px 0 0 0;
font-size: 13px;
color: #718096;
line-height: 1.5;
}
.article-meta,
.summary-meta {
display: flex;
justify-content: space-between;
font-size: 12px;
color: #a0aec0;
margin-top: 8px;
}
.empty-state {
text-align: center;
color: #a0aec0;
font-size: 14px;
padding: 40px 20px;
}
.loading {
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
font-size: 18px;
color: #667eea;
}
/* Responsive */
@media (max-width: 1400px) {
.content-grid {
grid-template-columns: 1fr 280px 280px;
}
}
@media (max-width: 1200px) {
.content-grid {
grid-template-columns: 1fr;
}
.todos-sidebar,
.rss-sidebar {
position: static;
max-height: none;
}
}
-215
View File
@@ -1,215 +0,0 @@
import { useState, useEffect } from 'react';
import { useAuth } from '../contexts/AuthContext';
import { notesApi, todosApi, rssApi, settingsApi } from '../services/api';
import type { Note, GlobalTodo, RssArticle, RssSummary } from '../types';
import './Dashboard.css';
export default function Dashboard() {
const { user, logout } = useAuth();
const [notes, setNotes] = useState<Note[]>([]);
const [todos, setTodos] = useState<GlobalTodo[]>([]);
const [rssContent, setRssContent] = useState<RssArticle[] | RssSummary[]>([]);
const [showSummaries, setShowSummaries] = useState(false);
const [loading, setLoading] = useState(true);
const [lastUpdate, setLastUpdate] = useState<Date>(new Date());
useEffect(() => {
loadData();
// Auto-refresh toutes les 30 secondes pour afficher les nouveaux articles RSS
const interval = setInterval(() => {
loadRssData();
}, 30000); // 30 secondes
return () => clearInterval(interval);
}, []);
const loadData = async () => {
try {
const [notesData, todosData] = await Promise.all([
notesApi.getAll(false),
todosApi.getAll(),
]);
setNotes(notesData);
setTodos(todosData);
await loadRssData();
} catch (error) {
console.error('Erreur chargement données:', error);
} finally {
setLoading(false);
}
};
const loadRssData = async () => {
try {
const settings = await settingsApi.getAll();
const summaryEnabled = settings.rss_summary_enabled === '1';
setShowSummaries(summaryEnabled);
if (summaryEnabled) {
const summaries = await rssApi.getSummaries();
setRssContent(summaries);
} else {
const articles = await rssApi.getArticles();
setRssContent(articles);
}
setLastUpdate(new Date());
} catch (error) {
console.error('Erreur chargement RSS:', error);
}
};
const addTodo = async (text: string) => {
if (!text.trim()) return;
try {
const newTodo = await todosApi.create(text);
setTodos([...todos, newTodo]);
} catch (error) {
console.error('Erreur ajout todo:', error);
}
};
const toggleTodo = async (id: number, completed: boolean) => {
try {
await todosApi.update(id, completed);
setTodos(todos.map(t => t.id === id ? { ...t, completed } : t));
} catch (error) {
console.error('Erreur toggle todo:', error);
}
};
const deleteTodo = async (id: number) => {
if (!window.confirm('Supprimer cette tâche ?')) return;
try {
await todosApi.delete(id);
setTodos(todos.filter(t => t.id !== id));
} catch (error) {
console.error('Erreur suppression todo:', error);
}
};
if (loading) {
return <div className="loading">Chargement...</div>;
}
return (
<div className="dashboard">
{/* Header */}
<header className="dashboard-header">
<div className="header-left">
<h1>📝 NoteFlow</h1>
</div>
<div className="header-right">
<span className="user-name">{user?.username}</span>
<button onClick={logout} className="btn-logout">
Déconnexion
</button>
</div>
</header>
{/* Main Content */}
<main className="dashboard-main">
<div className="content-grid">
{/* Notes Section */}
<section className="notes-section">
<div className="section-header">
<h2>Notes</h2>
<button className="btn-primary">+ Nouvelle note</button>
</div>
<div className="notes-grid">
{notes.length === 0 ? (
<p className="empty-state">Aucune note</p>
) : (
notes.map(note => (
<div key={note.id} className="note-card">
<h3>{note.title}</h3>
{note.content && <p>{note.content.substring(0, 150)}...</p>}
{note.todos && note.todos.length > 0 && (
<div className="note-todos-preview">
{note.todos_completed}/{note.todos_count} tâches
</div>
)}
</div>
))
)}
</div>
</section>
{/* Todos Sidebar */}
<aside className="todos-sidebar">
<div className="section-header">
<h2>✓ Todos</h2>
</div>
<div className="todo-input-container">
<input
type="text"
placeholder="Nouvelle tâche..."
onKeyPress={(e) => {
if (e.key === 'Enter') {
addTodo(e.currentTarget.value);
e.currentTarget.value = '';
}
}}
/>
</div>
<div className="todos-list">
{todos.map(todo => (
<div key={todo.id} className="todo-item">
<input
type="checkbox"
checked={todo.completed}
onChange={(e) => toggleTodo(todo.id, e.target.checked)}
/>
<span className={todo.completed ? 'completed' : ''}>{todo.text}</span>
<button onClick={() => deleteTodo(todo.id)} className="btn-delete">
✕
</button>
</div>
))}
</div>
</aside>
{/* RSS Sidebar */}
<aside className="rss-sidebar">
<div className="section-header">
<h2>📰 Actualités</h2>
</div>
<div className="rss-content">
{rssContent.length === 0 ? (
<p className="empty-state">Aucun contenu</p>
) : showSummaries ? (
// Afficher les résumés
(rssContent as RssSummary[]).map(summary => (
<div key={summary.id} className="rss-summary">
<h4>Résumé du {new Date(summary.created_at).toLocaleDateString('fr-FR')}</h4>
<p>{summary.summary.substring(0, 200)}...</p>
<div className="summary-meta">
{summary.articles_count} articles • {summary.model.split('/')[1] || summary.model}
</div>
</div>
))
) : (
// Afficher les articles
(rssContent as RssArticle[]).map(article => (
<div
key={article.id}
className="rss-article"
onClick={() => window.open(article.link, '_blank')}
>
<h4>{article.title}</h4>
<div className="article-meta">
<span>{article.feed_title}</span>
<span>{new Date(article.pub_date).toLocaleDateString('fr-FR')}</span>
</div>
{article.description && <p>{article.description.substring(0, 100)}...</p>}
</div>
))
)}
</div>
</aside>
</div>
</main>
</div>
);
}
-120
View File
@@ -1,120 +0,0 @@
.login-page {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
padding: 20px;
}
.login-container {
background: white;
border-radius: 16px;
padding: 40px;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
max-width: 420px;
width: 100%;
}
.login-header {
text-align: center;
margin-bottom: 32px;
}
.login-header h1 {
font-size: 32px;
margin: 0 0 8px 0;
color: #1a202c;
}
.login-header p {
margin: 0;
color: #718096;
font-size: 14px;
}
.login-form {
display: flex;
flex-direction: column;
gap: 20px;
}
.form-group {
display: flex;
flex-direction: column;
gap: 8px;
}
.form-group label {
font-size: 14px;
font-weight: 600;
color: #2d3748;
}
.form-group input {
padding: 12px 16px;
border: 2px solid #e2e8f0;
border-radius: 8px;
font-size: 15px;
transition: all 0.2s;
}
.form-group input:focus {
outline: none;
border-color: #667eea;
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
.form-group input:disabled {
opacity: 0.6;
cursor: not-allowed;
}
.error-message {
background: #fed7d7;
color: #c53030;
padding: 12px 16px;
border-radius: 8px;
font-size: 14px;
border: 1px solid #fc8181;
}
.btn-login {
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;
margin-top: 8px;
}
.btn-login:hover:not(:disabled) {
transform: translateY(-2px);
box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}
.btn-login:disabled {
opacity: 0.6;
cursor: not-allowed;
}
.login-footer {
text-align: center;
margin-top: 24px;
padding-top: 24px;
border-top: 1px solid #e2e8f0;
}
.login-footer p {
margin: 0;
font-size: 14px;
color: #718096;
}
.login-footer strong {
color: #2d3748;
}
-77
View File
@@ -1,77 +0,0 @@
import { useState, FormEvent } from 'react';
import { useNavigate } from 'react-router-dom';
import { useAuth } from '../contexts/AuthContext';
import './Login.css';
export default function Login() {
const [username, setUsername] = useState('');
const [password, setPassword] = useState('');
const [error, setError] = useState('');
const [loading, setLoading] = useState(false);
const { login } = useAuth();
const navigate = useNavigate();
const handleSubmit = async (e: FormEvent) => {
e.preventDefault();
setError('');
setLoading(true);
try {
await login(username, password);
navigate('/');
} catch (err: any) {
setError(err.response?.data?.error || 'Erreur de connexion');
} finally {
setLoading(false);
}
};
return (
<div className="login-page">
<div className="login-container">
<div className="login-header">
<h1>📝 NoteFlow</h1>
<p>Connectez-vous pour accéder à vos notes</p>
</div>
<form onSubmit={handleSubmit} className="login-form">
{error && <div className="error-message">{error}</div>}
<div className="form-group">
<label htmlFor="username">Nom d'utilisateur</label>
<input
type="text"
id="username"
value={username}
onChange={(e) => setUsername(e.target.value)}
required
autoFocus
disabled={loading}
/>
</div>
<div className="form-group">
<label htmlFor="password">Mot de passe</label>
<input
type="password"
id="password"
value={password}
onChange={(e) => setPassword(e.target.value)}
required
disabled={loading}
/>
</div>
<button type="submit" className="btn-login" disabled={loading}>
{loading ? 'Connexion...' : 'Se connecter'}
</button>
</form>
<div className="login-footer">
<p>Compte par défaut : <strong>admin / admin</strong></p>
</div>
</div>
</div>
);
}
-217
View File
@@ -1,217 +0,0 @@
import axios, { AxiosInstance, AxiosError } from 'axios';
import type {
User,
Note,
Todo,
GlobalTodo,
RssFeed,
RssArticle,
RssSummary,
OpenRouterModel,
Settings,
NoteFile
} from '../types';
// Configuration Axios
const api: AxiosInstance = axios.create({
baseURL: '/api',
headers: {
'Content-Type': 'application/json',
},
});
// Intercepteur pour ajouter le token JWT
api.interceptors.request.use((config) => {
const token = localStorage.getItem('token');
if (token) {
config.headers.Authorization = `Bearer ${token}`;
}
return config;
});
// Intercepteur pour gérer les erreurs d'authentification
api.interceptors.response.use(
(response) => response,
(error: AxiosError) => {
if (error.response?.status === 401 || error.response?.status === 403) {
localStorage.removeItem('token');
localStorage.removeItem('user');
window.location.href = '/login';
}
return Promise.reject(error);
}
);
// === AUTH ===
export const authApi = {
login: async (username: string, password: string) => {
const { data } = await api.post('/auth/login', { username, password });
return data;
},
register: async (username: string, password: string) => {
const { data } = await api.post('/auth/register', { username, password });
return data;
},
logout: async () => {
const { data } = await api.post('/auth/logout');
return data;
},
};
// === USERS ===
export const usersApi = {
getAll: async (): Promise<User[]> => {
const { data } = await api.get('/users');
return data;
},
create: async (username: string, password: string, is_admin: boolean): Promise<User> => {
const { data } = await api.post('/users', { username, password, is_admin });
return data;
},
update: async (id: number, password: string): Promise<void> => {
await api.put(`/users/${id}`, { password });
},
delete: async (id: number): Promise<void> => {
await api.delete(`/users/${id}`);
},
};
// === NOTES ===
export const notesApi = {
getAll: async (archived: boolean = false): Promise<Note[]> => {
const { data } = await api.get(`/notes?archived=${archived}`);
return Array.isArray(data) ? data : [];
},
getOne: async (id: number): Promise<Note> => {
const { data } = await api.get(`/notes/${id}`);
return data;
},
create: async (note: Partial<Note>): Promise<Note> => {
const { data } = await api.post('/notes', note);
return data;
},
update: async (id: number, note: Partial<Note>): Promise<void> => {
await api.put(`/notes/${id}`, note);
},
delete: async (id: number): Promise<void> => {
await api.delete(`/notes/${id}`);
},
archive: async (id: number, archived: boolean): Promise<void> => {
await api.put(`/notes/${id}/archive`, { archived });
},
uploadImage: async (id: number, file: File): Promise<{ filename: string; url: string }> => {
const formData = new FormData();
formData.append('image', file);
const { data } = await api.post(`/notes/${id}/image`, formData, {
headers: { 'Content-Type': 'multipart/form-data' },
});
return data;
},
deleteImage: async (id: number): Promise<void> => {
await api.delete(`/notes/${id}/image`);
},
uploadFile: async (id: number, file: File): Promise<NoteFile> => {
const formData = new FormData();
formData.append('file', file);
const { data } = await api.post(`/notes/${id}/files`, formData, {
headers: { 'Content-Type': 'multipart/form-data' },
});
return data;
},
downloadFile: async (fileId: number): Promise<void> => {
window.open(`/api/notes/files/${fileId}/download`, '_blank');
},
deleteFile: async (fileId: number): Promise<void> => {
await api.delete(`/api/notes/files/${fileId}`);
},
};
// === NOTE TODOS ===
export const noteTodosApi = {
create: async (noteId: number, text: string): Promise<Todo> => {
const { data } = await api.post(`/notes/${noteId}/todos`, { text });
return data;
},
update: async (id: number, completed: boolean): Promise<void> => {
await api.put(`/notes/todos/${id}`, { completed });
},
delete: async (id: number): Promise<void> => {
await api.delete(`/notes/todos/${id}`);
},
};
// === GLOBAL TODOS ===
export const todosApi = {
getAll: async (): Promise<GlobalTodo[]> => {
const { data} = await api.get('/todos');
return data;
},
create: async (text: string): Promise<GlobalTodo> => {
const { data } = await api.post('/todos', { text });
return data;
},
update: async (id: number, completed: boolean): Promise<void> => {
await api.put(`/todos/${id}`, { completed });
},
delete: async (id: number): Promise<void> => {
await api.delete(`/todos/${id}`);
},
};
// === RSS FEEDS ===
export const rssApi = {
getFeeds: async (): Promise<RssFeed[]> => {
const { data } = await api.get('/rss/feeds');
return data;
},
addFeed: async (url: string): Promise<RssFeed> => {
const { data } = await api.post('/rss/feeds', { url });
return data;
},
updateFeed: async (id: number, enabled: boolean): Promise<void> => {
await api.put(`/rss/feeds/${id}`, { enabled });
},
deleteFeed: async (id: number): Promise<void> => {
await api.delete(`/rss/feeds/${id}`);
},
fetchArticles: async (): Promise<{ message: string }> => {
const { data } = await api.post('/rss/fetch');
return data;
},
getArticles: async (): Promise<RssArticle[]> => {
const { data } = await api.get('/rss/articles');
return data || [];
},
getSummaries: async (): Promise<RssSummary[]> => {
const { data } = await api.get('/rss/summaries');
return data || [];
},
generateSummary: async (): Promise<{ summary: string; model: string; articles_count: number }> => {
const { data } = await api.post('/rss/summarize');
return data;
},
getModels: async (): Promise<OpenRouterModel[]> => {
const { data } = await api.get('/rss/models');
return data;
},
};
// === SETTINGS ===
export const settingsApi = {
getAll: async (): Promise<Settings> => {
const { data } = await api.get('/settings');
return data;
},
getOne: async (key: string): Promise<{ key: string; value: string }> => {
const { data } = await api.get(`/settings/${key}`);
return data;
},
update: async (key: string, value: string): Promise<void> => {
await api.put(`/settings/${key}`, { value });
},
delete: async (key: string): Promise<void> => {
await api.delete(`/settings/${key}`);
},
};
export default api;
-114
View File
@@ -1,114 +0,0 @@
// Types pour l'application NoteFlow
export interface User {
id: number;
username: string;
is_admin: boolean;
created_at: string;
}
export interface Note {
id: number;
user_id: number;
title: string;
content: string;
image_filename?: string;
archived: boolean;
created_at: string;
updated_at: string;
todos?: Todo[];
files?: NoteFile[];
todos_count?: number;
todos_completed?: number;
}
export interface Todo {
id: number;
note_id: number;
text: string;
completed: boolean;
position: number;
}
export interface GlobalTodo {
id: number;
user_id: number;
text: string;
completed: boolean;
created_at: string;
}
export interface NoteFile {
id: number;
note_id: number;
filename: string;
original_name: string;
file_size: number;
mime_type: string;
created_at: string;
}
export interface RssFeed {
id: number;
url: string;
title: string;
description: string;
enabled: boolean;
created_at: string;
last_fetched_at?: string;
}
export interface RssArticle {
id: number;
feed_id: number;
title: string;
link: string;
description?: string;
pub_date: string;
content?: string;
feed_title: string;
feed_url: string;
}
export interface RssSummary {
id: number;
summary: string;
model: string;
articles_count: number;
created_at: string;
}
export interface OpenRouterModel {
id: string;
name: string;
provider: string;
context_length?: number;
pricing?: {
prompt: number;
completion: number;
};
}
export interface Settings {
[key: string]: string;
openrouter_api_key?: string;
openrouter_model?: string;
rss_summary_enabled?: string;
rss_summary_prompt?: string;
}
export interface AuthContextType {
user: User | null;
token: string | null;
login: (username: string, password: string) => Promise<void>;
logout: () => void;
isAuthenticated: boolean;
}
export interface ApiError {
error: string;
details?: any;
}
export type NoteView = 'active' | 'archived';
export type TodoFilter = 'all' | 'active' | 'completed';
-28
View File
@@ -1,28 +0,0 @@
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"target": "ES2022",
"useDefineForClassFields": true,
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"module": "ESNext",
"types": ["vite/client"],
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"moduleDetection": "force",
"noEmit": true,
"jsx": "react-jsx",
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
},
"include": ["src"]
}
-7
View File
@@ -1,7 +0,0 @@
{
"files": [],
"references": [
{ "path": "./tsconfig.app.json" },
{ "path": "./tsconfig.node.json" }
]
}
-26
View File
@@ -1,26 +0,0 @@
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
"target": "ES2023",
"lib": ["ES2023"],
"module": "ESNext",
"types": ["node"],
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"moduleDetection": "force",
"noEmit": true,
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
},
"include": ["vite.config.ts"]
}
-23
View File
@@ -1,23 +0,0 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
server: {
port: 5173,
proxy: {
'/api': {
target: 'http://localhost:3000',
changeOrigin: true,
},
'/uploads': {
target: 'http://localhost:3000',
changeOrigin: true,
},
},
},
build: {
outDir: '../public-react',
},
})
-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>