mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-17 05:32:27 +00:00
- SmartFridge has been tweaked to look better - ChemMaster no longer puts the units in bottle names by default - Trinary filter reads last_flow_rate again - Operating computer now works based off percentage of health, rather than real health (note, a tesh at -50 won't die until -100, but it'll trigger the -100% alarm) - Clicking on the knob in the canister UI no longer brings up a number input too small to enter values in the valid range. For right now, the knob stays, but this may be reconsidered in favor of a NumberInput if more people would prefer accessibility over skeuomorphism UI design. - Pipe dispenser has a bent pipe option again
87 lines
3.0 KiB
JavaScript
87 lines
3.0 KiB
JavaScript
import { map } from 'common/collections';
|
|
import { useBackend } from '../backend';
|
|
import { Button, Box, NoticeBox, Section, Table } from '../components';
|
|
import { Window } from '../layouts';
|
|
|
|
export const SmartVend = (props, context) => {
|
|
const { act, config, data } = useBackend(context);
|
|
return (
|
|
<Window
|
|
width={440}
|
|
height={550}
|
|
resizable>
|
|
<Window.Content scrollable>
|
|
<Section title="Storage">
|
|
{data.secure && (
|
|
<NoticeBox danger={data.locked === -1} info={data.locked !== -1}>
|
|
{data.locked === -1 ? (
|
|
<Box>Sec.re ACC_** //):securi_nt.diag=>##'or 1=1'%($...</Box>
|
|
) : (
|
|
<Box>Secure Access: Please have your identification ready.</Box>
|
|
)}
|
|
</NoticeBox>
|
|
) || null}
|
|
{data.contents.length === 0 && (
|
|
<NoticeBox>
|
|
Unfortunately, this {config.title} is empty.
|
|
</NoticeBox>
|
|
) || (
|
|
<Table>
|
|
<Table.Row header>
|
|
<Table.Cell collapsing>
|
|
Item
|
|
</Table.Cell>
|
|
<Table.Cell collapsing textAlign="center">
|
|
Amount
|
|
</Table.Cell>
|
|
<Table.Cell collapsing textAlign="center">
|
|
Dispense
|
|
</Table.Cell>
|
|
</Table.Row>
|
|
{map((value, key) => (
|
|
<Table.Row key={key}>
|
|
<Table.Cell collapsing>
|
|
{value.name}
|
|
</Table.Cell>
|
|
<Table.Cell collapsing textAlign="center">
|
|
{value.amount} in stock
|
|
</Table.Cell>
|
|
<Table.Cell collapsing>
|
|
<Button
|
|
content="1"
|
|
disabled={value.amount < 1}
|
|
onClick={() => act('Release', {
|
|
index: value.index,
|
|
amount: 1,
|
|
})} />
|
|
<Button
|
|
content="5"
|
|
disabled={value.amount < 5}
|
|
onClick={() => act('Release', {
|
|
index: value.index,
|
|
amount: 5,
|
|
})} />
|
|
<Button
|
|
content="Custom"
|
|
disabled={value.amount < 1}
|
|
onClick={() => act('Release', {
|
|
index: value.index,
|
|
})} />
|
|
<Button
|
|
content="All"
|
|
disabled={value.amount < 1}
|
|
onClick={() => act('Release', {
|
|
index: value.index,
|
|
amount: value.amount,
|
|
})} />
|
|
</Table.Cell>
|
|
</Table.Row>
|
|
))(data.contents)}
|
|
</Table>
|
|
)}
|
|
</Section>
|
|
</Window.Content>
|
|
</Window>
|
|
);
|
|
};
|