import React, { useEffect, useState } from 'react'; import { Loader, NoContent, Input, Button } from 'UI'; import AlertItem from './AlertItem'; import { fetchList, init } from 'Duck/alerts'; import { connect } from 'react-redux'; import { getRE } from 'App/utils'; const AlertsList = (props) => { const { loading, list, instance, onEdit } = props; const [query, setQuery] = useState(''); useEffect(() => { props.fetchList(); }, []); const filterRE = getRE(query, 'i'); const _filteredList = list.filter(({ name, query: { left } }) => filterRE.test(name) || filterRE.test(left)); return (
setQuery(value)} />
Alerts helps your team stay up to date with the activity on your app.
} size="small" show={list.size === 0} >
{_filteredList.map((a) => (
onEdit(a.toData())} />
))}
); }; export default connect( (state) => ({ list: state.getIn(['alerts', 'list']).sort((a, b) => b.createdAt - a.createdAt), instance: state.getIn(['alerts', 'instance']), loading: state.getIn(['alerts', 'loading']), }), { fetchList, init } )(AlertsList);