diff --git a/tgui/packages/tgui/interfaces/Vending.jsx b/tgui/packages/tgui/interfaces/Vending.jsx
index 6947330ecf..82f5c9be07 100644
--- a/tgui/packages/tgui/interfaces/Vending.jsx
+++ b/tgui/packages/tgui/interfaces/Vending.jsx
@@ -1,7 +1,19 @@
+import { filter } from 'common/collections';
+import { flow } from 'common/fp';
import { classes } from 'common/react';
+import { createSearch } from 'common/string';
+import { useState } from 'react';
import { useBackend } from '../backend';
-import { Box, Button, Section, Table, Tooltip } from '../components';
+import {
+ Box,
+ Button,
+ Icon,
+ Input,
+ Section,
+ Table,
+ Tooltip,
+} from '../components';
import { Window } from '../layouts';
const VendingRow = (props) => {
@@ -9,7 +21,7 @@ const VendingRow = (props) => {
const { actively_vending } = data;
const { product } = props;
return (
-
+
{(product.isatom && (
{
export const Vending = (props) => {
const { act, data } = useBackend();
const { panel } = data;
+ const [searchText, setSearchText] = useState('');
+
+ function handleSearchText(value) {
+ setSearchText(value);
+ }
return (
-
+
{panel ? : null}
@@ -79,6 +96,7 @@ export const VendingProducts = (props) => {
// Just in case we still have undefined values in the list
let myproducts = products.filter((item) => !!item);
+ myproducts = prepareSearch(myproducts, props.searchText);
return (
<>
{!!chargesMoney && (
@@ -93,9 +111,21 @@ export const VendingProducts = (props) => {
)}
+
{myproducts.map((product) => (
-
+
))}
@@ -135,3 +165,15 @@ export const VendingMaintenance = (props) => {
);
};
+
+/**
+ * Search box
+ */
+export const prepareSearch = (products, searchText = '') => {
+ const testSearch =
+ createSearch < ProductRecord > (searchText, (product) => product.name);
+ return flow([
+ // Optional search term
+ searchText && filter(testSearch),
+ ])(products);
+};