diff --git a/src/components/settings/tabs/BaseTab.tsx b/src/components/settings/tabs/BaseTab.tsx index b4c0ebb53..17a2e8025 100644 --- a/src/components/settings/tabs/BaseTab.tsx +++ b/src/components/settings/tabs/BaseTab.tsx @@ -16,9 +16,10 @@ * along with this program. If not, see . */ +import { BaseText } from "@components/BaseText"; import ErrorBoundary from "@components/ErrorBoundary"; import { handleComponentFailed } from "@components/handleComponentFailed"; -import { ModalCloseButton, ModalContent, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal"; +import { ModalCloseButton, ModalContent, ModalHeader, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal"; import { onlyOnce } from "@utils/onlyOnce"; import type { ComponentType, PropsWithChildren } from "react"; @@ -43,13 +44,17 @@ export function wrapTab(component: ComponentType, tab: string) { export function openSettingsTabModal(Tab: ComponentType) { try { openModal(wrapTab((modalProps: ModalProps) => ( - + + + {Tab.displayName?.replace("SettingsTab", "") || "Settings"} + + + - - ), Tab.displayName || "Settings Tab")); + ), Tab.displayName || "SettingsTab")); } catch { handleSettingsTabError(); } diff --git a/src/components/settings/tabs/styles.css b/src/components/settings/tabs/styles.css index f28bc39db..318bb3215 100644 --- a/src/components/settings/tabs/styles.css +++ b/src/components/settings/tabs/styles.css @@ -90,10 +90,10 @@ height: 1.25em; } -.vc-settings-modal { - padding: 1.5em !important; +.vc-settings-modal-root { + background: var(--background-base-low); } -.vc-settings-modal-close { - float: right; +.vc-settings-modal { + padding-bottom: 1em; } \ No newline at end of file diff --git a/src/plugins/accountPanelServerProfile/index.tsx b/src/plugins/accountPanelServerProfile/index.tsx index dad81c7bb..b1d83037d 100644 --- a/src/plugins/accountPanelServerProfile/index.tsx +++ b/src/plugins/accountPanelServerProfile/index.tsx @@ -80,7 +80,7 @@ export default definePlugin({ group: true, replacement: [ { - match: /(\.AVATAR,children:.+?renderPopout:\(?(\i)(?:,\i\))?=>){(.+?)}(?=,position)(?<=currentUser:(\i).+?)/, + match: /(\.AVATAR,children:.+?renderPopout:\((\i),\i\)=>)\{(.+?)\}(?=,position)(?<=currentUser:(\i).+?)/, replace: (_, rest, popoutProps, originalPopout, currentUser) => `${rest}$self.UserProfile({popoutProps:${popoutProps},currentUser:${currentUser},originalRenderPopout:()=>{${originalPopout}}})` }, { diff --git a/src/plugins/messageLogger/index.tsx b/src/plugins/messageLogger/index.tsx index b54e70226..0c550964a 100644 --- a/src/plugins/messageLogger/index.tsx +++ b/src/plugins/messageLogger/index.tsx @@ -132,7 +132,7 @@ const patchMessageContextMenu: NavContextMenuPatchCallback = ( mlDeleted: true, }); } else { - message.editHistory = []; + updateMessage(channel_id, id, { editHistory: [] }); } }} />, @@ -853,8 +853,8 @@ export default definePlugin({ replace: '$&$1.type==="MESSAGE_GROUP_DELETED"||', }, { - match: /(\i).type===\i\.\i\.MESSAGE_GROUP_BLOCKED\?.*?:/, - replace: '$&$1.type==="MESSAGE_GROUP_DELETED"?$self.DELETED_MESSAGE_COUNT:', + match: /(\i).type===\i\.\i\.MESSAGE_GROUP_BLOCKED\?(\i)=.*?:/, + replace: '$&$1.type==="MESSAGE_GROUP_DELETED"?$2=$self.DELETED_MESSAGE_COUNT:', }, ], predicate: () => settings.store.collapseDeleted, diff --git a/src/plugins/viewRaw/index.tsx b/src/plugins/viewRaw/index.tsx index 212ea4e49..90751f8ff 100644 --- a/src/plugins/viewRaw/index.tsx +++ b/src/plugins/viewRaw/index.tsx @@ -16,7 +16,7 @@ * along with this program. If not, see . */ -import { NavContextMenuPatchCallback } from "@api/ContextMenu"; +import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu"; import { definePluginSettings } from "@api/Settings"; import { BaseText } from "@components/BaseText"; import { CodeBlock } from "@components/CodeBlock"; @@ -125,31 +125,36 @@ const settings = definePluginSettings({ { label: "Left Click to view the raw content.", value: "Left", default: true }, { label: "Right click to view the raw content.", value: "Right" } ] + }, + messageContextMenu: { + description: "Show in message context menu", + type: OptionType.BOOLEAN, + default: false } }); -function MakeContextCallback(name: "Guild" | "Role" | "User" | "Channel"): NavContextMenuPatchCallback { +function MakeContextCallback(name: "Guild" | "Role" | "User" | "Channel" | "Message"): NavContextMenuPatchCallback { return (children, props) => { const value = props[name.toLowerCase()]; if (!value) return; if (props.label === getIntlMessage("CHANNEL_ACTIONS_MENU_LABEL")) return; // random shit like notification settings + const isMessage = name === "Message"; + if (isMessage && !settings.store.messageContextMenu) return; - const lastChild = children.at(-1); - if (lastChild?.key === "developer-actions") { - const p = lastChild.props; - if (!Array.isArray(p.children)) - p.children = [p.children]; - - children = p.children; - } // typescript parser goes crazy if this is inline const id = `vc-view-${name.toLowerCase()}-raw`; - children.splice(-1, 0, + const action = isMessage + ? () => openViewRawModalMessage(value) + : () => openViewRawModal(JSON.stringify(value, null, 4), name); + + const devContainer = findGroupChildrenByChildId(`devmode-copy-id-${value.id}`, children); + + (devContainer ?? children).splice(-1, 0, openViewRawModal(JSON.stringify(value, null, 4), name)} + action={action} icon={CopyIcon} /> ); @@ -188,7 +193,8 @@ export default definePlugin({ "thread-context": MakeContextCallback("Channel"), "gdm-context": MakeContextCallback("Channel"), "user-context": MakeContextCallback("User"), - "dev-context": devContextCallback + "dev-context": devContextCallback, + "message": MakeContextCallback("Message"), }, messagePopoverButton: {