mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-08 14:13:01 -04:00
Fix Broken Patch + Remove @ From MentionAvatars
This commit is contained in:
parent
9a0acbd72d
commit
cdba643226
2 changed files with 20 additions and 7 deletions
|
@ -6,17 +6,25 @@
|
||||||
|
|
||||||
import "./styles.css";
|
import "./styles.css";
|
||||||
|
|
||||||
|
import { definePluginSettings } from "@api/Settings";
|
||||||
import ErrorBoundary from "@components/ErrorBoundary";
|
import ErrorBoundary from "@components/ErrorBoundary";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import definePlugin from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { SelectedGuildStore, useState } from "@webpack/common";
|
import { SelectedGuildStore, useState } from "@webpack/common";
|
||||||
import { User } from "discord-types/general";
|
import { User } from "discord-types/general";
|
||||||
|
|
||||||
|
export const settings = definePluginSettings({
|
||||||
|
hideAtSymbol: {
|
||||||
|
type: OptionType.BOOLEAN,
|
||||||
|
description: "Whether the the @-symbol should be hidden.",
|
||||||
|
default: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "MentionAvatars",
|
name: "MentionAvatars",
|
||||||
description: "Shows user avatars inside mentions",
|
description: "Shows user avatars inside mentions",
|
||||||
authors: [Devs.Ven],
|
authors: [Devs.Ven, Devs.Luna],
|
||||||
|
|
||||||
patches: [{
|
patches: [{
|
||||||
find: ".USER_MENTION)",
|
find: ".USER_MENTION)",
|
||||||
replacement: {
|
replacement: {
|
||||||
|
@ -24,12 +32,12 @@ export default definePlugin({
|
||||||
replace: "children:$self.renderUsername({username:$1,user:$2})"
|
replace: "children:$self.renderUsername({username:$1,user:$2})"
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
|
settings,
|
||||||
renderUsername: ErrorBoundary.wrap((props: { user: User, username: string; }) => {
|
renderUsername: ErrorBoundary.wrap((props: { user: User, username: string; }) => {
|
||||||
const { user, username } = props;
|
const { user, username } = props;
|
||||||
const [isHovering, setIsHovering] = useState(false);
|
const [isHovering, setIsHovering] = useState(false);
|
||||||
|
|
||||||
if (!user) return <>@{username}</>;
|
if (!user) return <>{getUsernameString(username)}</>;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<span
|
<span
|
||||||
|
@ -37,8 +45,13 @@ export default definePlugin({
|
||||||
onMouseLeave={() => setIsHovering(false)}
|
onMouseLeave={() => setIsHovering(false)}
|
||||||
>
|
>
|
||||||
<img src={user.getAvatarURL(SelectedGuildStore.getGuildId(), 16, isHovering)} className="vc-mentionAvatars-avatar" />
|
<img src={user.getAvatarURL(SelectedGuildStore.getGuildId(), 16, isHovering)} className="vc-mentionAvatars-avatar" />
|
||||||
@{username}
|
{getUsernameString(username)}
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
}, { noop: true })
|
}, { noop: true })
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function getUsernameString(username: string) {
|
||||||
|
if (settings.store.hideAtSymbol) return username;
|
||||||
|
return `@${username}`;
|
||||||
|
}
|
||||||
|
|
|
@ -307,7 +307,7 @@ export default definePlugin({
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
find: '+1]})},"overflow"))',
|
find: '})},"overflow"))',
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
// Create a variable for the channel prop
|
// Create a variable for the channel prop
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue