diff --git a/main.py b/main.py
index 5413eb3..cf62c31 100644
--- a/main.py
+++ b/main.py
@@ -80,7 +80,7 @@ team_router.add_api_route("/list", endpoint=list_teams, methods=["GET"])
team_router.add_api_route("/add", endpoint=add_team, methods=["POST"])
-@api_router.post("/mvps")
+@api_router.post("/mvps", dependencies=[Depends(get_current_active_user)])
def submit_mvps(mvps: MVPRanking):
with Session(engine) as session:
session.add(mvps)
@@ -88,7 +88,7 @@ def submit_mvps(mvps: MVPRanking):
return JSONResponse("success!")
-@api_router.post("/chemistry")
+@api_router.post("/chemistry", dependencies=[Depends(get_current_active_user)])
def submit_chemistry(chemistry: Chemistry):
with Session(engine) as session:
session.add(chemistry)
diff --git a/package.json b/package.json
index 6205f34..1df3984 100644
--- a/package.json
+++ b/package.json
@@ -19,6 +19,7 @@
},
"devDependencies": {
"@eslint/js": "^9.17.0",
+ "@types/node": "^22.13.10",
"@types/react": "18.3.18",
"@types/react-dom": "18.3.5",
"@types/sortablejs": "^1.15.8",
diff --git a/src/Analysis.tsx b/src/Analysis.tsx
index 2d25cfb..a6e56f3 100644
--- a/src/Analysis.tsx
+++ b/src/Analysis.tsx
@@ -17,13 +17,6 @@ import { apiAuth } from "./api";
// };
//};
//
-interface Prop {
- name: string;
- min: string;
- max: string;
- step: string;
- value: string;
-}
interface Params {
nodeSize: number;
@@ -36,12 +29,6 @@ interface Params {
show: number;
}
-interface DeferredProps {
- timeout: number;
- func: () => void;
-}
-
-
let timeoutID: NodeJS.Timeout | null = null;
export default function Analysis() {
const [image, setImage] = useState("");
@@ -65,9 +52,10 @@ export default function Analysis() {
.then((data) => {
setImage(data.image);
setLoading(false);
- }).catch((e) => {
- console.log("best to just reload... ", e);
})
+ .catch((e) => {
+ console.log("best to just reload... ", e);
+ });
}
useEffect(() => {
@@ -81,19 +69,35 @@ export default function Analysis() {
function showLabel() {
switch (params.show) {
- case 0: return "dislike";
- case 1: return "both";
- case 2: return "like";
+ case 0:
+ return "dislike";
+ case 1:
+ return "both";
+ case 2:
+ return "like";
}
}
return (
-
@@ -120,7 +126,9 @@ export default function Analysis() {
setParams({ ...params, weighting: evt.target.checked })}
+ onChange={(evt) =>
+ setParams({ ...params, weighting: evt.target.checked })
+ }
/>
@@ -129,7 +137,9 @@ export default function Analysis() {
setParams({ ...params, popularity: evt.target.checked })}
+ onChange={(evt) =>
+ setParams({ ...params, popularity: evt.target.checked })
+ }
/>
@@ -143,9 +153,12 @@ export default function Analysis() {
max="3.001"
step="0.05"
value={params.distance}
- onChange={(evt) => setParams({ ...params, distance: Number(evt.target.value) })}
+ onChange={(evt) =>
+ setParams({ ...params, distance: Number(evt.target.value) })
+ }
/>
- {params.distance}
+ {params.distance}
+
@@ -154,7 +167,9 @@ export default function Analysis() {
min="500"
max="3000"
value={params.nodeSize}
- onChange={(evt) => setParams({ ...params, nodeSize: Number(evt.target.value) })}
+ onChange={(evt) =>
+ setParams({ ...params, nodeSize: Number(evt.target.value) })
+ }
/>
{params.nodeSize}
@@ -166,7 +181,9 @@ export default function Analysis() {
min="4"
max="24"
value={params.fontSize}
- onChange={(evt) => setParams({ ...params, fontSize: Number(evt.target.value) })}
+ onChange={(evt) =>
+ setParams({ ...params, fontSize: Number(evt.target.value) })
+ }
/>
{params.fontSize}
@@ -179,7 +196,9 @@ export default function Analysis() {
max="5"
step="0.1"
value={params.edgeWidth}
- onChange={(evt) => setParams({ ...params, edgeWidth: Number(evt.target.value) })}
+ onChange={(evt) =>
+ setParams({ ...params, edgeWidth: Number(evt.target.value) })
+ }
/>
{params.edgeWidth}
@@ -191,20 +210,19 @@ export default function Analysis() {
min="10"
max="50"
value={params.arrowSize}
- onChange={(evt) => setParams({ ...params, arrowSize: Number(evt.target.value) })}
+ onChange={(evt) =>
+ setParams({ ...params, arrowSize: Number(evt.target.value) })
+ }
/>
{params.arrowSize}
-
- {
- loading ? (
-
- ) : (
-
- )
- }
-
+ {loading ? (
+
+ ) : (
+
+ )}
+
);
}
diff --git a/src/MVPChart.tsx b/src/MVPChart.tsx
index d87a635..3b50aac 100644
--- a/src/MVPChart.tsx
+++ b/src/MVPChart.tsx
@@ -1,10 +1,8 @@
import { useEffect, useState } from "react";
import { apiAuth } from "./api";
-import BarChart from "./BarChart";
import { PlayerRanking } from "./types";
import RaceChart from "./RaceChart";
-
const MVPChart = () => {
const [data, setData] = useState({} as PlayerRanking[]);
const [loading, setLoading] = useState(true);
@@ -13,17 +11,26 @@ const MVPChart = () => {
async function loadData() {
setLoading(true);
await apiAuth("analysis/mvp", null)
- .then(json => json as Promise).then(json => { setData(json.sort((a, b) => a.rank - b.rank)) })
+ .then((json) => json as Promise)
+ .then((json) => {
+ setData(json.sort((a, b) => a.rank - b.rank));
+ });
setLoading(false);
}
- useEffect(() => { loadData() }, [])
+ useEffect(() => {
+ loadData();
+ }, []);
return (
<>
- {loading ? :
- }
- >)
-}
+ {loading ? (
+
+ ) : (
+
+ )}
+ >
+ );
+};
export default MVPChart;
diff --git a/src/RaceChart.tsx b/src/RaceChart.tsx
index 00f09db..227060f 100644
--- a/src/RaceChart.tsx
+++ b/src/RaceChart.tsx
@@ -1,6 +1,5 @@
import { FC, useEffect, useState } from "react";
import { PlayerRanking } from "./types";
-import { useSession } from "./Session";
interface RaceChartProps {
players: PlayerRanking[];
diff --git a/src/SetPassword.tsx b/src/SetPassword.tsx
index 276b457..d5defaa 100644
--- a/src/SetPassword.tsx
+++ b/src/SetPassword.tsx
@@ -1,7 +1,7 @@
-import { InvalidTokenError, jwtDecode, JwtPayload } from "jwt-decode";
+import { jwtDecode, JwtPayload } from "jwt-decode";
import { useEffect, useState } from "react";
import { baseUrl } from "./api";
-import { redirect, useNavigate } from "react-router";
+import { useNavigate } from "react-router";
interface SetPassToken extends JwtPayload {
name: string;
diff --git a/tsconfig.app.json b/tsconfig.app.json
index a67d962..1294592 100644
--- a/tsconfig.app.json
+++ b/tsconfig.app.json
@@ -3,10 +3,13 @@
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"target": "ES2020",
"useDefineForClassFields": true,
- "lib": ["ES2020", "DOM", "DOM.Iterable"],
+ "lib": [
+ "ES2020",
+ "DOM",
+ "DOM.Iterable"
+ ],
"module": "ESNext",
"skipLibCheck": true,
-
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
@@ -14,7 +17,6 @@
"moduleDetection": "force",
"noEmit": true,
"jsx": "react-jsx",
-
/* Linting */
"strict": true,
"noUnusedLocals": false,
@@ -22,5 +24,7 @@
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
},
- "include": ["src"]
+ "include": [
+ "src"
+ ]
}