diff options
author | Michael Foiani <sotech117@michaels-mbp-3.lan> | 2021-04-16 18:55:40 -0400 |
---|---|---|
committer | Michael Foiani <sotech117@michaels-mbp-3.lan> | 2021-04-16 18:55:40 -0400 |
commit | 79cf63694077d0835a62b9833d31f3c263cdccd9 (patch) | |
tree | 569f1a679567576e0924cb3cd989337625a6e447 /maps-frontend/src/components/HubList.js | |
parent | 868c250d5c9ab45be1c5a478d2ff5cd82ec60f2d (diff) |
Working version without the feature to see data on a certain ceo.
Diffstat (limited to 'maps-frontend/src/components/HubList.js')
-rw-r--r-- | maps-frontend/src/components/HubList.js | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/maps-frontend/src/components/HubList.js b/maps-frontend/src/components/HubList.js index d046e94..f5b1414 100644 --- a/maps-frontend/src/components/HubList.js +++ b/maps-frontend/src/components/HubList.js @@ -14,6 +14,7 @@ import '../css/UserCheckin.css'; function HubList(props) { const [hubItems, setHubItems] = useState([]); const [isSelected, setIsSelected] = useState(false); + const [name, setName] = useState(''); /** * Loads new the checkins into the current cache/map of hubs. @@ -30,20 +31,22 @@ function HubList(props) { } const getName = () => { - console.log(props.selected); props.data.forEach(hub => { if (hub.id == props.selected) { - return hub.name; + setName(hub.name); } }) - return ''; + setName(''); } // React hook that updates when the hubs are recalculated useEffect(() => updateHubItems(), [props.data]); //React hook to show data for an investor - useEffect(() => setIsSelected(true), [props.selected]); + useEffect(() => { + setIsSelected(true) + getName(); + }, [props.selected]); return ( <div className="User-checkin"> @@ -51,7 +54,7 @@ function HubList(props) { <h2>Suspicion Ranks</h2> <ul className='Checkin-list'>{hubItems}</ul> </div> - <InvestorInfo name={getName()} dates={props.dates}></InvestorInfo> + <InvestorInfo personId={props.selected} isSelected={isSelected} name={name} dates={props.dates}></InvestorInfo> </div> ); } |