@@ -6,7 +6,7 @@ import { chain } from "lodash";
66import { useEffect , useMemo , useState } from "react" ;
77import { Helmet } from "react-helmet" ;
88import { BehaviorSubject , Subject } from "rxjs" ;
9- import { EventType , IsIncident , IsOpenStatus } from "~/Components/Event/Enums" ;
9+ import { EventStatus , EventType , IsIncident , IsOpenStatus } from "~/Components/Event/Enums" ;
1010import { EventGrid } from "~/Components/Home/EventGrid" ;
1111import "~/Components/Home/Home.css" ;
1212import { Indicator } from "~/Components/Home/Indicator" ;
@@ -34,7 +34,7 @@ const log = new Logger("Home");
3434 * @component
3535 * @author Aloento
3636 * @since 1.0.0
37- * @version 0.2 .0
37+ * @version 0.3 .0
3838 */
3939export function Home ( ) {
4040 const { DB } = useStatus ( ) ;
@@ -90,17 +90,28 @@ export function Home() {
9090 : `${ abnormalCount } components have issues, but don't worry, we are working on it.`
9191 : "All Systems Operational" ;
9292
93+ const pendingCount = useMemo ( ( ) => {
94+ const events = chain ( DB . Events )
95+ . filter ( e => e . Status === EventStatus . PendingReview )
96+ . value ( ) ;
97+
98+ log . debug ( "Pending Maintenance" , events ) ;
99+ return events . length ;
100+ } , [ DB ] ) ;
101+
93102 return (
94103 < >
95104 < Helmet >
96105 < title > { Dic . Name } { Dic . Prod } </ title >
97106 </ Helmet >
98107
99- < ScaleNotification
100- heading = "You have 6 maintenance events for the review."
101- opened
102- variant = "informational"
103- />
108+ { pendingCount > 0 && (
109+ < ScaleNotification
110+ heading = { `You have ${ pendingCount } maintenance events pending for review.` }
111+ opened
112+ variant = "informational"
113+ />
114+ ) }
104115
105116 < ScaleNotification
106117 heading = { heading }
0 commit comments