Compare commits
No commits in common. "8def52fbf24b9c1d1bdd88b6e67bd6e3f32a3533" and "af28539a0248af80b4cfce9f208576d82e097c58" have entirely different histories.
8def52fbf2
...
af28539a02
@ -8,8 +8,8 @@ function App() {
|
|||||||
<div className="logo">
|
<div className="logo">
|
||||||
<a href={baseUrl}>
|
<a href={baseUrl}>
|
||||||
<img alt="logo" height="66%" src="logo.svg" />
|
<img alt="logo" height="66%" src="logo.svg" />
|
||||||
<h3 className="centered">cutt</h3>
|
|
||||||
</a>
|
</a>
|
||||||
|
<h3 className="centered">cutt</h3>
|
||||||
<span className="grey">cool ultimate team tool</span>
|
<span className="grey">cool ultimate team tool</span>
|
||||||
</div>
|
</div>
|
||||||
<Rankings />
|
<Rankings />
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Dispatch, SetStateAction, useEffect, useMemo, useState } from "react";
|
import { Dispatch, SetStateAction, useEffect, useState } from "react";
|
||||||
import { ReactSortable, ReactSortableProps } from "react-sortablejs";
|
import { ReactSortable, ReactSortableProps } from "react-sortablejs";
|
||||||
import api, { baseUrl } from "./api";
|
import api, { baseUrl } from "./api";
|
||||||
|
|
||||||
@ -268,28 +268,7 @@ export function MVP({ user, players }: PlayerInfoProps) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Rankings() {
|
function openPage(pageName: string, color: string) {
|
||||||
const [user, setUser] = useState<Player[]>([]);
|
|
||||||
const [players, setPlayers] = useState<Player[]>([]);
|
|
||||||
const [openTab, setOpenTab] = useState("Chemistry");
|
|
||||||
|
|
||||||
async function loadPlayers() {
|
|
||||||
const response = await fetch(`${baseUrl}player/list`, {
|
|
||||||
method: "GET",
|
|
||||||
});
|
|
||||||
const data = await response.json();
|
|
||||||
setPlayers(data as Player[]);
|
|
||||||
}
|
|
||||||
|
|
||||||
useMemo(() => {
|
|
||||||
loadPlayers();
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
user.length === 1 && openPage(openTab, "aliceblue");
|
|
||||||
}, [user]);
|
|
||||||
|
|
||||||
function openPage(pageName: string, color: string) {
|
|
||||||
// Hide all elements with class="tabcontent" by default */
|
// Hide all elements with class="tabcontent" by default */
|
||||||
var i, tabcontent, tablinks;
|
var i, tabcontent, tablinks;
|
||||||
tabcontent = document.getElementsByClassName("tabcontent");
|
tabcontent = document.getElementsByClassName("tabcontent");
|
||||||
@ -311,9 +290,24 @@ export default function Rankings() {
|
|||||||
activeButton.style.fontWeight = "bold";
|
activeButton.style.fontWeight = "bold";
|
||||||
activeButton.style.opacity = "100%";
|
activeButton.style.opacity = "100%";
|
||||||
document.body.style.backgroundColor = color;
|
document.body.style.backgroundColor = color;
|
||||||
setOpenTab(pageName);
|
}
|
||||||
|
|
||||||
|
export default function Rankings() {
|
||||||
|
const [user, setUser] = useState<Player[]>([]);
|
||||||
|
const [players, setPlayers] = useState<Player[]>([]);
|
||||||
|
|
||||||
|
async function loadPlayers() {
|
||||||
|
const response = await fetch(`${baseUrl}player/list`, {
|
||||||
|
method: "GET",
|
||||||
|
});
|
||||||
|
const data = await response.json();
|
||||||
|
setPlayers(data as Player[]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
loadPlayers();
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<SelectUser {...{ user, setUser, players, setPlayers }} />
|
<SelectUser {...{ user, setUser, players, setPlayers }} />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user