import {IMod} from "../../types/Imod"; import {IResearch} from "../../types/IResearch"; import { Accordion, AccordionDetails, AccordionSummary, Grid2, Paper, Table, TableBody, TableCell, TableContainer, TableRow } from "@mui/material"; import {ExpandMore} from "@mui/icons-material"; import {getIcon, ModifiersProvidesTable} from "../ModifiersProvideTable"; import AvTimerOutlinedIcon from "@mui/icons-material/AvTimer"; import Required from "../Required"; import React, {useEffect, useState} from "react"; import {IBuilding} from "../../types/IBuilding"; import {IResearchShort} from "../../types/IResearchShort"; import {ResearchUrl, WeaponUrl} from "../../core/api"; import {IWeapon} from "../../types/IUnit"; interface IResearchFull { research: IResearch | undefined, } function ResearchFull(props: { id: number, building: IBuilding }){ const [researchFull, setResearchFull] = useState({ research: undefined, }); const building = props.building const research= researchFull.research!! useEffect(() => { fetch(ResearchUrl + "/" + building.modId + "/" + props.id) .then(res => res.json()) .then((research: IResearch) => { setResearchFull({ research:research, }) }); }, []); if(researchFull.research !== undefined) { return
Cost {research.costRequisition > 0 &&    {research.costRequisition.toFixed(0)}} {research.costPower > 0 &&    {research.costPower.toFixed(0)}} {(research.costPopulation !== undefined && research.costPopulation > 0) &&    {research.costPopulation.toFixed(0)}} {(research.costFaith !== undefined && research.costFaith > 0) &&    {research.costFaith}} {(research.costSouls !== undefined && research.costSouls > 0) &&    {research.costSouls.toFixed(0)}} {(research.costTime !== undefined && research.costTime > 0) &&    {research.costTime}s}

{research.description}
{research.requirements !== null && }
} else return
loading...
} export default ResearchFull;