feat: choose user once at the beginning

This commit is contained in:
2025-01-26 17:30:37 +01:00
parent 3b33b1ca44
commit 31e29de4cd
3 changed files with 169 additions and 102 deletions

View File

@@ -1,63 +1,13 @@
import "./App.css";
import { Chemistry, MVP } from "./Rankings";
import Rankings from "./Rankings";
function App() {
function openPage(pageName: string, color: string) {
// Hide all elements with class="tabcontent" by default */
var i, tabcontent, tablinks;
tabcontent = document.getElementsByClassName("tabcontent");
for (i = 0; i < tabcontent.length; i++) {
(tabcontent[i] as HTMLElement).style.display = "none";
}
// Remove the background color of all tablinks/buttons
tablinks = document.getElementsByClassName("tablink");
for (i = 0; i < tablinks.length; i++) {
let button = tablinks[i] as HTMLElement;
button.style.backgroundColor = "unset";
button.style.textDecoration = "unset";
button.style.fontWeight = "unset";
button.style.color = "unset";
}
// Show the specific tab content
(document.getElementById(pageName) as HTMLElement).style.display = "block";
// Add the specific color to the button used to open the tab content
let activeButton = document.getElementById(
pageName + "Button"
) as HTMLElement;
activeButton.style.textDecoration = "underline";
activeButton.style.fontWeight = "bold";
activeButton.style.backgroundColor = "#3366cc";
activeButton.style.color = "white";
document.body.style.backgroundColor = color;
}
return (
<>
<img alt="logo" height="128px" src="logo.svg" />
<h1>cutt</h1>
<span className="grey">cool ultimate team tool</span>
<div className="container">
<button
className="tablink"
id="ChemistryButton"
onClick={() => openPage("Chemistry", "aliceblue")}
>
Chemistry
</button>
<button
className="tablink"
id="MVPButton"
onClick={() => openPage("MVP", "aliceblue")}
>
MVP
</button>
</div>
<div id="Chemistry" className="tabcontent">
<Chemistry />
</div>
<div id="MVP" className="tabcontent">
<MVP />
</div>
<Rankings />
<footer>
<p className="grey">
something not working? message <a href="https://t.me/x0124816">me</a>.