From 43cafa6da8334bf41440588ce71a27b42b73ef9d Mon Sep 17 00:00:00 2001 From: Altemush Bhatti Date: Tue, 2 Jun 2020 14:49:34 -0700 Subject: [PATCH] feat(incident): Added Report Incident button --- src/incidents/list/ViewIncidents.tsx | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/incidents/list/ViewIncidents.tsx b/src/incidents/list/ViewIncidents.tsx index 473ed240ce..4cb0213561 100644 --- a/src/incidents/list/ViewIncidents.tsx +++ b/src/incidents/list/ViewIncidents.tsx @@ -1,3 +1,4 @@ +import { Button } from '@hospitalrun/components' import format from 'date-fns/format' import React, { useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' @@ -6,6 +7,7 @@ import { useHistory } from 'react-router-dom' import SelectWithLabelFormGroup from '../../components/input/SelectWithLableFormGroup' import Incident from '../../model/Incident' +import { useButtonToolbarSetter } from '../../page-header/ButtonBarProvider' import useTitle from '../../page-header/useTitle' import { RootState } from '../../store' import IncidentFilter from '../IncidentFilter' @@ -19,6 +21,25 @@ const ViewIncidents = () => { const [searchFilter, setSearchFilter] = useState(IncidentFilter.reported) const { incidents } = useSelector((state: RootState) => state.incidents) + const setButtonToolBar = useButtonToolbarSetter() + useEffect(() => { + setButtonToolBar([ + , + ]) + + return () => { + setButtonToolBar([]) + } + }, [dispatch, setButtonToolBar, t, history]) + useEffect(() => { dispatch(searchIncidents(searchFilter)) }, [dispatch, searchFilter])