BetterBlockedUsers: Show User Profile Button
Some checks are pending
Release / Build Equicord (push) Waiting to run
Sync to Codeberg / Sync Codeberg and Github (push) Waiting to run
Test / Test (push) Waiting to run

This commit is contained in:
thororen1234 2025-03-11 17:08:35 -04:00
parent 70ade989e6
commit b60a69adac
No known key found for this signature in database

View file

@ -7,8 +7,9 @@
import "./styles.css";
import { EquicordDevs } from "@utils/constants";
import { getIntlMessage, openUserProfile } from "@utils/discord";
import definePlugin from "@utils/types";
import { React, RelationshipStore, TextInput, UserStore } from "@webpack/common";
import { Button, React, RelationshipStore, TextInput, UserStore } from "@webpack/common";
let lastSearch = "";
let updateFunc = (v: any) => { };
@ -25,6 +26,10 @@ export default definePlugin({
match: /(?<=\}=(\i).*?\]\}\))/,
replace: ",$1.listType==='blocked'?$self.renderSearchInput():null"
},
{
match: /(?<=userId:(\i).*?\}\)\]\}\),)(\(.*?\)\}\))/,
replace: "$self.renderUser($1,$2),",
},
{
match: /(?<=\}=(\i).{0,10}(\i).useState\(.{0,1}\);)/,
replace: "let [searchResults,setSearchResults]=$2.useState([]);$self.setUpdateFunc($1,setSearchResults);"
@ -56,6 +61,16 @@ export default definePlugin({
}} value={value}
></TextInput>;
},
renderUser(userId: string, rest: any) {
return (
<div style={{ display: "flex", gap: "8px" }}>
<Button color={Button.Colors.PRIMARY} onClick={() => openUserProfile(userId)}>
{getIntlMessage("SHOW_USER_PROFILE")}
</Button>
{rest}
</div>
);
},
getSearchResults() {
return !!lastSearch;
},