Files
CHOMPStation2/tgui/packages/tgui/interfaces/AreaScrubberControl.js
ShadowLarkens 951f37d2e3 TGUI Engineering: Squashed Edition (Commits Below)
TGUI APCs

 TGUI vending machines

 Fix AI default_tgui_interaction

 TGUI Airlocks

 Station & Atmospheric Alert TGUI + Misc NTOS-TGUI Fixes

 TGUI Air Alarms & Central Atmospheric Control

 Airlock TGUI

 TG... got rid of UI for fire alarm. í´·

 TGUI Gas Heating/Cooling System

 TGUI Gas Pump & Passive Gate + Fixes

 TGUI Omni Atmospherics

 TGUI Pipe Dispensers & RPD

 TGUI IntelliCore & Vending Fix

 TGUI Handheld Tanks

 TGUI Portable Pump & Scrubber

 TGUI Tank Dispenser & Canisters

 TGUI Radios

 TGUI SMES & Air Alarm adjustment

 Tweak vending machine interfaces a tad

 TGUI Algae Farm

 TGUI general_air_control

 - Distro & Waste Console
 - Riot Control Console
 - Atmos Intake Console
 - Engine Cooling Console

 TGUI Heavy Scrubber Control (and body scanner fix)

 TGUI trinary devices & shutoff monitor

 TGUI Telecomms Log Browser

 TGUI Telecomms Machine Browser

 TGUI Spaceheater Internal Panel

 TGUI Gravity Generator

 TGUI Id Cards & Fix ID Card Images

 TGUI Id Card Redesign

 TGUI Turbolift

 TGUI Suit Cycler & Suit Storage Unit & Vending Fixes

 TGUI Power Monitor

 TGUI Signalers

 TGUI Employment Records

 TGUI Drone Console

 TGUI RIGSuits

 TGUI PA & PACMAN, and Margin Fix

 TGUI Solar Panels & Fix Power Monitor

 Adjust TGUI modules & their interaction with NTOS

 TGUI RCON

 TGUI Message Monitor

 Bump TGUI line limit to 120 (ParadiseSS13/Paradise#14002)

 TGUI Exonet & NTNet Relay

 TGUI Telecomms Multitool Menu

 TGUI Shield Capacitor & Shield Generator

 TGUI Supermatter-everything & Refactors
2020-08-09 04:46:31 -07:00

121 lines
3.2 KiB
JavaScript

import { Flex, Button, Box, LabeledList, Section } from "../components";
import { useBackend, useLocalState } from "../backend";
import { Window } from '../layouts';
import { toTitleCase } from 'common/string';
export const AreaScrubberControl = (props, context) => {
const { act, data } = useBackend(context);
const [
showArea,
setShowArea,
] = useLocalState(context, "showArea", false);
const {
scrubbers,
} = data;
if (!scrubbers) {
return (
<Section title="Error">
<Box color="bad">No Scrubbers Detected.</Box>
<Button
fluid
icon="search"
content="Scan"
onClick={() => act("scan")} />
</Section>
);
}
return (
<Window
width={600}
height={400}
resizable>
<Window.Content scrollable>
<Section>
<Flex wrap="wrap">
<Flex.Item m="2px" basis="49%">
<Button
textAlign="center"
fluid
icon="search"
content="Scan"
onClick={() => act("scan")} />
</Flex.Item>
<Flex.Item m="2px" basis="49%" grow={1}>
<Button
textAlign="center"
fluid
icon="layer-group"
content="Show Areas"
selected={showArea}
onClick={() => setShowArea(!showArea)} />
</Flex.Item>
<Flex.Item m="2px" basis="49%">
<Button
textAlign="center"
fluid
icon="toggle-on"
content="All On"
onClick={() => act("allon")} />
</Flex.Item>
<Flex.Item m="2px" basis="49%" grow={1}>
<Button
textAlign="center"
fluid
icon="toggle-off"
content="All Off"
onClick={() => act("alloff")} />
</Flex.Item>
</Flex>
<Flex wrap="wrap">
{scrubbers.map(scrubber => (
<Flex.Item m="2px" key={scrubber.id} basis="32%">
<BigScrubber scrubber={scrubber} showArea={showArea} />
</Flex.Item>
))}
</Flex>
</Section>
</Window.Content>
</Window>
);
};
const BigScrubber = (props, context) => {
const { act } = useBackend(context);
const {
scrubber,
showArea,
} = props;
return (
<Section title={scrubber.name}>
<Button
fluid
icon="power-off"
content={scrubber.on ? "Enabled" : "Disabled"}
selected={scrubber.on}
onClick={() => act("toggle", { id: scrubber.id })} />
<LabeledList>
<LabeledList.Item label="Pressure">
{scrubber.pressure} kPa
</LabeledList.Item>
<LabeledList.Item label="Flow Rate">
{scrubber.flow_rate} L/s
</LabeledList.Item>
<LabeledList.Item label="Load">
{scrubber.load} W
</LabeledList.Item>
{showArea && (
<LabeledList.Item label="Area">
{toTitleCase(scrubber.area)}
</LabeledList.Item>
)}
</LabeledList>
</Section>
);
};