1
0
Fork 1
mirror of https://github.com/Vendicated/Vencord.git synced 2025-01-10 18:06:22 +00:00

fix click issues

This commit is contained in:
programminglaboratorys 2024-10-01 18:01:18 +03:00
parent f1aba76502
commit 4fc7f6e453
2 changed files with 7 additions and 6 deletions

View file

@ -54,15 +54,15 @@ const EmojiComponent = findComponentByCodeLazy(".translateSurrogatesToInlineEmoj
const customStatusSettings = getUserSettingLazy("status", "customStatus"); const customStatusSettings = getUserSettingLazy("status", "customStatus");
const ClearStatusButton = () => <Clickable className={StatusStyles.clearCustomStatusHint} onClick={() => customStatusSettings?.updateSetting(null)}><Icons.CircleXIcon size="sm" style={{ pointerEvents: "none" }} /></Clickable>; const ClearStatusButton = () => <Clickable className={StatusStyles.clearCustomStatusHint} onClick={e => { e.stopPropagation(); customStatusSettings?.updateSetting(null); }}><Icons.CircleXIcon size="sm" /></Clickable>;
function StatusIcon({ isHovering, status }: { isHovering: boolean; status: DiscordStatus; }) { function StatusIcon({ isHovering, status }: { isHovering: boolean; status: DiscordStatus; }) {
return <div className={StatusStyles.status}>{isHovering ? return <div className={StatusStyles.status}>{isHovering ?
<Icons.CircleXIcon size="sm" style={{ pointerEvents: "none" }} /> <Icons.CircleXIcon size="sm" />
: (status.emojiInfo != null ? <EmojiComponent emoji={status.emojiInfo} animate={false} hideTooltip={false} /> : <div className={StatusStyles.customEmojiPlaceholder} />)}</div>; : (status.emojiInfo != null ? <EmojiComponent emoji={status.emojiInfo} animate={false} hideTooltip={false} /> : <div className={StatusStyles.customEmojiPlaceholder} />)}</div>;
} }
const RenderStatusMenuItem = ({ status, forceRerender }: { status: DiscordStatus; forceRerender: ()=>void}) => { const RenderStatusMenuItem = ({ status, forceRerender }: { status: DiscordStatus; forceRerender: () => void; }) => {
const [isHovering, setIsHovering] = useState(false); const [isHovering, setIsHovering] = useState(false);
const handleMouseOver = () => { const handleMouseOver = () => {
setIsHovering(true); setIsHovering(true);
@ -80,7 +80,8 @@ const RenderStatusMenuItem = ({ status, forceRerender }: { status: DiscordStatus
onMouseOver={handleMouseOver} onMouseOver={handleMouseOver}
onMouseOut={handleMouseOut}> onMouseOut={handleMouseOut}>
<Clickable <Clickable
onClick={() => { onClick={e => {
e.stopPropagation();
delete settings.store.StatusPresets[status.text]; delete settings.store.StatusPresets[status.text];
forceRerender(); forceRerender();
Toasts.show({ Toasts.show({
@ -157,7 +158,7 @@ export default definePlugin({
look={Button.Looks.LINK} look={Button.Looks.LINK}
color={Button.Colors.WHITE} color={Button.Colors.WHITE}
size={Button.Sizes.MEDIUM} size={Button.Sizes.MEDIUM}
onClick={() => { onClick={e => {
settings.store.StatusPresets[statue.text] = statue; settings.store.StatusPresets[statue.text] = statue;
Toasts.show({ Toasts.show({
message: "Successfully Saved Status", message: "Successfully Saved Status",

View file

@ -477,7 +477,7 @@ export type Clickable = ComponentType<PropsWithChildren<{
href?: string; href?: string;
ignoreKeyPress?: boolean; ignoreKeyPress?: boolean;
onClick?(): void; onClick?(e: React.MouseEvent<any>): void;
onKeyPress?(): void; onKeyPress?(): void;
}>>; }>>;