mirror of
https://github.com/pds-nest/nest.git
synced 2024-11-22 21:14:18 +00:00
29 lines
806 B
JavaScript
29 lines
806 B
JavaScript
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 <Empty/>
|
|
}
|
|
|
|
return alerts.map(alert => (
|
|
<SummaryAlert alert={alert} destroy={() => destroy(alert["id"])} running={running}/>
|
|
))
|
|
},
|
|
[alerts, running, destroy]
|
|
)
|
|
|
|
return (
|
|
<BoxFullScrollable header={strings.alertTitle} {...props}>
|
|
{content}
|
|
</BoxFullScrollable>
|
|
)
|
|
}
|