From 82cb5608c128b2a66ab1a7e7b8bc3633ed7f8d9a Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 12 Nov 2025 15:07:43 +0000 Subject: [PATCH] =?UTF-8?q?Fix:=20Correction=20modal=20ajout=20RDV=20et=20?= =?UTF-8?q?r=C3=A9organisation=20layout?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Corrections : 1. Bug modal ajout de rendez-vous : - Remplacement des composants Select par des éléments select natifs - Les composants shadcn/ui Select ne fonctionnaient pas avec FormData - Le modal affichait une page blanche à cause de ce problème - Maintenant le formulaire fonctionne correctement 2. Réorganisation du layout : - Box Todo et RSS maintenant côte à côte (au lieu d'empilées) - Largeur de la colonne droite passée de 380px à 760px - Grid à 2 colonnes dans la partie droite - Hauteur augmentée : max-h-[calc(100vh-300px)] pour les deux boxes - Plus d'espace pour afficher les tâches et articles 3. Amélioration affichage RSS : - Suppression de la rotation automatique toutes les 20s - Affichage de tous les articles (15) avec scroll - Suppression de l'état rssDisplayOffset inutile - Suppression du useEffect de rotation - Meilleure utilisation de l'espace vertical disponible --- src/pages/Index.tsx | 159 +++++++++++++++++++------------------------- 1 file changed, 68 insertions(+), 91 deletions(-) diff --git a/src/pages/Index.tsx b/src/pages/Index.tsx index f14814d..91555b3 100644 --- a/src/pages/Index.tsx +++ b/src/pages/Index.tsx @@ -56,7 +56,6 @@ const Index = () => { const [loadingModels, setLoadingModels] = useState(false); const [currentDateTime, setCurrentDateTime] = useState(new Date()); const [upcomingAlert, setUpcomingAlert] = useState(null); - const [rssDisplayOffset, setRssDisplayOffset] = useState(0); const [calendarAuthStatus, setCalendarAuthStatus] = useState<{ isAuthenticated: boolean; isExpired: boolean; @@ -111,18 +110,6 @@ const Index = () => { return () => clearInterval(timer); }, [calendarEvents]); - // RSS articles rotation every 20 seconds - useEffect(() => { - if (rssArticles.length > 3) { - const timer = setInterval(() => { - setRssDisplayOffset(prev => { - const maxOffset = Math.max(0, rssArticles.length - 3); - return (prev + 3) % (maxOffset + 3); - }); - }, 20000); // Rotate every 20 seconds - return () => clearInterval(timer); - } - }, [rssArticles.length]); useEffect(() => { const userFromAuth = AuthService.getUser(); @@ -702,8 +689,8 @@ const Index = () => { {/* Main Content */}
- {/* Three Column Layout: Calendar Left | Notes Middle | Todo/RSS Right */} -
+ {/* Three Column Layout: Calendar Left | Notes Middle | Todo+RSS Right */} +
{/* Left Column: Calendar */}
@@ -1192,8 +1179,8 @@ const Index = () => { )}
- {/* Right Column: Todos & RSS Boxes stacked */} -
+ {/* Right Column: Todos & RSS Boxes side by side */} +
{/* Todos Box */} @@ -1215,7 +1202,7 @@ const Index = () => { -
+
{todos.filter(t => !t.completed).length > 0 ? ( todos.filter(t => !t.completed).map(todo => (
@@ -1244,7 +1231,7 @@ const Index = () => { -
+
{todos.filter(t => t.completed).length > 0 ? ( todos.filter(t => t.completed).map(todo => (
@@ -1294,9 +1281,9 @@ const Index = () => {
-
+
{rssArticles.length > 0 ? ( - rssArticles.slice(rssDisplayOffset, rssDisplayOffset + 3).map(article => ( + rssArticles.map(article => (
{

)} - {rssArticles.length > 3 && ( -
-
- {Array.from({ length: Math.ceil(rssArticles.length / 3) }).map((_, i) => ( -
- ))} -
-
- )}
@@ -1954,6 +1927,9 @@ const Index = () => { const formData = new FormData(e.currentTarget); try { + const reminderMinutes = formData.get('reminderMinutes') as string; + const recurrenceValue = formData.get('recurrence') as string; + const eventData = { title: formData.get('title') as string, description: formData.get('description') as string || undefined, @@ -1961,10 +1937,10 @@ const Index = () => { endDateTime: new Date(formData.get('endDateTime') as string).toISOString(), location: formData.get('location') as string || undefined, attendees: (formData.get('attendees') as string || '').split(',').map(e => e.trim()).filter(e => e), - reminders: formData.get('reminderMinutes') ? [ - { method: 'popup', minutes: parseInt(formData.get('reminderMinutes') as string) } + reminders: reminderMinutes && reminderMinutes !== '0' ? [ + { method: 'popup', minutes: parseInt(reminderMinutes) } ] : undefined, - recurrence: formData.get('recurrence') ? [formData.get('recurrence') as string] : undefined, + recurrence: recurrenceValue ? [recurrenceValue] : undefined, visibility: formData.get('visibility') as string || 'default', colorId: formData.get('colorId') as string || undefined }; @@ -1973,6 +1949,7 @@ const Index = () => { showSuccess('Événement créé avec succès'); setAddEventModal(false); await loadCalendarEvents(); + e.currentTarget.reset(); } catch (error: any) { showError(error.response?.data?.error || 'Erreur lors de la création de l\'événement'); } @@ -2032,71 +2009,71 @@ const Index = () => {
- +
- +
- +
- +