mirror of
https://github.com/Equicord/Equicord.git
synced 2025-02-25 09:38:52 -05:00
Fix Constants & Merge Dev
This commit is contained in:
commit
d83abb7437
7 changed files with 161 additions and 15 deletions
|
@ -8,6 +8,7 @@ import "./style.css";
|
||||||
|
|
||||||
import { classNameFactory } from "@api/Styles";
|
import { classNameFactory } from "@api/Styles";
|
||||||
import { Button, ButtonLooks, GuildStore, useStateFromStores } from "@webpack/common";
|
import { Button, ButtonLooks, GuildStore, useStateFromStores } from "@webpack/common";
|
||||||
|
|
||||||
import { HiddenServersStore } from "../HiddenServersStore";
|
import { HiddenServersStore } from "../HiddenServersStore";
|
||||||
import { openHiddenServersModal } from "./HiddenServersMenu";
|
import { openHiddenServersModal } from "./HiddenServersMenu";
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ import {
|
||||||
openModal,
|
openModal,
|
||||||
} from "@utils/modal";
|
} from "@utils/modal";
|
||||||
import { findByPropsLazy } from "@webpack";
|
import { findByPropsLazy } from "@webpack";
|
||||||
import { Button, Forms, IconUtils, Text, useState, useStateFromStores } from "@webpack/common";
|
import { Button, Forms, IconUtils, Text, useStateFromStores } from "@webpack/common";
|
||||||
import { Guild } from "discord-types/general";
|
import { Guild } from "discord-types/general";
|
||||||
|
|
||||||
import { HiddenServersStore } from "../HiddenServersStore";
|
import { HiddenServersStore } from "../HiddenServersStore";
|
||||||
|
@ -91,7 +91,7 @@ export function HiddenServersMenu({ servers }: { servers: Guild[]; }) {
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
</div>;
|
</div>;
|
||||||
};
|
}
|
||||||
|
|
||||||
export function openHiddenServersModal() {
|
export function openHiddenServersModal() {
|
||||||
const key = openModal(modalProps => {
|
const key = openModal(modalProps => {
|
||||||
|
|
7
src/plugins/accountPanelServerProfile/README.md
Normal file
7
src/plugins/accountPanelServerProfile/README.md
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# AccountPanelServerProfile
|
||||||
|
|
||||||
|
Right click your account panel in the bottom left to view your profile in the current server
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
134
src/plugins/accountPanelServerProfile/index.tsx
Normal file
134
src/plugins/accountPanelServerProfile/index.tsx
Normal file
|
@ -0,0 +1,134 @@
|
||||||
|
/*
|
||||||
|
* Vencord, a Discord client mod
|
||||||
|
* Copyright (c) 2024 Vendicated and contributors
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { definePluginSettings } from "@api/Settings";
|
||||||
|
import ErrorBoundary from "@components/ErrorBoundary";
|
||||||
|
import { Devs } from "@utils/constants";
|
||||||
|
import { getCurrentChannel } from "@utils/discord";
|
||||||
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
|
import { findByPropsLazy, findComponentByCodeLazy } from "@webpack";
|
||||||
|
import { ContextMenuApi, Menu, useEffect, useRef } from "@webpack/common";
|
||||||
|
import { User } from "discord-types/general";
|
||||||
|
|
||||||
|
interface UserProfileProps {
|
||||||
|
popoutProps: Record<string, any>;
|
||||||
|
currentUser: User;
|
||||||
|
originalPopout: () => React.ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
const UserProfile = findComponentByCodeLazy("UserProfilePopoutWrapper: user cannot be undefined");
|
||||||
|
const styles = findByPropsLazy("accountProfilePopoutWrapper");
|
||||||
|
|
||||||
|
let openAlternatePopout = false;
|
||||||
|
let accountPanelRef: React.MutableRefObject<Record<PropertyKey, any> | null> = { current: null };
|
||||||
|
|
||||||
|
const AccountPanelContextMenu = ErrorBoundary.wrap(() => {
|
||||||
|
const { prioritizeServerProfile } = settings.use(["prioritizeServerProfile"]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Menu.Menu
|
||||||
|
navId="vc-ap-server-profile"
|
||||||
|
onClose={ContextMenuApi.closeContextMenu}
|
||||||
|
>
|
||||||
|
<Menu.MenuItem
|
||||||
|
id="vc-ap-view-alternate-popout"
|
||||||
|
label={prioritizeServerProfile ? "View Account Profile" : "View Server Profile"}
|
||||||
|
disabled={getCurrentChannel()?.getGuildId() == null}
|
||||||
|
action={e => {
|
||||||
|
openAlternatePopout = true;
|
||||||
|
accountPanelRef.current?.props.onMouseDown();
|
||||||
|
accountPanelRef.current?.props.onClick(e);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Menu.MenuCheckboxItem
|
||||||
|
id="vc-ap-prioritize-server-profile"
|
||||||
|
label="Prioritize Server Profile"
|
||||||
|
checked={prioritizeServerProfile}
|
||||||
|
action={() => settings.store.prioritizeServerProfile = !prioritizeServerProfile}
|
||||||
|
/>
|
||||||
|
</Menu.Menu>
|
||||||
|
);
|
||||||
|
}, { noop: true });
|
||||||
|
|
||||||
|
const settings = definePluginSettings({
|
||||||
|
prioritizeServerProfile: {
|
||||||
|
type: OptionType.BOOLEAN,
|
||||||
|
description: "Prioritize Server Profile when left clicking your account panel",
|
||||||
|
default: false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default definePlugin({
|
||||||
|
name: "AccountPanelServerProfile",
|
||||||
|
description: "Right click your account panel in the bottom left to view your profile in the current server",
|
||||||
|
authors: [Devs.Nuckyz, Devs.relitrix],
|
||||||
|
settings,
|
||||||
|
|
||||||
|
patches: [
|
||||||
|
{
|
||||||
|
find: ".Messages.ACCOUNT_SPEAKING_WHILE_MUTED",
|
||||||
|
group: true,
|
||||||
|
replacement: [
|
||||||
|
{
|
||||||
|
match: /(?<=\.SIZE_32\)}\);)/,
|
||||||
|
replace: "$self.useAccountPanelRef();"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
match: /(\.AVATAR,children:.+?renderPopout:(\i)=>){(.+?)}(?=,position)(?<=currentUser:(\i).+?)/,
|
||||||
|
replace: (_, rest, popoutProps, originalPopout, currentUser) => `${rest}$self.UserProfile({popoutProps:${popoutProps},currentUser:${currentUser},originalPopout:()=>{${originalPopout}}})`
|
||||||
|
},
|
||||||
|
{
|
||||||
|
match: /\.AVATAR,children:.+?(?=renderPopout:)/,
|
||||||
|
replace: "$&onRequestClose:$self.onPopoutClose,"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
match: /(?<=.avatarWrapper,)/,
|
||||||
|
replace: "ref:$self.accountPanelRef,onContextMenu:$self.openAccountPanelContextMenu,"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
get accountPanelRef() {
|
||||||
|
return accountPanelRef;
|
||||||
|
},
|
||||||
|
|
||||||
|
useAccountPanelRef() {
|
||||||
|
useEffect(() => () => {
|
||||||
|
accountPanelRef.current = null;
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (accountPanelRef = useRef(null));
|
||||||
|
},
|
||||||
|
|
||||||
|
openAccountPanelContextMenu(event: React.UIEvent) {
|
||||||
|
ContextMenuApi.openContextMenu(event, AccountPanelContextMenu);
|
||||||
|
},
|
||||||
|
|
||||||
|
onPopoutClose() {
|
||||||
|
openAlternatePopout = false;
|
||||||
|
},
|
||||||
|
|
||||||
|
UserProfile: ErrorBoundary.wrap(({ popoutProps, currentUser, originalPopout }: UserProfileProps) => {
|
||||||
|
if (
|
||||||
|
(settings.store.prioritizeServerProfile && openAlternatePopout) ||
|
||||||
|
(!settings.store.prioritizeServerProfile && !openAlternatePopout)
|
||||||
|
) {
|
||||||
|
return originalPopout();
|
||||||
|
}
|
||||||
|
|
||||||
|
const currentChannel = getCurrentChannel();
|
||||||
|
if (currentChannel?.getGuildId() == null) {
|
||||||
|
return originalPopout();
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={styles.accountProfilePopoutWrapper}>
|
||||||
|
<UserProfile {...popoutProps} userId={currentUser.id} guildId={currentChannel.getGuildId()} channelId={currentChannel.id} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}, { noop: true })
|
||||||
|
});
|
|
@ -88,7 +88,7 @@ export const userContextPatch: NavContextMenuPatchCallback = (children, { user }
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "BiggerStreamPreview",
|
name: "BiggerStreamPreview",
|
||||||
description: "This plugin allows you to enlarge stream previews",
|
description: "This plugin allows you to enlarge stream previews",
|
||||||
authors: [Devs.philhk],
|
authors: [Devs.phil],
|
||||||
contextMenus: {
|
contextMenus: {
|
||||||
"user-context": userContextPatch,
|
"user-context": userContextPatch,
|
||||||
"stream-context": streamContextPatch
|
"stream-context": streamContextPatch
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
import "./styles.css";
|
import "./styles.css";
|
||||||
|
|
||||||
import ErrorBoundary from "@components/ErrorBoundary";
|
import ErrorBoundary from "@components/ErrorBoundary";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs, EquicordDevs } from "@utils/constants";
|
||||||
import definePlugin from "@utils/types";
|
import definePlugin from "@utils/types";
|
||||||
|
|
||||||
import VoiceActivityIcon from "./components/VoiceActivityIcon";
|
import VoiceActivityIcon from "./components/VoiceActivityIcon";
|
||||||
|
@ -29,7 +29,7 @@ import { VoiceActivityProps } from "./types";
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "UserVoiceShow",
|
name: "UserVoiceShow",
|
||||||
description: "Shows users' voice activity information in profiles and members lists",
|
description: "Shows users' voice activity information in profiles and members lists",
|
||||||
authors: [Devs.LordElias, Devs.llytz],
|
authors: [Devs.LordElias, EquicordDevs.llytz],
|
||||||
tags: ["voice", "activity"],
|
tags: ["voice", "activity"],
|
||||||
settings,
|
settings,
|
||||||
|
|
||||||
|
|
|
@ -321,8 +321,8 @@ export const Devs = /* #__PURE__*/ Object.freeze({
|
||||||
name: "amia",
|
name: "amia",
|
||||||
id: 142007603549962240n
|
id: 142007603549962240n
|
||||||
},
|
},
|
||||||
philhk: {
|
phil: {
|
||||||
name: "philhk",
|
name: "phil",
|
||||||
id: 305288513941667851n
|
id: 305288513941667851n
|
||||||
},
|
},
|
||||||
ImLvna: {
|
ImLvna: {
|
||||||
|
@ -523,7 +523,7 @@ export const Devs = /* #__PURE__*/ Object.freeze({
|
||||||
},
|
},
|
||||||
nyx: {
|
nyx: {
|
||||||
name: "verticalsync",
|
name: "verticalsync",
|
||||||
id: 1207087393929171095n
|
id: 328165170536775680n
|
||||||
},
|
},
|
||||||
nekohaxx: {
|
nekohaxx: {
|
||||||
name: "nekohaxx",
|
name: "nekohaxx",
|
||||||
|
@ -557,9 +557,9 @@ export const Devs = /* #__PURE__*/ Object.freeze({
|
||||||
name: "Lumap",
|
name: "Lumap",
|
||||||
id: 585278686291427338n,
|
id: 585278686291427338n,
|
||||||
},
|
},
|
||||||
llytz: {
|
Obsidian: {
|
||||||
name: "llytz",
|
name: "Obsidian",
|
||||||
id: 1271128098301022240n
|
id: 683171006717755446n,
|
||||||
},
|
},
|
||||||
SerStars: {
|
SerStars: {
|
||||||
name: "SerStars",
|
name: "SerStars",
|
||||||
|
@ -569,9 +569,9 @@ export const Devs = /* #__PURE__*/ Object.freeze({
|
||||||
name: "niko",
|
name: "niko",
|
||||||
id: 341377368075796483n,
|
id: 341377368075796483n,
|
||||||
},
|
},
|
||||||
Obsidian: {
|
relitrix: {
|
||||||
name: "Obsidian",
|
name: "Relitrix",
|
||||||
id: 683171006717755446n,
|
id: 423165393901715456n,
|
||||||
},
|
},
|
||||||
RamziAH: {
|
RamziAH: {
|
||||||
name: "RamziAH",
|
name: "RamziAH",
|
||||||
|
@ -791,7 +791,11 @@ export const EquicordDevs = Object.freeze({
|
||||||
bep: {
|
bep: {
|
||||||
name: "bep",
|
name: "bep",
|
||||||
id: 0n,
|
id: 0n,
|
||||||
}
|
},
|
||||||
|
llytz: {
|
||||||
|
name: "llytz",
|
||||||
|
id: 1271128098301022240n
|
||||||
|
},
|
||||||
} satisfies Record<string, Dev>);
|
} satisfies Record<string, Dev>);
|
||||||
|
|
||||||
// iife so #__PURE__ works correctly
|
// iife so #__PURE__ works correctly
|
||||||
|
|
Loading…
Add table
Reference in a new issue