Files
CHOMPStation2/tgui/packages/tgui_ch/interfaces/InventoryPanelHuman.jsx
CHOMPStation2 85ca379bb2 [MIRROR] [TGUI 5.0 Prep] JS to JSX (#7414)
Co-authored-by: Selis <sirlionfur@hotmail.de>
Co-authored-by: Selis <selis@xynolabs.com>
2023-12-13 23:23:03 +01:00

119 lines
3.3 KiB
JavaScript

import { useBackend } from '../backend';
import { Button, LabeledList, Section } from '../components';
import { Window } from '../layouts';
export const InventoryPanelHuman = (props, context) => {
const { act, data } = useBackend(context);
const {
slots,
specialSlots,
internals,
internalsValid,
sensors,
handcuffed,
handcuffedParams,
legcuffed,
legcuffedParams,
accessory,
} = data;
return (
<Window width={400} height={600} resizable>
<Window.Content scrollable>
<Section>
<LabeledList>
{slots &&
slots.length &&
slots.map((slot) => (
<LabeledList.Item key={slot.name} label={slot.name}>
<Button
mb={-1}
icon={slot.item ? 'hand-paper' : 'gift'}
onClick={() => act(slot.act, slot.params)}>
{slot.item || 'Nothing'}
</Button>
</LabeledList.Item>
))}
<LabeledList.Divider />
{specialSlots &&
specialSlots.length &&
specialSlots.map((slot) => (
<LabeledList.Item key={slot.name} label={slot.name}>
<Button
mb={-1}
icon={slot.item ? 'hand-paper' : 'gift'}
onClick={() => act(slot.act, slot.params)}>
{slot.item || 'Nothing'}
</Button>
</LabeledList.Item>
))}
</LabeledList>
</Section>
<Section title="Actions">
<Button
fluid
icon="running"
onClick={() => act('targetSlot', { slot: 'splints' })}>
Remove Splints
</Button>
<Button
fluid
icon="hand-paper"
onClick={() => act('targetSlot', { slot: 'pockets' })}>
Empty Pockets
</Button>
{(internalsValid && (
<Button
fluid
icon="lungs"
onClick={() => act('targetSlot', { slot: 'internals' })}>
Set Internals
</Button>
)) ||
null}
{(sensors && (
<Button
fluid
icon="book-medical"
onClick={() => act('targetSlot', { slot: 'sensors' })}>
Set Sensors
</Button>
)) ||
null}
{(handcuffed && (
<Button
fluid
color="bad"
icon="unlink"
onClick={() => act('targetSlot', handcuffedParams)}>
Handcuffed
</Button>
)) ||
null}
{(legcuffed && (
<Button
fluid
color="bad"
icon="unlink"
onClick={() => act('targetSlot', legcuffedParams)}>
Legcuffed
</Button>
)) ||
null}
{(accessory && (
<Button
fluid
color="bad"
icon="unlink"
onClick={() => act('targetSlot', { slot: 'tie' })}>
Remove Accessory
</Button>
)) ||
null}
</Section>
</Window.Content>
</Window>
);
};