@@ -35,45 +35,53 @@ const ErrorNotification = ({
3535
3636 if ( errors . length === 0 || suppressErrors ) return null ;
3737
38+ // Only show the latest error to avoid overwhelming the user
39+ const visibleError = errors [ errors . length - 1 ] ;
40+ const remainingCount = Math . max ( 0 , errors . length - 1 ) ;
41+
3842 return (
3943 < div
4044 className = { `${
4145 isTauri ? "fixed" : "absolute"
4246 } bottom-10 right-4 z-50 max-w-[calc(100%-32px)] space-y-2`}
4347 >
44- { errors . map ( ( error ) => (
45- < div
46- key = { error . id }
47- className = { `flex justify-between gap-4 items-center p-4 rounded-lg shadow-lg ${
48- error . type === "error"
49- ? "bg-red-50 dark:bg-red-900"
50- : error . type === "warning"
51- ? "bg-yellow-50 dark:bg-yellow-900"
52- : "bg-blue-50 dark:bg-blue-900"
53- } `}
54- >
55- < div className = "flex" >
56- { error . type === "error" && (
57- < AlertCircle className = "w-5 h-5 text-red-500 mr-2" />
58- ) }
59- { error . type === "warning" && (
60- < AlertTriangle className = "w-5 h-5 text-yellow-500 mr-2" />
61- ) }
62- { error . type === "info" && (
63- < Info className = "w-5 h-5 text-blue-500 mr-2" />
64- ) }
48+ < div
49+ key = { visibleError . id }
50+ className = { `flex justify-between gap-4 items-center p-4 rounded-lg shadow-lg ${
51+ visibleError . type === "error"
52+ ? "bg-red-50 dark:bg-red-900"
53+ : visibleError . type === "warning"
54+ ? "bg-yellow-50 dark:bg-yellow-900"
55+ : "bg-blue-50 dark:bg-blue-900"
56+ } `}
57+ >
58+ < div className = "flex items-center" >
59+ { visibleError . type === "error" && (
60+ < AlertCircle className = "w-5 h-5 text-red-500 mr-2" />
61+ ) }
62+ { visibleError . type === "warning" && (
63+ < AlertTriangle className = "w-5 h-5 text-yellow-500 mr-2" />
64+ ) }
65+ { visibleError . type === "info" && (
66+ < Info className = "w-5 h-5 text-blue-500 mr-2" />
67+ ) }
6568
66- < span className = "text-sm text-gray-700 dark:text-gray-200" >
67- { error . message }
68- </ span >
69- </ div >
69+ < span className = "text-sm text-gray-700 dark:text-gray-200" >
70+ { visibleError . message }
71+ </ span >
7072
71- < X
72- className = "w-5 h-5 ml-4 cursor-pointer text-gray-400 hover:text-gray-600"
73- onClick = { ( ) => removeError ( error . id ) }
74- />
73+ { remainingCount > 0 && (
74+ < span className = "ml-2 px-2 py-1 text-xs rounded-md bg-black/5 dark:bg-white/10 text-gray-600 dark:text-gray-300" >
75+ +{ remainingCount }
76+ </ span >
77+ ) }
7578 </ div >
76- ) ) }
79+
80+ < X
81+ className = "w-5 h-5 ml-4 cursor-pointer text-gray-400 hover:text-gray-600"
82+ onClick = { ( ) => removeError ( visibleError . id ) }
83+ />
84+ </ div >
7785 </ div >
7886 ) ;
7987} ;
0 commit comments