diff --git a/src/pages/Index.tsx b/src/pages/Index.tsx index c7b611c..44bc1cd 100644 --- a/src/pages/Index.tsx +++ b/src/pages/Index.tsx @@ -56,6 +56,7 @@ 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; @@ -109,6 +110,19 @@ 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(); if (userFromAuth) { @@ -728,7 +742,12 @@ const Index = () => { >
-

{event.title}

+
+ {isToday && ( +
+ )} +

{event.title}

+

{isToday ? "Aujourd'hui" : startDate.toLocaleDateString('fr-FR', { day: '2-digit', month: '2-digit' })} à {startDate.toLocaleTimeString('fr-FR', { hour: '2-digit', minute: '2-digit' })}

@@ -1171,79 +1190,78 @@ const Index = () => {
{/* Todos Box */} - +
- + Tâches -
- - Actives ({todos.filter(t => !t.completed).length}) - Complétées ({todos.filter(t => t.completed).length}) + + Actives ({todos.filter(t => !t.completed).length}) + Complétées ({todos.filter(t => t.completed).length}) - -
+ +
{todos.filter(t => !t.completed).length > 0 ? ( todos.filter(t => !t.completed).map(todo => ( -
+
todo.id && handleToggleTodo(todo.id)} - className="h-5 w-5" + className="h-4 w-4" /> - + {todo.text}
)) ) : ( -

Aucune tâche active

+

Aucune tâche active

)}
- -
+ +
{todos.filter(t => t.completed).length > 0 ? ( todos.filter(t => t.completed).map(todo => ( -
+
todo.id && handleToggleTodo(todo.id)} - className="h-5 w-5" + className="h-4 w-4" /> - + {todo.text}
)) ) : ( -

Aucune tâche complétée

+

Aucune tâche complétée

)}
@@ -1253,59 +1271,71 @@ const Index = () => { {/* RSS Box */} - -
- - + +
+ + Flux RSS -
- -
-
+
{rssArticles.length > 0 ? ( - rssArticles.map(article => ( + rssArticles.slice(rssDisplayOffset, rssDisplayOffset + 3).map(article => (
article.link && window.open(article.link, '_blank')} > -
+
-

{article.title}

+

{article.title}

{article.description && ( -

+

{article.description.replace(/<[^>]*>/g, '')}

)}
- +
)) ) : ( -

+

Aucun article

)} + {rssArticles.length > 3 && ( +
+
+ {Array.from({ length: Math.ceil(rssArticles.length / 3) }).map((_, i) => ( +
+ ))} +
+
+ )}