1- import { useState } from "react" ;
2- import {
3- Button ,
4- CircularProgress ,
5- Stack ,
6- Typography ,
7- Divider ,
8- } from "@mui/material" ;
9- import PropTypes from "prop-types" ;
10- import { useEffect } from "react" ;
1+ import { FC , useEffect , useState } from "react" ;
2+ import { CircularProgress , Stack , Typography , Divider } from "@mui/material" ;
113import { Virtuoso } from "react-virtuoso" ;
124import * as analytics from "services/analytics" ;
135import {
@@ -19,20 +11,38 @@ import StakeholderDetails from "../StakeholderDetails/StakeholderDetails";
1911import StakeholderPreview from "../StakeholderPreview/StakeholderPreview" ;
2012import useBreakpoints from "hooks/useBreakpoints" ;
2113import { useMapbox } from "hooks/useMapbox" ;
14+ import type { Theme } from "@mui/material/styles" ;
15+
16+ interface Stakeholder {
17+ id : number ;
18+ latitude : number ;
19+ longitude : number ;
20+ [ key : string ] : unknown ;
21+ }
22+
23+ interface ResultsListProps {
24+ stakeholders : Stakeholder [ ] ;
25+ loading : boolean ;
26+ handleReset ?: ( ) => void ;
27+ }
2228
23- const ResultsList = ( { stakeholders, loading, handleReset } ) => {
29+ const ResultsList : FC < ResultsListProps > = ( {
30+ stakeholders,
31+ loading,
32+ handleReset,
33+ } ) => {
2434 const selectedOrganization = useSelectedOrganization ( ) ;
2535 const [ topMostIndex , setTopMostIndex ] = useState ( 0 ) ;
2636 const { isDesktop } = useBreakpoints ( ) ;
27- const dispatch = useAppDispatch ( ) ;
37+ const dispatch = useAppDispatch ( ) as ( action : any ) => void ;
2838 const { flyTo } = useMapbox ( ) ;
2939 const open = useFilterPanel ( ) ;
3040
3141 useEffect ( ( ) => {
3242 analytics . postEvent ( "showList" ) ;
3343 } , [ ] ) ;
3444
35- const handleHover = ( stakeholder ) => {
45+ const handleHover = ( stakeholder : Stakeholder ) => {
3646 dispatch ( {
3747 type : "HOVERED_ORGANIZATION_UPDATED" ,
3848 organization : stakeholder ,
@@ -65,7 +75,7 @@ const ResultsList = ({ stakeholders, loading, handleReset }) => {
6575 < Stack pt = { 2 } spacing = { 2 } >
6676 < Stack px = { 2 } direction = "row" justifyContent = "space-between" >
6777 < Typography
68- sx = { ( theme ) => ( {
78+ sx = { ( theme : Theme ) => ( {
6979 fontWeight : "bold" ,
7080 fontSize : { xs : "18px" } ,
7181 color : theme . palette . common . gray ,
@@ -94,7 +104,7 @@ const ResultsList = ({ stakeholders, loading, handleReset }) => {
94104 </ Stack >
95105 ) }
96106 { stakeholders . length ? (
97- < Virtuoso
107+ < Virtuoso < Stakeholder >
98108 initialTopMostItemIndex = { topMostIndex }
99109 data = { stakeholders }
100110 style = { {
@@ -143,11 +153,4 @@ const ResultsList = ({ stakeholders, loading, handleReset }) => {
143153 ) ;
144154} ;
145155
146- ResultsList . propTypes = {
147- stakeholders : PropTypes . arrayOf ( PropTypes . object ) ,
148- status : PropTypes . string ,
149- handleReset : PropTypes . func ,
150- handleFlyTo : PropTypes . func ,
151- } ;
152-
153156export default ResultsList ;
0 commit comments