import React, { useState } from "react"; import Accordion from "@mui/material/Accordion"; import AccordionSummary from "@mui/material/AccordionSummary"; import AccordionDetails from "@mui/material/AccordionDetails"; import ExpandMoreIcon from "@mui/icons-material/ExpandMore"; import Typography from "@mui/material/Typography"; import Button from "@mui/material/Button"; import Select, { SelectChangeEvent } from "@mui/material/Select"; import { GetAllServers } from "../../Server/AllServers"; import { Server } from "../../Server/Server"; import { GetServerByHostname } from "../../Server/ServerHelpers"; import MenuItem from "@mui/material/MenuItem"; export function Servers(): React.ReactElement { const [server, setServer] = useState("home"); function setServerDropdown(event: SelectChangeEvent): void { setServer(event.target.value as string); } function rootServer(): void { const s = GetServerByHostname(server); if (s === null) return; if (!(s instanceof Server)) return; s.hasAdminRights = true; s.sshPortOpen = true; s.ftpPortOpen = true; s.smtpPortOpen = true; s.httpPortOpen = true; s.sqlPortOpen = true; s.openPortCount = 5; } function rootAllServers(): void { for (const s of GetAllServers()) { if (!(s instanceof Server)) return; s.hasAdminRights = true; s.sshPortOpen = true; s.ftpPortOpen = true; s.smtpPortOpen = true; s.httpPortOpen = true; s.sqlPortOpen = true; s.openPortCount = 5; } } function minSecurity(): void { const s = GetServerByHostname(server); if (s === null) return; if (!(s instanceof Server)) return; s.hackDifficulty = s.minDifficulty; } function minAllSecurity(): void { for (const s of GetAllServers()) { if (!(s instanceof Server)) return; s.hackDifficulty = s.minDifficulty; } } function maxMoney(): void { const s = GetServerByHostname(server); if (s === null) return; if (!(s instanceof Server)) return; s.moneyAvailable = s.moneyMax; } function maxAllMoney(): void { for (const s of GetAllServers()) { if (!(s instanceof Server)) return; s.moneyAvailable = s.moneyMax; } } return ( }> Servers
Server:
Root:
Security:
Money:
); }