mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-25 23:47:34 +01:00
Reduce component usage in sleeve element
This commit is contained in:
parent
57673ae281
commit
d942d27a85
@ -1,23 +1,19 @@
|
|||||||
|
import { Box, Button, Paper, Tooltip, Typography } from "@mui/material";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
|
|
||||||
import { Box, Paper, Typography, Button, Tooltip } from "@mui/material";
|
|
||||||
|
|
||||||
import { CONSTANTS } from "../../../Constants";
|
import { CONSTANTS } from "../../../Constants";
|
||||||
import { Crimes } from "../../../Crime/Crimes";
|
import { Crimes } from "../../../Crime/Crimes";
|
||||||
import { numeralWrapper } from "../../../ui/numeralFormat";
|
|
||||||
import { createProgressBarText } from "../../../utils/helpers/createProgressBarText";
|
|
||||||
import { use } from "../../../ui/Context";
|
|
||||||
import { FactionWorkType } from "../../../Faction/FactionWorkTypeEnum";
|
import { FactionWorkType } from "../../../Faction/FactionWorkTypeEnum";
|
||||||
|
import { use } from "../../../ui/Context";
|
||||||
|
import { numeralWrapper } from "../../../ui/numeralFormat";
|
||||||
|
import { ProgressBar } from "../../../ui/React/Progress";
|
||||||
import { Sleeve } from "../Sleeve";
|
import { Sleeve } from "../Sleeve";
|
||||||
import { SleeveTaskType } from "../SleeveTaskTypesEnum";
|
import { SleeveTaskType } from "../SleeveTaskTypesEnum";
|
||||||
|
|
||||||
import { SleeveAugmentationsModal } from "./SleeveAugmentationsModal";
|
|
||||||
import { TravelModal } from "./TravelModal";
|
|
||||||
import { StatsElement, EarningsElement } from "./StatsElement";
|
|
||||||
import { MoreStatsModal } from "./MoreStatsModal";
|
|
||||||
import { MoreEarningsModal } from "./MoreEarningsModal";
|
import { MoreEarningsModal } from "./MoreEarningsModal";
|
||||||
|
import { MoreStatsModal } from "./MoreStatsModal";
|
||||||
|
import { SleeveAugmentationsModal } from "./SleeveAugmentationsModal";
|
||||||
|
import { EarningsElement, StatsElement } from "./StatsElement";
|
||||||
import { TaskSelector } from "./TaskSelector";
|
import { TaskSelector } from "./TaskSelector";
|
||||||
|
import { TravelModal } from "./TravelModal";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
sleeve: Sleeve;
|
sleeve: Sleeve;
|
||||||
@ -131,51 +127,47 @@ export function SleeveElem(props: IProps): React.ReactElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box component={Paper} sx={{ width: "auto" }}>
|
<>
|
||||||
<Box sx={{ m: 1 }}>
|
<Paper sx={{ p: 1, display: "grid", gridTemplateColumns: "1fr 1fr", width: "auto", gap: 1 }}>
|
||||||
<Box display="grid" sx={{ gridTemplateColumns: "1fr 1fr", width: "100%", gap: 1 }}>
|
<span>
|
||||||
<Box>
|
<StatsElement sleeve={props.sleeve} />
|
||||||
<StatsElement sleeve={props.sleeve} />
|
<Box display="grid" sx={{ gridTemplateColumns: "1fr 1fr", width: "100%" }}>
|
||||||
<Box display="grid" sx={{ gridTemplateColumns: "1fr 1fr", width: "100%" }}>
|
<Button onClick={() => setStatsOpen(true)}>More Stats</Button>
|
||||||
<Button onClick={() => setStatsOpen(true)}>More Stats</Button>
|
<Button onClick={() => setEarningsOpen(true)}>More Earnings Info</Button>
|
||||||
<Button onClick={() => setEarningsOpen(true)}>More Earnings Info</Button>
|
<Tooltip title={player.money < CONSTANTS.TravelCost ? <Typography>Insufficient funds</Typography> : ""}>
|
||||||
<Tooltip title={player.money < CONSTANTS.TravelCost ? <Typography>Insufficient funds</Typography> : ""}>
|
<span>
|
||||||
<span>
|
<Button
|
||||||
<Button
|
onClick={() => setTravelOpen(true)}
|
||||||
onClick={() => setTravelOpen(true)}
|
disabled={player.money < CONSTANTS.TravelCost}
|
||||||
disabled={player.money < CONSTANTS.TravelCost}
|
sx={{ width: "100%", height: "100%" }}
|
||||||
sx={{ width: "100%", height: "100%" }}
|
>
|
||||||
>
|
Travel
|
||||||
Travel
|
</Button>
|
||||||
</Button>
|
</span>
|
||||||
</span>
|
</Tooltip>
|
||||||
</Tooltip>
|
<Tooltip
|
||||||
<Tooltip
|
title={props.sleeve.shock < 100 ? <Typography>Unlocked when sleeve has fully recovered</Typography> : ""}
|
||||||
title={
|
>
|
||||||
props.sleeve.shock < 100 ? <Typography>Unlocked when sleeve has fully recovered</Typography> : ""
|
<span>
|
||||||
}
|
<Button
|
||||||
>
|
onClick={() => setAugmentationsOpen(true)}
|
||||||
<span>
|
disabled={props.sleeve.shock < 100}
|
||||||
<Button
|
sx={{ width: "100%", height: "100%" }}
|
||||||
onClick={() => setAugmentationsOpen(true)}
|
>
|
||||||
disabled={props.sleeve.shock < 100}
|
Manage Augmentations
|
||||||
sx={{ width: "100%", height: "100%" }}
|
</Button>
|
||||||
>
|
</span>
|
||||||
Manage Augmentations
|
</Tooltip>
|
||||||
</Button>
|
|
||||||
</span>
|
|
||||||
</Tooltip>
|
|
||||||
</Box>
|
|
||||||
</Box>
|
</Box>
|
||||||
<Box>
|
</span>
|
||||||
<EarningsElement sleeve={props.sleeve} />
|
<span>
|
||||||
<Box>
|
<EarningsElement sleeve={props.sleeve} />
|
||||||
<TaskSelector player={player} sleeve={props.sleeve} setABC={setABC} />
|
<TaskSelector player={player} sleeve={props.sleeve} setABC={setABC} />
|
||||||
<Button onClick={setTask} sx={{ width: "100%" }}>
|
<Button onClick={setTask} sx={{ width: "100%" }}>
|
||||||
Set Task
|
Set Task
|
||||||
</Button>
|
</Button>
|
||||||
<Typography>{desc}</Typography>
|
<Typography>{desc}</Typography>
|
||||||
<Typography>
|
<Typography>
|
||||||
{props.sleeve.currentTask === SleeveTaskType.Crime && (
|
{props.sleeve.currentTask === SleeveTaskType.Crime && (
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
variant="determinate"
|
variant="determinate"
|
||||||
@ -184,23 +176,21 @@ export function SleeveElem(props: IProps): React.ReactElement {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</span>
|
||||||
</Box>
|
</Paper>
|
||||||
<MoreStatsModal open={statsOpen} onClose={() => setStatsOpen(false)} sleeve={props.sleeve} />
|
<MoreStatsModal open={statsOpen} onClose={() => setStatsOpen(false)} sleeve={props.sleeve} />
|
||||||
<MoreEarningsModal open={earningsOpen} onClose={() => setEarningsOpen(false)} sleeve={props.sleeve} />
|
<MoreEarningsModal open={earningsOpen} onClose={() => setEarningsOpen(false)} sleeve={props.sleeve} />
|
||||||
<TravelModal
|
<TravelModal
|
||||||
open={travelOpen}
|
open={travelOpen}
|
||||||
onClose={() => setTravelOpen(false)}
|
onClose={() => setTravelOpen(false)}
|
||||||
sleeve={props.sleeve}
|
sleeve={props.sleeve}
|
||||||
rerender={props.rerender}
|
rerender={props.rerender}
|
||||||
/>
|
/>
|
||||||
<SleeveAugmentationsModal
|
<SleeveAugmentationsModal
|
||||||
open={augmentationsOpen}
|
open={augmentationsOpen}
|
||||||
onClose={() => setAugmentationsOpen(false)}
|
onClose={() => setAugmentationsOpen(false)}
|
||||||
sleeve={props.sleeve}
|
sleeve={props.sleeve}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</>
|
||||||
</Box>
|
|
||||||
</Box>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user