mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-09 14:43:03 -04:00
BetterBlockedUsers: Show User Profile Button
This commit is contained in:
parent
70ade989e6
commit
b60a69adac
1 changed files with 16 additions and 1 deletions
|
@ -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;
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue