Files
fulpstation/tgui-next/packages/tgui/interfaces/VaultController.js
skoglol f87db2b114 tgui-next: Tank, spaceheater and some touchups (#47887)
* Tank + spaceheater + touchups

* Mint update
2019-11-21 02:25:40 -08:00

36 lines
1.0 KiB
JavaScript

import { toFixed } from 'common/math';
import { act } from '../byond';
import { Button, LabeledList, ProgressBar, Section } from '../components';
export const VaultController = props => {
const { state } = props;
const { config, data } = state;
const { ref } = config;
return (
<Section
title="Lock Status: "
buttons={(
<Button
content={data.doorstatus ? 'Locked' : 'Unlocked'}
icon={data.doorstatus ? 'lock' : 'unlock'}
disabled={data.stored < data.max}
onClick={() => act(ref, 'togglelock')}
/>
)}>
<LabeledList>
<LabeledList.Item label="Charge">
<ProgressBar
value={data.stored / data.max}
content={toFixed(data.stored/1000) + ' / ' + data.max/1000 + ' kW'}
ranges={{
good: [1, Infinity],
average: [0.30, 1],
bad: [-Infinity, 0.30],
}}
/>
</LabeledList.Item>
</LabeledList>
</Section>
);
};