aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Foiani <sotech117@michaels-mbp-3.lan>2021-04-20 12:49:22 -0400
committerMichael Foiani <sotech117@michaels-mbp-3.lan>2021-04-20 12:49:22 -0400
commit4411ae1564d716e5aa063e4c47302ffc907a078a (patch)
tree139d757cd3152b83f452000d9fe4ed6eeb7ef497
parente359237bb2820b830b8b48c73f87e944d19baecb (diff)
Fixed the crash if no data in timetime and hid if an investor has no holidngs.
-rw-r--r--react-frontend/src/components/HubWidget.js2
-rw-r--r--react-frontend/src/components/InvestorInfo.js12
-rw-r--r--react-frontend/src/components/WatchDogs.js5
-rw-r--r--react-frontend/src/css/UserCheckin.css2
4 files changed, 13 insertions, 8 deletions
diff --git a/react-frontend/src/components/HubWidget.js b/react-frontend/src/components/HubWidget.js
index 7a82c61..f0434d7 100644
--- a/react-frontend/src/components/HubWidget.js
+++ b/react-frontend/src/components/HubWidget.js
@@ -61,7 +61,7 @@ function HubWidget(props) {
<div className="Checkins">
<h2 className="Img-flex Title">
<span hidden={searching}>Sus Ranks</span>
- <input ref={textInput} hidden={!searching} type="text" onChange={e => setQueryString(e.target.value)} placeholder="Search by name"></input>
+ <input ref={textInput} hidden={!searching} type="search" onChange={e => setQueryString(e.target.value)} placeholder="Search by name"></input>
<img className="Img-btn" hidden={searching} onClick={() => setSearching(true)} src="assets/outline_search_white_18dp.png" alt="image"/>
<img className="Img-btn" hidden={!searching} onClick={() => setSearching(false)} src="assets/outline_cancel_white_18dp.png" alt="image"/>
</h2>
diff --git a/react-frontend/src/components/InvestorInfo.js b/react-frontend/src/components/InvestorInfo.js
index 436fa17..9e18299 100644
--- a/react-frontend/src/components/InvestorInfo.js
+++ b/react-frontend/src/components/InvestorInfo.js
@@ -48,13 +48,13 @@ function InvestorInfo(props) {
},
credentials: "same-origin",
})
- .then((res) => res.json())
- .then((data) => {
+ .then(res => res.json())
+ .then(data => {
console.log(data);
setInfo(data);
props.setShowSelectedInfo(true);
})
- .catch((err) => console.log(err));
+ .catch(err => console.log(err));
};
const stockTable = () => {
@@ -104,7 +104,7 @@ function InvestorInfo(props) {
</h2>
<div id="top-bar">
<div id="gain-number">
- <p className="bigNumber">{(info.moneyOut - info.moneyIn).toFixed(3)}$</p> gain
+ <p className="bigNumber">${(info.moneyOut - info.moneyIn).toFixed(3)}</p> gained
</div>
<div>
@@ -114,9 +114,9 @@ function InvestorInfo(props) {
</div>
<div>
- <div className="Checkin">
+ <div className="Checkin" hidden={info.holdings.length === 0}>
<div className="Img-flex">
- <span className="tableHeader">View returns</span>
+ <span className="tableHeader">View holdings</span>
<img
className="Img-btn"
hidden={showStocks}
diff --git a/react-frontend/src/components/WatchDogs.js b/react-frontend/src/components/WatchDogs.js
index dfe47c8..f7a9e74 100644
--- a/react-frontend/src/components/WatchDogs.js
+++ b/react-frontend/src/components/WatchDogs.js
@@ -51,6 +51,11 @@ function WatchDogs() {
//TODO: optimize this
//const sliced = data.holders.slice(0, 500);
//console.log(sliced);
+ console.log(data);
+ if(data.holders.length === 0) {
+ alert("There is no data between those timeframes :(");
+ return;
+ }
setData(data.holders);
setHasLoaded(true);
})
diff --git a/react-frontend/src/css/UserCheckin.css b/react-frontend/src/css/UserCheckin.css
index 23daffa..e60b348 100644
--- a/react-frontend/src/css/UserCheckin.css
+++ b/react-frontend/src/css/UserCheckin.css
@@ -101,7 +101,7 @@ ul {
}
/* CSS borrowed from W3 Schools */
-input[type=text] {
+input[type=search] {
width: 80%;
padding: 12px 20px;
box-sizing: border-box;