aboutsummaryrefslogtreecommitdiff
path: root/maps-frontend/src/components/HubList.js
diff options
context:
space:
mode:
Diffstat (limited to 'maps-frontend/src/components/HubList.js')
-rw-r--r--maps-frontend/src/components/HubList.js13
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>
);
}