Skip to content

Commit

Permalink
Merge pull request #64 from Solar-Gators/cleanup
Browse files Browse the repository at this point in the history
Cleanup
  • Loading branch information
jackschedel authored Oct 30, 2023
2 parents 5137a6f + 343ac74 commit 3fc9b7a
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 46 deletions.
3 changes: 2 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
"eject": "react-scripts eject",
"format": "prettier --write ./"
},
"proxy": "https://telemetry-api.ufsolargators.org",
"browserslist": {
Expand Down
30 changes: 20 additions & 10 deletions client/public/404.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta charset="utf-8" />
<title>Single Page Apps for GitHub Pages</title>
<script type="text/javascript">
// Single Page Apps for GitHub Pages
Expand All @@ -27,15 +27,25 @@

var l = window.location;
l.replace(
l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') +
l.pathname.split('/').slice(0, 1 + segmentCount).join('/') + '/?p=/' +
l.pathname.slice(1).split('/').slice(segmentCount).join('/').replace(/&/g, '~and~') +
(l.search ? '&q=' + l.search.slice(1).replace(/&/g, '~and~') : '') +
l.hash
l.protocol +
"//" +
l.hostname +
(l.port ? ":" + l.port : "") +
l.pathname
.split("/")
.slice(0, 1 + segmentCount)
.join("/") +
"/?p=/" +
l.pathname
.slice(1)
.split("/")
.slice(segmentCount)
.join("/")
.replace(/&/g, "~and~") +
(l.search ? "&q=" + l.search.slice(1).replace(/&/g, "~and~") : "") +
l.hash,
);

</script>
</head>
<body>
</body>
<body></body>
</html>
43 changes: 24 additions & 19 deletions client/public/index.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta
name="description"
content="Solar Gators' telemetry website"
/>
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<script src="https://kit.fontawesome.com/98364a6ba7.js" crossorigin="anonymous"></script>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="Solar Gators' telemetry website" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<script
src="https://kit.fontawesome.com/98364a6ba7.js"
crossorigin="anonymous"
></script>
<!-- Start Single Page Apps for GitHub Pages -->
<script type="text/javascript">
// Single Page Apps for GitHub Pages
Expand All @@ -22,27 +22,32 @@
// When the single page app is loaded further down in this file,
// the correct url will be waiting in the browser's history for
// the single page app to route accordingly.
(function(l) {
(function (l) {
if (l.search) {
var q = {};
l.search.slice(1).split('&').forEach(function(v) {
var a = v.split('=');
q[a[0]] = a.slice(1).join('=').replace(/~and~/g, '&');
});
l.search
.slice(1)
.split("&")
.forEach(function (v) {
var a = v.split("=");
q[a[0]] = a.slice(1).join("=").replace(/~and~/g, "&");
});
if (q.p !== undefined) {
window.history.replaceState(null, null,
l.pathname.slice(0, -1) + (q.p || '') +
(q.q ? ('?' + q.q) : '') +
l.hash
window.history.replaceState(
null,
null,
l.pathname.slice(0, -1) +
(q.p || "") +
(q.q ? "?" + q.q : "") +
l.hash,
);
}
}
}(window.location))
})(window.location);
</script>
<!-- End Single Page Apps for GitHub Pages -->

<title>Solar Gators Telemetry</title>

</head>
<body>
<div id="root"></div>
Expand Down
1 change: 0 additions & 1 deletion client/src/component/Label.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ function Label({ svgSrc, label, value, unit, booleanError }: Props) {
let finalValue = value;
let rowColor = "";
let fontColor = "black";
console.log(value, isNaN(Number(finalValue)));
if (typeof value === "boolean") {
finalValue = value ? "Yes" : "No";

Expand Down
6 changes: 3 additions & 3 deletions client/src/component/Sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ function Sidebar() {
<li style={{ textAlign: "center" }}>
<img width="160px" height="100px" src="./logo.png" />
</li>
<li className={location.pathname == "/" && "bold active"}>
<li className={location.pathname == "/" ? "bold active" : ""}>
<Link to="/">Live</Link>
</li>
<li className={location.pathname == "/strategy" && "bold active"}>
<li className={location.pathname == "/strategy" ? "bold active" : ""}>
<Link to="/strategy">Strategy</Link>
</li>
<li className={location.pathname == "/history" && "bold active"}>
<li className={location.pathname == "/history" ? "bold active" : ""}>
<Link to="/history">Data Export</Link>
</li>
</ul>
Expand Down
3 changes: 0 additions & 3 deletions client/src/pages/CountLaps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@ function CountLaps() {

const getLap = () => {
getMostRecent("laps" as any, "rx0").then((response: any) => {
console.log(response);
setLap(response["lap"]);
});
};

console.log(lap);

useEffect(() => {
getLap();
}, []);
Expand Down
16 changes: 9 additions & 7 deletions client/src/pages/Strategy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -263,14 +263,18 @@ function Strategy() {
setRangeMax(maxValue);
setRangeMin(minValue);

console.log(filteredResponse);

const requestedTimespan =
new Date(endTime).getTime() - new Date(startTime).getTime();

const startTimestamp = new Date(
filteredResponse[0]["dateStamp"] * granularityMs,
).getTime();
let startTimestamp;

try {
startTimestamp = new Date(
filteredResponse[0]["dateStamp"] * granularityMs,
).getTime();
} catch (e) {
return;
}

const endTimestamp = new Date(
filteredResponse[filteredResponse.length - 1]["dateStamp"] *
Expand Down Expand Up @@ -334,8 +338,6 @@ function Strategy() {

regStats = regression.score(regXValues, regYValues);

console.log([regression, regStats]);

setRegressionRSquared(regStats["r2"]);

regOffset = regression.predict(lastTimestamp) - lastValue;
Expand Down
4 changes: 2 additions & 2 deletions client/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"declaration": true,
"experimentalDecorators": true
},
"include": [".\**\*.ts"],
"exclude": ["src\**\*.spec.ts", "node_modules"]
"include": [".***.ts"],
"exclude": ["src***.spec.ts", "node_modules"]
}

0 comments on commit 3fc9b7a

Please sign in to comment.