copypaste phase complete, major:vendies

This commit is contained in:
Letter N
2020-07-30 14:17:35 +08:00
parent 10fefca674
commit 782e3c2ffb
7 changed files with 139 additions and 89 deletions

View File

@@ -5,51 +5,85 @@ import { Window } from '../layouts';
export const ChemPress = (props, context) => {
const { act, data } = useBackend(context);
const {
pill_size,
pill_name,
current_volume,
product_name,
pill_style,
pill_styles = [],
product,
min_volume,
max_volume,
} = data;
return (
<Window>
<Window
width={300}
height={227}>
<Window.Content>
<Section>
<LabeledList>
<LabeledList.Item label="Pill Volume">
<LabeledList.Item label="Product">
<Button.Checkbox
content="Pills"
checked={product === "pill"}
onClick={() => act('change_product', {
product: "pill",
})}
/>
<Button.Checkbox
content="Patches"
checked={product === "patch"}
onClick={() => act('change_product', {
product: "patch",
})}
/>
<Button.Checkbox
content="Bottles"
checked={product === "bottle"}
onClick={() => act('change_product', {
product: "bottle",
})}
/>
</LabeledList.Item>
<LabeledList.Item label="Volume">
<NumberInput
value={pill_size}
value={current_volume}
unit="u"
width="43px"
minValue={5}
maxValue={50}
minValue={min_volume}
maxValue={max_volume}
step={1}
stepPixelSize={2}
onChange={(e, value) => act('change_pill_size', {
onChange={(e, value) => act('change_current_volume', {
volume: value,
})} />
</LabeledList.Item>
<LabeledList.Item label="Pill Name">
<LabeledList.Item label="Name">
<Input
value={pill_name}
onChange={(e, value) => act('change_pill_name', {
value={product_name}
placeholder={product_name}
onChange={(e, value) => act('change_product_name', {
name: value,
})} />
<Box as="span">
{product}
</Box>
</LabeledList.Item>
<LabeledList.Item label="Pill Style">
{pill_styles.map(pill => (
<Button
key={pill.id}
width="30px"
selected={pill.id === pill_style}
textAlign="center"
color="transparent"
onClick={() => act('change_pill_style', {
id: pill.id,
})}>
<Box mx={-1} className={pill.class_name} />
</Button>
))}
</LabeledList.Item>
{product === "pill" && (
<LabeledList.Item label="Style">
{pill_styles.map(pill => (
<Button
key={pill.id}
width="30px"
selected={pill.id === pill_style}
textAlign="center"
color="transparent"
onClick={() => act('change_pill_style', {
id: pill.id,
})}>
<Box mx={-1} className={pill.class_name} />
</Button>
))}
</LabeledList.Item>
)}
</LabeledList>
</Section>
</Window.Content>