Move buy coffee button to office UI section

This commit is contained in:
Staszek Welsh 2022-06-02 14:43:14 +01:00
parent ba7b76369b
commit 333975ecf6
2 changed files with 31 additions and 39 deletions

@ -5,7 +5,9 @@ import React, { useState } from "react";
import { OfficeSpace } from "../OfficeSpace"; import { OfficeSpace } from "../OfficeSpace";
import { Employee } from "../Employee"; import { Employee } from "../Employee";
import { EmployeePositions } from "../EmployeePositions"; import { EmployeePositions } from "../EmployeePositions";
import { BuyCoffee } from "../Actions";
import { MoneyCost } from "./MoneyCost";
import { numeralWrapper } from "../../ui/numeralFormat"; import { numeralWrapper } from "../../ui/numeralFormat";
import { UpgradeOfficeSizeModal } from "./modals/UpgradeOfficeSizeModal"; import { UpgradeOfficeSizeModal } from "./modals/UpgradeOfficeSizeModal";
@ -458,6 +460,20 @@ export function IndustryOffice(props: IProps): React.ReactElement {
onClose={() => setUpgradeOfficeSizeOpen(false)} onClose={() => setUpgradeOfficeSizeOpen(false)}
/> />
{!division.hasResearch("AutoBrew") && (
<>
<Tooltip
title={<Typography>Throw an office party to increase your employee's morale and happiness</Typography>}
>
<span>
<Button disabled={corp.funds < props.office.getCoffeeCost() || props.office.coffeeMult > 0} onClick={() => BuyCoffee(corp, props.office)}>
{props.office.coffeeMult > 0 ? "Buying coffee..." : <span>Buy Coffee - <MoneyCost money={props.office.getCoffeeCost()} corp={corp} /></span>}
</Button>
</span>
</Tooltip>
</>
)}
{!division.hasResearch("AutoPartyManager") && ( {!division.hasResearch("AutoPartyManager") && (
<> <>
<Tooltip <Tooltip

@ -4,7 +4,7 @@ import React, { useState } from "react";
import { OfficeSpace } from "../OfficeSpace"; import { OfficeSpace } from "../OfficeSpace";
import { Industries } from "../IndustryData"; import { Industries } from "../IndustryData";
import { BuyCoffee, HireAdVert } from "../Actions"; import { HireAdVert } from "../Actions";
import { numeralWrapper } from "../../ui/numeralFormat"; import { numeralWrapper } from "../../ui/numeralFormat";
import { createProgressBarText } from "../../utils/helpers/createProgressBarText"; import { createProgressBarText } from "../../utils/helpers/createProgressBarText";
import { MakeProductModal } from "./modals/MakeProductModal"; import { MakeProductModal } from "./modals/MakeProductModal";
@ -87,7 +87,14 @@ function MakeProductButton(): React.ReactElement {
</> </>
); );
} }
function Text(): React.ReactElement {
interface IProps {
currentCity: string;
office: OfficeSpace;
rerender: () => void;
}
export function IndustryOverview(props: IProps): React.ReactElement {
const corp = useCorporation(); const corp = useCorporation();
const division = useDivision(); const division = useDivision();
const [helpOpen, setHelpOpen] = useState(false); const [helpOpen, setHelpOpen] = useState(false);
@ -113,7 +120,7 @@ function Text(): React.ReactElement {
} }
return ( return (
<> <Paper>
<Typography> <Typography>
Industry: {division.type} (Corp Funds: <Money money={corp.funds} />) Industry: {division.type} (Corp Funds: <Money money={corp.funds} />)
</Typography> </Typography>
@ -191,7 +198,6 @@ function Text(): React.ReactElement {
</Typography> </Typography>
</StaticModal> </StaticModal>
</Box> </Box>
<Box display="flex" alignItems="center"> <Box display="flex" alignItems="center">
<Tooltip <Tooltip
title={ title={
@ -207,18 +213,8 @@ function Text(): React.ReactElement {
</Button> </Button>
<ResearchModal open={researchOpen} onClose={() => setResearchOpen(false)} industry={division} /> <ResearchModal open={researchOpen} onClose={() => setResearchOpen(false)} industry={division} />
</Box> </Box>
<br />
<Typography>Purchases & Upgrades</Typography>
<Box display="flex" alignItems="center"> <Box display="flex" alignItems="center">
<Tooltip title={"Provide your employees with coffee, increasing their energy by 5%."}>
<span>
<Button disabled={false} onClick={() => undefined}>
{"coffee"} -&nbsp;
<MoneyCost money={1e6} corp={corp} />
</Button>
</span>
</Tooltip>
<Tooltip <Tooltip
title={ title={
<Typography> <Typography>
@ -229,32 +225,12 @@ function Text(): React.ReactElement {
that increase the power of your advertising. that increase the power of your advertising.
</Typography> </Typography>
}> }>
<span> <Button disabled={division.getAdVertCost() > corp.funds} onClick={() => HireAdVert(corp, division)}>
<Button disabled={division.getAdVertCost() > corp.funds} onClick={() => HireAdVert(corp, division)}> Hire AdVert -&nbsp; <MoneyCost money={division.getAdVertCost()} corp={corp} />
{"Hire AdVert"} -&nbsp; </Button>
<MoneyCost money={division.getAdVertCost()} corp={corp} />
</Button>
</span>
</Tooltip> </Tooltip>
{division.makesProducts && <MakeProductButton />}
</Box> </Box>
</>
);
}
interface IProps {
currentCity: string;
office: OfficeSpace;
rerender: () => void;
}
export function IndustryOverview(props: IProps): React.ReactElement {
const division = useDivision();
return (
<Paper>
<Text />
<br />
{division.makesProducts && <MakeProductButton />}
</Paper> </Paper>
); );
} }