diff --git a/tgui/packages/tgui/interfaces/PreferencesMenu/MainPage.tsx b/tgui/packages/tgui/interfaces/PreferencesMenu/MainPage.tsx index 5f871210db7..2a3ef9f84f8 100644 --- a/tgui/packages/tgui/interfaces/PreferencesMenu/MainPage.tsx +++ b/tgui/packages/tgui/interfaces/PreferencesMenu/MainPage.tsx @@ -2,6 +2,9 @@ import { filterMap, sortBy } from 'common/collections'; import { classes } from 'common/react'; import { useState } from 'react'; +import { filter } from '../../../common/collections'; +import { flow } from '../../../common/fp'; +import { createSearch } from '../../../common/string'; import { sendAct, useBackend } from '../../backend'; import { Autofocus, @@ -9,6 +12,7 @@ import { Button, Dropdown, // NOVA EDIT ADDITION Flex, + Input, LabeledList, Popper, Stack, @@ -115,6 +119,7 @@ const ChoicedSelection = (props: { const { act } = useBackend(); const { catalog, supplementalFeature, supplementalValue } = props; + const [getSearchText, searchTextSet] = useState(''); if (!catalog.icons) { return Provided catalog had no icons!; @@ -170,39 +175,49 @@ const ChoicedSelection = (props: { + searchTextSet(value)} + /> - {Object.entries(catalog.icons).map(([name, image], index) => { - return ( - - - - ); - })} + + + ); + }, + )} @@ -211,6 +226,11 @@ const ChoicedSelection = (props: { ); }; +const searchInCatalog = (searchText = '', catalog: Record) => { + const maybeSearch = createSearch(searchText, ([name, _icon]) => name); + return flow([searchText && filter(maybeSearch)])(Object.entries(catalog)); +}; + const GenderButton = (props: { handleSetGender: (gender: Gender) => void; gender: Gender;