From e5d3e3a24ee9856e64d8c29dc95257bac6d49bd9 Mon Sep 17 00:00:00 2001 From: Reviflow Bot Date: Thu, 5 Feb 2026 21:45:38 +0100 Subject: [PATCH] Fix syntax errors in RecentRevisionsWidget and MasteryWidget --- .../features/dashboard/ActivityTimeline.tsx | 32 +- .../features/dashboard/GamificationWidget.tsx | 15 +- .../src/features/dashboard/MasteryWidget.tsx | 42 +- .../dashboard/RecentRevisionsWidget.tsx | 508 +++++++++--------- 4 files changed, 303 insertions(+), 294 deletions(-) diff --git a/frontend/src/features/dashboard/ActivityTimeline.tsx b/frontend/src/features/dashboard/ActivityTimeline.tsx index 9d9ffc7..a765912 100644 --- a/frontend/src/features/dashboard/ActivityTimeline.tsx +++ b/frontend/src/features/dashboard/ActivityTimeline.tsx @@ -72,27 +72,27 @@ export function ActivityTimeline({ learnerId }: ActivityTimelineProps) {
{/* Summary Cards */}
-
+

Aujourd'hui

-

{data.summary.today_minutes} min

+

{data.summary.today_minutes} min

-
+

Cette semaine

-

{data.summary.week_minutes} min

+

{data.summary.week_minutes} min

-
+

Total Quiz

-

{data.summary.total_quizzes}

+

{data.summary.total_quizzes}

-
+

Total Révisions

-

{data.summary.total_revisions}

+

{data.summary.total_revisions}

{/* Timeline */}
-

+

Historique

@@ -102,10 +102,10 @@ export function ActivityTimeline({ learnerId }: ActivityTimelineProps) { {data.history.map((day) => (
{/* Date Marker */} -
+
-

+

{new Date(day.date).toLocaleDateString('fr-FR', { weekday: 'long', day: 'numeric', month: 'long' })}

{day.total_minutes} min d'activité

@@ -123,17 +123,17 @@ export function ActivityTimeline({ learnerId }: ActivityTimelineProps) { window.location.href = `/revision/${item.id}`; } }} - className={`bg-white border border-slate-200 p-4 rounded-lg shadow-sm flex items-center gap-4 hover:border-slate-300 transition-colors ${item.type === 'REVISION' ? 'cursor-pointer hover:bg-slate-50' : ''}`} + className={`bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 p-4 rounded-lg shadow-sm flex items-center gap-4 hover:border-slate-300 dark:hover:border-slate-600 transition-colors ${item.type === 'REVISION' ? 'cursor-pointer hover:bg-slate-50 dark:hover:bg-slate-700/50' : ''}`} > -
+
{item.type === 'QUIZ' ? : }
-

{item.topic}

-

{item.details}

+

{item.topic}

+

{item.details}

-

{new Date(item.created_at).toLocaleTimeString('fr-FR', { hour: '2-digit', minute: '2-digit' })}

+

{new Date(item.created_at).toLocaleTimeString('fr-FR', { hour: '2-digit', minute: '2-digit' })}

{item.minutes} min

diff --git a/frontend/src/features/dashboard/GamificationWidget.tsx b/frontend/src/features/dashboard/GamificationWidget.tsx index 59b0d27..d16e22c 100644 --- a/frontend/src/features/dashboard/GamificationWidget.tsx +++ b/frontend/src/features/dashboard/GamificationWidget.tsx @@ -32,7 +32,8 @@ export function GamificationWidget() { }; return ( -
+
+ {/* Background Decorations */}
@@ -40,21 +41,21 @@ export function GamificationWidget() {
-
Niveau {level}
-

{getLevelTitle(level)}

+
Niveau {level}
+

{getLevelTitle(level)}

-
+
-
+
{currentXP} XP Totaux - Prochain niveau: {Math.round(nextLevelStartXP - currentXP)} XP + Prochain niveau: {Math.round(nextLevelStartXP - currentXP)} XP
{/* Progress Bar Container */} -
+
{/* Active Progress */}
+
{/* Background Decorations */}
- +
{[1, 2, 3].map((i) => (
- - + +
- +
))}
@@ -67,30 +67,30 @@ export function MasteryWidget({ learnerId }: MasteryWidgetProps = {}) { if (stats.length === 0) { return ( -
-
+
+
📊
-

Pas encore de résultats

+

Pas encore de résultats

Termine un quiz pour voir tes statistiques !

); } return ( -
+
{/* Background Decorations */}
-

Maîtrise des Sujets 🧠

+

Maîtrise des Sujets 🧠

{stats.map((item, index) => ( -
+
-

{item.topic}

+

{item.topic}

{item.last_activity ? new Date(item.last_activity).toLocaleDateString() : '—'} • @@ -101,9 +101,9 @@ export function MasteryWidget({ learnerId }: MasteryWidgetProps = {}) {
{/* Status Label */}
))}
-
+ +
+ ); } diff --git a/frontend/src/features/dashboard/RecentRevisionsWidget.tsx b/frontend/src/features/dashboard/RecentRevisionsWidget.tsx index c45af89..a1a138c 100644 --- a/frontend/src/features/dashboard/RecentRevisionsWidget.tsx +++ b/frontend/src/features/dashboard/RecentRevisionsWidget.tsx @@ -134,14 +134,14 @@ export const RecentRevisionsWidget = () => { return ( <> -
+
{/* Background Decorations */}
-

+

Mes Cours

@@ -154,7 +154,7 @@ export const RecentRevisionsWidget = () => { key={rev.id} whileHover={{ y: -4 }} whileTap={{ scale: 0.99 }} - className="group p-5 bg-slate-50/80 border border-slate-100/80 rounded-[2rem] hover:bg-white hover:border-indigo-100 shadow-sm hover:shadow-xl hover:shadow-indigo-500/10 transition-all cursor-pointer relative" + className="group p-5 bg-slate-50/80 dark:bg-slate-700/30 border border-slate-100/80 dark:border-slate-700/50 rounded-[2rem] hover:bg-white dark:hover:bg-slate-700/50 hover:border-indigo-100 dark:hover:border-slate-600 shadow-sm hover:shadow-xl hover:shadow-indigo-500/10 transition-all cursor-pointer relative" onClick={() => navigate(`/play/${rev.id}`)} > {/* Delete Button - Subtle top right */} @@ -195,20 +195,20 @@ export const RecentRevisionsWidget = () => { {rev.subject || 'Général'}
-

+

{rev.topic}

{/* Bottom Section: Progress + Primary Actions */} -
+

Ajouté le {new Date(rev.created_at).toLocaleDateString()}

- Progression: {rev.current_series}/{rev.total_series} QUIZZ + Progression: {rev.current_series}/{rev.total_series} QUIZZ

@@ -237,7 +237,7 @@ export const RecentRevisionsWidget = () => { e.stopPropagation(); setRestartModal({ isOpen: true, revisionId: rev.id }); }} - className="w-14 h-14 rounded-2xl bg-slate-50 border-2 border-slate-100 flex items-center justify-center text-slate-400 hover:bg-green-500 hover:text-white hover:border-transparent transition-all shadow-sm group/btn" + className="w-14 h-14 rounded-2xl bg-slate-50 dark:bg-slate-700 border-2 border-slate-100 dark:border-slate-600 flex items-center justify-center text-slate-400 hover:bg-green-500 hover:text-white hover:border-transparent transition-all shadow-sm group/btn" title="Recommencer" > 🔄 @@ -260,275 +260,281 @@ export const RecentRevisionsWidget = () => { whileHover={{ scale: 1.02 }} whileTap={{ scale: 0.98 }} onClick={() => navigate('/history')} - className="w-full mt-6 py-4 px-6 bg-white border-2 border-slate-100 text-indigo-600 rounded-2xl font-black text-sm flex items-center justify-center gap-3 shadow-sm hover:border-indigo-200 hover:bg-indigo-50/30 transition-all active:bg-indigo-50" + className="w-full mt-6 py-4 px-6 bg-white dark:bg-slate-800 border-2 border-slate-100 dark:border-slate-700 text-indigo-600 dark:text-indigo-400 rounded-2xl font-black text-sm flex items-center justify-center gap-3 shadow-sm hover:border-indigo-200 dark:hover:border-indigo-900 hover:bg-indigo-50/30 dark:hover:bg-indigo-900/20 transition-all active:bg-indigo-50" > Tout voir
-
+
{/* Restart Confirmation Modal */} - {restartModal.isOpen && ( - setRestartModal({ isOpen: false, revisionId: null })} - > + { + restartModal.isOpen && ( e.stopPropagation()} - className="bg-white rounded-2xl p-6 shadow-2xl max-w-sm w-full relative overflow-hidden" + initial={{ opacity: 0 }} + animate={{ opacity: 1 }} + exit={{ opacity: 0 }} + className="fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm p-4" + onClick={() => setRestartModal({ isOpen: false, revisionId: null })} > -
- -
- -
-
- -
- -

Recommencer le cours ?

-

- Vous allez recommencer ce cours depuis le début. Votre progression actuelle (série en cours) sera réinitialisée. -

- -
+ e.stopPropagation()} + className="bg-white dark:bg-slate-900 rounded-2xl p-6 shadow-2xl max-w-sm w-full relative overflow-hidden border border-transparent dark:border-slate-800" + > +
-
-
- - - )} - - {/* Delete Confirmation Modal */} - - {deleteModal.isOpen && ( - setDeleteModal({ isOpen: false, revisionId: null })} - > - e.stopPropagation()} - className="bg-white rounded-2xl p-6 shadow-2xl max-w-sm w-full relative overflow-hidden ring-4 ring-red-50" - > -
- -
- -
-
- -
- -

Supprimer ce cours ?

-

- Cette action est irréversible. Toutes les données (progression, quiz, notes) seront effacées. -

- -
- - -
-
-
-
- )} -
- - {/* Summary Modal */} - - {summaryModal.isOpen && ( - setSummaryModal(prev => ({ ...prev, isOpen: false }))} - > - e.stopPropagation()} - className="bg-[#FDFCF8] rounded-[2.5rem] p-8 shadow-2xl max-w-2xl w-full my-auto relative border border-white/50" - > -
- -
- - {summaryModal.loading ? ( -
-
-

Chargement du résumé...

-
- ) : summaryModal.data ? ( -
-
-
- Résumé du cours -
-

- {summaryModal.data.topic} -

+
+
+
-
- {/* Synthesis Section (Magic Summary) */} - {summaryModal.data.synthesis && ( -
-

- - Résumé Magique -

-
- {summaryModal.data.synthesis} -
-
- )} +

Recommencer le cours ?

+

+ Vous allez recommencer ce cours depuis le début. Votre progression actuelle (série en cours) sera réinitialisée. +

- {/* Tips & Mnemonics Split Section */} - {summaryModal.data.study_tips && ( -
- {(() => { - try { - const allTips: string[] = JSON.parse(summaryModal.data.study_tips); - if (!Array.isArray(allTips)) return null; - - const mnemonics = allTips.filter(tip => - tip.toLowerCase().includes('moyen') || - tip.toLowerCase().includes('mémo') || - tip.toLowerCase().includes('phrase') || - tip.length < 50 - ); - const regularTips = allTips.filter(tip => !mnemonics.includes(tip)); - - return ( - <> - {/* Regular Tips Column */} -
-

- - Astuces -

-
- {regularTips.length > 0 ? regularTips.map((tip, idx) => ( -
- "{tip}" -
- )) : ( -

Aucun conseil particulier.

- )} -
-
- - {/* Mnemonics Column */} -
-

- - Mémos -

-
- {mnemonics.length > 0 ? mnemonics.map((memo, idx) => ( -
- {memo} -
- )) : ( -

Pas de mémotechnique.

- )} -
-
- - ); - } catch (e) { return null; } - })()} -
- )} -
- -
+
+
- ) : null} + - - )} - + ) + } + + + {/* Delete Confirmation Modal */} + + { + deleteModal.isOpen && ( + setDeleteModal({ isOpen: false, revisionId: null })} + > + e.stopPropagation()} + className="bg-white dark:bg-slate-900 rounded-2xl p-6 shadow-2xl max-w-sm w-full relative overflow-hidden ring-4 ring-red-50 dark:ring-red-900/10 border border-transparent dark:border-slate-800" + > +
+ +
+ +
+
+ +
+ +

Supprimer ce cours ?

+

+ Cette action est irréversible. Toutes les données (progression, quiz, notes) seront effacées. +

+ +
+ + +
+
+
+
+ ) + } +
+ + {/* Summary Modal */} + + { + summaryModal.isOpen && ( + setSummaryModal(prev => ({ ...prev, isOpen: false }))} + > + e.stopPropagation()} + className="bg-[#FDFCF8] dark:bg-slate-900 rounded-[2.5rem] p-8 shadow-2xl max-w-2xl w-full my-auto relative border border-white/50 dark:border-slate-800" + > +
+ +
+ + {summaryModal.loading ? ( +
+
+

Chargement du résumé...

+
+ ) : summaryModal.data ? ( +
+
+
+ Résumé du cours +
+

+ {summaryModal.data.topic} +

+
+ +
+ {/* Synthesis Section (Magic Summary) */} + {summaryModal.data.synthesis && ( +
+

+ + Résumé Magique +

+
+ {summaryModal.data.synthesis} +
+
+ )} + + {/* Tips & Mnemonics Split Section */} + {summaryModal.data.study_tips && ( +
+ {(() => { + try { + const allTips: string[] = JSON.parse(summaryModal.data.study_tips); + if (!Array.isArray(allTips)) return null; + + const mnemonics = allTips.filter(tip => + tip.toLowerCase().includes('moyen') || + tip.toLowerCase().includes('mémo') || + tip.toLowerCase().includes('phrase') || + tip.length < 50 + ); + const regularTips = allTips.filter(tip => !mnemonics.includes(tip)); + + return ( + <> + {/* Regular Tips Column */} +
+

+ + Astuces +

+
+ {regularTips.length > 0 ? regularTips.map((tip, idx) => ( +
+ "{tip}" +
+ )) : ( +

Aucun conseil particulier.

+ )} +
+
+ + {/* Mnemonics Column */} +
+

+ + Mémos +

+
+ {mnemonics.length > 0 ? mnemonics.map((memo, idx) => ( +
+ {memo} +
+ )) : ( +

Pas de mémotechnique.

+ )} +
+
+ + ); + } catch (e) { return null; } + })()} +
+ )} +
+ +
+ +
+
+ ) : null} +
+
+ ) + } +
); };