From 7c729de800d3dfebb93465adbd7f519b6c421583 Mon Sep 17 00:00:00 2001 From: Elvy <88881326+EepyElvyra@users.noreply.github.com> Date: Sun, 5 Jan 2025 02:25:04 +0100 Subject: [PATCH] make searching from modal work --- .../components/SettingArrayComponent.tsx | 104 ++++++++++++++++-- 1 file changed, 93 insertions(+), 11 deletions(-) diff --git a/src/components/PluginSettings/components/SettingArrayComponent.tsx b/src/components/PluginSettings/components/SettingArrayComponent.tsx index 0c574dd64..81aba533c 100644 --- a/src/components/PluginSettings/components/SettingArrayComponent.tsx +++ b/src/components/PluginSettings/components/SettingArrayComponent.tsx @@ -7,13 +7,14 @@ import { classNameFactory } from "@api/Styles"; import ErrorBoundary from "@components/ErrorBoundary"; import { Flex } from "@components/Flex"; +import { debounce } from "@shared/debounce"; import { Margins } from "@utils/margins"; +import { closeModal, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal"; import { wordsFromCamel, wordsToTitle } from "@utils/text"; import { OptionType, PluginOptionList } from "@utils/types"; -import { findByCodeLazy, findComponentByCodeLazy } from "@webpack"; -import { Avatar, Button, ChannelStore, Forms, GuildStore, IconUtils, React, Text, TextInput, useEffect, useState } from "@webpack/common"; +import { findByCodeLazy, findByPropsLazy, findComponentByCodeLazy } from "@webpack"; +import { Avatar, Button, ChannelStore, Forms, GuildStore, IconUtils, React, Text, TextInput, useCallback, useEffect, useRef, useState } from "@webpack/common"; import { Channel, Guild } from "discord-types/general"; -import { JSX } from "react"; import { ISettingElementProps } from "."; @@ -22,9 +23,9 @@ const cl = classNameFactory("vc-plugin-modal-"); const UserMentionComponent = findComponentByCodeLazy(".USER_MENTION)"); const getDMChannelIcon = findByCodeLazy(".getChannelIconURL({"); const GroupDMAvatars = findComponentByCodeLazy(".AvatarSizeSpecs[", "getAvatarURL"); - -const SearchBar = findComponentByCodeLazy("focus(){let{current:"); - +const SearchBarModule = findByPropsLazy("SearchBar", "Checkbox"); +const SearchBarWrapper = findByPropsLazy("SearchBar", "Item"); +const SearchHandler = findByCodeLazy("createSearchContext", "setLimit"); const CloseIcon = () => { return