mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-01-09 09:26:22 +00:00
Merge branch 'dev' into immediate-finds
This commit is contained in:
commit
3a314bf94c
3 changed files with 20 additions and 11 deletions
|
@ -92,7 +92,7 @@ export function removeGlobalContextMenuPatch(patch: GlobalContextMenuPatchCallba
|
|||
* @param children The context menu children
|
||||
* @param matchSubstring Whether to check if the id is a substring of the child id
|
||||
*/
|
||||
export function findGroupChildrenByChildId(id: string | string[], children: Array<ReactElement | null>, matchSubstring = false): Array<ReactElement | null> | null {
|
||||
export function findGroupChildrenByChildId(id: string | string[], children: Array<ReactElement | null | undefined>, matchSubstring = false): Array<ReactElement | null | undefined> | null {
|
||||
for (const child of children) {
|
||||
if (child == null) continue;
|
||||
|
||||
|
|
|
@ -19,13 +19,21 @@
|
|||
import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu";
|
||||
import { migratePluginSettings } from "@api/Settings";
|
||||
import { Devs } from "@utils/constants";
|
||||
import { NoopComponent } from "@utils/react";
|
||||
import definePlugin from "@utils/types";
|
||||
import { findComponentByCode, findProp } from "@webpack";
|
||||
import { ChannelStore, Clipboard, ContextMenuApi, i18n, Menu, UserStore } from "@webpack/common";
|
||||
import { filters, findProp, waitFor } from "@webpack";
|
||||
import { ChannelStore, ContextMenuApi, i18n, UserStore } from "@webpack/common";
|
||||
import { Message } from "discord-types/general";
|
||||
|
||||
const useMessageMenu = findProp("useMessageMenu");
|
||||
const IdIcon = findComponentByCode("M15.3 14.48c-.46.45-1.08.67-1.86.67h");
|
||||
|
||||
interface CopyIdMenuItemProps {
|
||||
id: string;
|
||||
label: string;
|
||||
}
|
||||
|
||||
let CopyIdMenuItem: (props: CopyIdMenuItemProps) => React.ReactElement | null = NoopComponent;
|
||||
waitFor(filters.componentByCode('"devmode-copy-id-".concat'), m => CopyIdMenuItem = m);
|
||||
|
||||
function MessageMenu({ message, channel, onHeightUpdate }) {
|
||||
const canReport = message.author &&
|
||||
|
@ -54,17 +62,17 @@ function MessageMenu({ message, channel, onHeightUpdate }) {
|
|||
});
|
||||
}
|
||||
|
||||
const contextMenuPatch: NavContextMenuPatchCallback = (children, props) => {
|
||||
interface MessageActionsProps {
|
||||
message: Message;
|
||||
isFullSearchContextMenu?: boolean;
|
||||
}
|
||||
|
||||
const contextMenuPatch: NavContextMenuPatchCallback = (children, props: MessageActionsProps) => {
|
||||
if (props?.isFullSearchContextMenu == null) return;
|
||||
|
||||
const group = findGroupChildrenByChildId("devmode-copy-id", children, true);
|
||||
group?.push(
|
||||
<Menu.MenuItem
|
||||
id={`devmode-copy-id-${props.message.author.id}`}
|
||||
label={i18n.Messages.COPY_ID_AUTHOR}
|
||||
action={() => Clipboard.copy(props.message.author.id)}
|
||||
icon={IdIcon}
|
||||
/>
|
||||
CopyIdMenuItem({ id: props.message.author.id, label: i18n.Messages.COPY_ID_AUTHOR })
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@ export default definePlugin({
|
|||
name: "UserVoiceShow",
|
||||
description: "Shows an indicator when a user is in a Voice Channel",
|
||||
authors: [Devs.Nuckyz, Devs.LordElias],
|
||||
dependencies: ["MemberListDecoratorsAPI", "MessageDecorationsAPI"],
|
||||
settings,
|
||||
|
||||
patches: [
|
||||
|
|
Loading…
Reference in a new issue