From 1170b30fc806183045ee460f55924f29d4dd9506 Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Thu, 23 Oct 2025 20:53:32 -0400 Subject: [PATCH] FriendTags: Specify Search Tag --- src/equicordplugins/friendTags/index.tsx | 72 ++++++++++--------- .../youtubeMusic/PlayerComponent.tsx | 2 +- 2 files changed, 39 insertions(+), 35 deletions(-) diff --git a/src/equicordplugins/friendTags/index.tsx b/src/equicordplugins/friendTags/index.tsx index 913d025a6..d718dd3f1 100644 --- a/src/equicordplugins/friendTags/index.tsx +++ b/src/equicordplugins/friendTags/index.tsx @@ -16,6 +16,12 @@ import { useForceUpdater } from "@utils/react"; import definePlugin, { OptionType } from "@utils/types"; import { Button, ChannelStore, Menu, RelationshipStore, TextInput, useEffect, UserStore, useState } from "@webpack/common"; +interface UserTagData { + tagName: string; + userIds: string[]; +} + +let SavedData: UserTagData[] = []; const tagStoreName = "vc-friendtags-tags"; function parseUsertags(text: string): string[] { @@ -30,7 +36,6 @@ function parseUsertags(text: string): string[] { } } - function queryFriendTags(query) { GetData(); const tags = parseUsertags(query).map(e => e.toLowerCase()); @@ -56,13 +61,6 @@ function queryFriendTags(query) { return response; } -let SavedData: UserTagData[] = []; - -interface UserTagData { - tagName: string; - userIds: string[]; -} - async function SetData() { const fetchData = await DataStore.get(tagStoreName); if (SavedData !== fetchData) { @@ -128,16 +126,21 @@ function TagConfigCard(props) { } - + ); } -function TagConfigurationComponent() { +function TagConfigurationComponent() { const update = useForceUpdater(); return ( @@ -166,18 +169,17 @@ function TagConfigurationComponent() { } -const settings = definePluginSettings( - { - tagConfiguration: { - type: OptionType.COMPONENT, - description: "The tag configuration component", - component: () => { - return ( - - ); - } +const settings = definePluginSettings({ + tagConfiguration: { + type: OptionType.COMPONENT, + description: "The tag configuration component", + component: () => { + return ( + + ); } - }); + } +}); function UserToTagID(user, tag, remove) { if (remove) { @@ -200,22 +202,27 @@ const userPatch: NavContextMenuPatchCallback = (children, { user }) => { const isTagged = SavedData.filter(e => e.tagName === tag.tagName)[0].userIds.includes(user.id); return ( - { UserToTagID(user.id, tag.tagName, isTagged); }} /> + { UserToTagID(user.id, tag.tagName, isTagged); }} + /> ); })} ; children.push({ ...buttonElement }); - }; - export default definePlugin({ name: "FriendTags", - description: "Allows you to filter by custom tags in the quick switcher", + description: "Allows you to filter by custom tags in the quick switcher by starting a search with &", authors: [Devs.Samwich], settings, - queryFriendTags: queryFriendTags, + contextMenus: { + "user-context": userPatch + }, patches: [ { find: "#{intl::QUICKSWITCHER_PLACEHOLDER}", @@ -228,8 +235,5 @@ export default definePlugin({ async start() { GetData(); }, - contextMenus: - { - "user-context": userPatch - } + queryFriendTags, }); diff --git a/src/equicordplugins/musicControls/youtubeMusic/PlayerComponent.tsx b/src/equicordplugins/musicControls/youtubeMusic/PlayerComponent.tsx index 0faf0a008..fa315c280 100644 --- a/src/equicordplugins/musicControls/youtubeMusic/PlayerComponent.tsx +++ b/src/equicordplugins/musicControls/youtubeMusic/PlayerComponent.tsx @@ -128,7 +128,7 @@ function Controls() { return (