mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-01-05 15:04:21 +00:00
Bundle Copy
This commit is contained in:
31
tgui/packages/tgui_ch/interfaces/FileCabinet.js
Normal file
31
tgui/packages/tgui_ch/interfaces/FileCabinet.js
Normal file
@@ -0,0 +1,31 @@
|
||||
import { sortBy } from 'common/collections';
|
||||
import { useBackend } from '../backend';
|
||||
import { Button, Section } from '../components';
|
||||
import { Window } from '../layouts';
|
||||
|
||||
export const FileCabinet = (props, context) => {
|
||||
const { act, data } = useBackend(context);
|
||||
|
||||
const { contents } = data;
|
||||
|
||||
// Wow, the filing cabinets sort themselves in 2320.
|
||||
const sortedContents = sortBy((val) => val.name)(contents || []);
|
||||
|
||||
return (
|
||||
<Window width={350} height={300} resizable>
|
||||
<Window.Content scrollable>
|
||||
<Section>
|
||||
{sortedContents.map((item) => (
|
||||
<Button
|
||||
key={item.ref}
|
||||
fluid
|
||||
icon="file"
|
||||
content={item.name}
|
||||
onClick={() => act('retrieve', { ref: item.ref })}
|
||||
/>
|
||||
))}
|
||||
</Section>
|
||||
</Window.Content>
|
||||
</Window>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user