mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-10 01:49:19 +00:00
73 lines
2.1 KiB
JavaScript
73 lines
2.1 KiB
JavaScript
import { Fragment } from 'inferno';
|
|
import { useBackend } from '../backend';
|
|
import { Box, Button, LabeledList, Section, NoticeBox } from '../components';
|
|
import { Window } from '../layouts';
|
|
|
|
export const Wires = (props, context) => {
|
|
const { act, data } = useBackend(context);
|
|
const { proper_name } = data;
|
|
const wires = data.wires || [];
|
|
const statuses = data.status || [];
|
|
return (
|
|
<Window
|
|
width={350}
|
|
height={150
|
|
+ (wires.length * 30)
|
|
+ (!!proper_name && 30)}>
|
|
<Window.Content>
|
|
{(!!proper_name && (
|
|
<NoticeBox textAlign="center">
|
|
{proper_name} Wire Configuration
|
|
</NoticeBox>
|
|
))}
|
|
<Section>
|
|
<LabeledList>
|
|
{wires.map(wire => (
|
|
<LabeledList.Item
|
|
key={wire.color}
|
|
className="candystripe"
|
|
label={wire.color}
|
|
labelColor={wire.color}
|
|
color={wire.color}
|
|
buttons={(
|
|
<Fragment>
|
|
<Button
|
|
content={wire.cut ? 'Mend' : 'Cut'}
|
|
onClick={() => act('cut', {
|
|
wire: wire.color,
|
|
})} />
|
|
<Button
|
|
content="Pulse"
|
|
onClick={() => act('pulse', {
|
|
wire: wire.color,
|
|
})} />
|
|
<Button
|
|
content={wire.attached ? 'Detach' : 'Attach'}
|
|
onClick={() => act('attach', {
|
|
wire: wire.color,
|
|
})} />
|
|
</Fragment>
|
|
)}>
|
|
{!!wire.wire && (
|
|
<i>
|
|
({wire.wire})
|
|
</i>
|
|
)}
|
|
</LabeledList.Item>
|
|
))}
|
|
</LabeledList>
|
|
</Section>
|
|
{!!statuses.length && (
|
|
<Section>
|
|
{statuses.map(status => (
|
|
<Box key={status}>
|
|
{status}
|
|
</Box>
|
|
))}
|
|
</Section>
|
|
)}
|
|
</Window.Content>
|
|
</Window>
|
|
);
|
|
};
|