SMYN: Filter modal fix. (#1339)
* Filter modal fix. * Filter modal fix. * [autofix.ci] apply automated fixes * Filter modal fix. --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
436e938244
commit
99c4535b4d
1 changed files with 22 additions and 5 deletions
|
|
@ -16,7 +16,7 @@ import { Heading } from "@components/Heading";
|
||||||
import ircColors from "@plugins/ircColors";
|
import ircColors from "@plugins/ircColors";
|
||||||
import mentionAvatars from "@plugins/mentionAvatars";
|
import mentionAvatars from "@plugins/mentionAvatars";
|
||||||
import { Devs, EquicordDevs } from "@utils/constants";
|
import { Devs, EquicordDevs } from "@utils/constants";
|
||||||
import { getCurrentChannel } from "@utils/discord";
|
import { getCurrentChannel, getCurrentGuild } from "@utils/discord";
|
||||||
import { classNameFactory } from "@utils/index";
|
import { classNameFactory } from "@utils/index";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { GuildMember, Message, RenderModalProps, User } from "@vencord/discord-types";
|
import { GuildMember, Message, RenderModalProps, User } from "@vencord/discord-types";
|
||||||
|
|
@ -385,7 +385,7 @@ interface messageProps {
|
||||||
|
|
||||||
interface memberListProfileReactionProps {
|
interface memberListProfileReactionProps {
|
||||||
user: User | null | undefined;
|
user: User | null | undefined;
|
||||||
type: "typingIndicator" | "membersList" | "profilesPopout" | "profilesTooltip" | "reactionsTooltip" | "reactionsPopout" | "voiceChannel" | "searchAutocomplete";
|
type: "typingIndicator" | "membersList" | "profilesPopout" | "profilesTooltip" | "reactionsTooltip" | "reactionsPopout" | "voiceChannel" | "searchAutocomplete" | "searchAutocompleteDropdown";
|
||||||
guildId?: string;
|
guildId?: string;
|
||||||
tags?: any;
|
tags?: any;
|
||||||
isHovered?: boolean;
|
isHovered?: boolean;
|
||||||
|
|
@ -399,6 +399,14 @@ interface activeNowNameProps {
|
||||||
|
|
||||||
type colorStringsType = { primaryColor: string | null, secondaryColor: string | null, tertiaryColor: string | null; } | null | undefined;
|
type colorStringsType = { primaryColor: string | null, secondaryColor: string | null, tertiaryColor: string | null; } | null | undefined;
|
||||||
|
|
||||||
|
function wrapFilterResults(options: { id: string, label: string; }[]) {
|
||||||
|
return options.map(item => {
|
||||||
|
const name = getTypingMemberListProfilesReactionsVoiceNameText({ user: UserStore.getUser(item.id), guildId: getCurrentGuild()?.id, type: "searchAutocompleteDropdown" });
|
||||||
|
item.label = name ?? item.label;
|
||||||
|
return item;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function addCustomNameResults(
|
function addCustomNameResults(
|
||||||
results: SearchUserResult[],
|
results: SearchUserResult[],
|
||||||
{ currentToken, maxResults = 10, searchContext }: SearchAutocompleteProps
|
{ currentToken, maxResults = 10, searchContext }: SearchAutocompleteProps
|
||||||
|
|
@ -457,7 +465,7 @@ function getTypingMemberListProfilesReactionsVoiceName(
|
||||||
const guildId = props.guildId || props.tags?.props?.displayProfile?.guildId || null;
|
const guildId = props.guildId || props.tags?.props?.displayProfile?.guildId || null;
|
||||||
const member = guildId && user ? GuildMemberStore.getMember(guildId, user.id) : null;
|
const member = guildId && user ? GuildMemberStore.getMember(guildId, user.id) : null;
|
||||||
const author = user && member ? { ...user, ...member } : user || member || null;
|
const author = user && member ? { ...user, ...member } : user || member || null;
|
||||||
const shouldHookless = ["typingIndicator", "reactionsTooltip", "profilesTooltip"].includes(type);
|
const shouldHookless = ["typingIndicator", "reactionsTooltip", "profilesTooltip", "searchAutocompleteDropdown"].includes(type);
|
||||||
return renderUsername(author, null, null, type, "", shouldHookless, !!guildId, undefined, undefined, props.isHovered);
|
return renderUsername(author, null, null, type, "", shouldHookless, !!guildId, undefined, undefined, props.isHovered);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -664,7 +672,7 @@ function renderUsername(
|
||||||
author: User | GuildMember | null,
|
author: User | GuildMember | null,
|
||||||
channelId: string | null,
|
channelId: string | null,
|
||||||
messageId: string | null,
|
messageId: string | null,
|
||||||
type: "messages" | "replies" | "typingIndicator" | "mentions" | "membersList" | "profilesPopout" | "profilesTooltip" | "reactionsTooltip" | "reactionsPopout" | "voiceChannel" | "searchAutocomplete",
|
type: "messages" | "replies" | "typingIndicator" | "mentions" | "membersList" | "profilesPopout" | "profilesTooltip" | "reactionsTooltip" | "reactionsPopout" | "voiceChannel" | "searchAutocomplete" | "searchAutocompleteDropdown",
|
||||||
mentionSymbol: string,
|
mentionSymbol: string,
|
||||||
hookless: boolean,
|
hookless: boolean,
|
||||||
inGuild: boolean,
|
inGuild: boolean,
|
||||||
|
|
@ -677,7 +685,7 @@ function renderUsername(
|
||||||
const isMention = type === "mentions";
|
const isMention = type === "mentions";
|
||||||
const isTyping = type === "typingIndicator";
|
const isTyping = type === "typingIndicator";
|
||||||
const isMember = type === "membersList";
|
const isMember = type === "membersList";
|
||||||
const isAutocomplete = type === "searchAutocomplete";
|
const isAutocomplete = ["searchAutocomplete", "searchAutocompleteDropdown"].includes(type);
|
||||||
const isProfile = type === "profilesPopout";
|
const isProfile = type === "profilesPopout";
|
||||||
const isReactionsPopout = type === "reactionsPopout";
|
const isReactionsPopout = type === "reactionsPopout";
|
||||||
const isReactionsTooltip = type === "reactionsTooltip";
|
const isReactionsTooltip = type === "reactionsTooltip";
|
||||||
|
|
@ -1628,6 +1636,14 @@ export default definePlugin({
|
||||||
replace: '$1=$self.getTypingMemberListProfilesReactionsVoiceNameText({user:$4,guildId:$3,type:"searchAutocomplete"})??$2'
|
replace: '$1=$self.getTypingMemberListProfilesReactionsVoiceNameText({user:$4,guildId:$3,type:"searchAutocomplete"})??$2'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
// Replace names in the popup modal search filter suggestions.
|
||||||
|
find: "selectionMode:\"single\",formatOption",
|
||||||
|
replacement: {
|
||||||
|
match: /(?<=trailing:\i}},options:)(\i)(,placeholder)/,
|
||||||
|
replace: "$self.wrapFilterResults($1)$2"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
// Replace names in the mention autocomplete.
|
// Replace names in the mention autocomplete.
|
||||||
find: "#{intl::COMMANDS_OPTIONAL_COUNT}",
|
find: "#{intl::COMMANDS_OPTIONAL_COUNT}",
|
||||||
|
|
@ -1689,4 +1705,5 @@ export default definePlugin({
|
||||||
getTypingMemberListProfilesReactionsVoiceNameElement,
|
getTypingMemberListProfilesReactionsVoiceNameElement,
|
||||||
matchableCustomName,
|
matchableCustomName,
|
||||||
addCustomNameResults,
|
addCustomNameResults,
|
||||||
|
wrapFilterResults,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue