mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
import { useBackend } from '../backend';
|
|
import { Button, LabeledList, Section } from '../components';
|
|
import { Window } from '../layouts';
|
|
|
|
type Data = {
|
|
plasma;
|
|
oxygen;
|
|
};
|
|
|
|
export const TankDispenser = (props, context) => {
|
|
const { act, data } = useBackend<Data>(context);
|
|
const { plasma, oxygen } = data;
|
|
return (
|
|
<Window width={275} height={103} resizable>
|
|
<Window.Content>
|
|
<Section>
|
|
<LabeledList>
|
|
<LabeledList.Item
|
|
label="Phoron"
|
|
buttons={
|
|
<Button
|
|
icon={plasma ? 'square' : 'square-o'}
|
|
content="Dispense"
|
|
disabled={!plasma}
|
|
onClick={() => act('plasma')}
|
|
/>
|
|
}>
|
|
{plasma}
|
|
</LabeledList.Item>
|
|
<LabeledList.Item
|
|
label="Oxygen"
|
|
buttons={
|
|
<Button
|
|
icon={oxygen ? 'square' : 'square-o'}
|
|
content="Dispense"
|
|
disabled={!oxygen}
|
|
onClick={() => act('oxygen')}
|
|
/>
|
|
}>
|
|
{oxygen}
|
|
</LabeledList.Item>
|
|
</LabeledList>
|
|
</Section>
|
|
</Window.Content>
|
|
</Window>
|
|
);
|
|
};
|