diff --git a/nest_frontend/components/interactive/BoxAlerts.js b/nest_frontend/components/interactive/BoxAlerts.js index 5f057e3..36aeabf 100644 --- a/nest_frontend/components/interactive/BoxAlerts.js +++ b/nest_frontend/components/interactive/BoxAlerts.js @@ -1,15 +1,29 @@ -import React from "react" +import React, { useMemo } from "react" import BoxFullScrollable from "../base/BoxFullScrollable" import SummaryAlert from "./SummaryAlert" import useStrings from "../../hooks/useStrings" +import Empty from "./Empty" export default function BoxAlerts({ alerts, destroy, running, ...props }) { const strings = useStrings() + const content = useMemo( + () => { + if(alerts.length === 0) { + return + } + + return alerts.map(alert => ( + destroy(alert["id"])} running={running}/> + )) + }, + [alerts, running, destroy] + ) + return ( - {alerts.map(alert => destroy(alert["id"])} running={running}/>)} + {content} ) }