From d798737f0c5e00ef39b8695297f41d93922b3ad5 Mon Sep 17 00:00:00 2001 From: Michael Foiani Date: Tue, 20 Apr 2021 01:01:02 -0400 Subject: Quick search feature and some restructuring. --- react-frontend/src/components/HubList.js | 21 +--------- react-frontend/src/components/HubWidget.js | 29 +++++++++++++ react-frontend/src/components/InvestorInfo.js | 2 +- react-frontend/src/components/Search.js | 59 +++++++++++++++++++++++++++ react-frontend/src/components/WatchDogs.js | 4 +- 5 files changed, 92 insertions(+), 23 deletions(-) create mode 100644 react-frontend/src/components/HubWidget.js create mode 100644 react-frontend/src/components/Search.js diff --git a/react-frontend/src/components/HubList.js b/react-frontend/src/components/HubList.js index c9a5156..fe47457 100644 --- a/react-frontend/src/components/HubList.js +++ b/react-frontend/src/components/HubList.js @@ -13,8 +13,6 @@ 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,15 +28,6 @@ function HubList(props) { setHubItems(hubs); } - const getName = () => { - props.data.forEach(hub => { - if (hub.id === props.selected) { - setName(hub.name); - } - }) - setName(''); - } - // React hook that updates when the hubs are recalculated useEffect(() => updateHubItems(), [props.data]); @@ -49,15 +38,7 @@ function HubList(props) { getName(); }, [props.selected]); - return ( -
-
-

Suspicion Ranks

-
    {hubItems}
-
- -
- ); + return ; } export default HubList; \ No newline at end of file diff --git a/react-frontend/src/components/HubWidget.js b/react-frontend/src/components/HubWidget.js new file mode 100644 index 0000000..e3c03cd --- /dev/null +++ b/react-frontend/src/components/HubWidget.js @@ -0,0 +1,29 @@ +// React and component imports +import { useEffect, useState } from "react"; +import Hub from "./Hub.js"; +import InvestorInfo from "./InvestorInfo.js"; + +// CSS import +import '../css/UserCheckin.css'; +import HubList from "./HubList.js"; +import Search from "./Search.js"; + +/** + * Component that build the checkin list and displays checkin info. + * @returns {import('react').HtmlHTMLAttributes} A div with the hubs + * in a vertical layout. + */ +function HudWidget(props) { + return ( +
+
+

Suspicion Ranks

+ +
+ + +
+ ); +} + +export default HubWidget; \ No newline at end of file diff --git a/react-frontend/src/components/InvestorInfo.js b/react-frontend/src/components/InvestorInfo.js index d368984..88d0dc0 100644 --- a/react-frontend/src/components/InvestorInfo.js +++ b/react-frontend/src/components/InvestorInfo.js @@ -57,7 +57,7 @@ function InvestorInfo(props) { useEffect(() => getInfo(), [props.name, props.isSelected, props.personId]) return ( - -- cgit v1.2.3-70-g09d2