From 4f57c7eded1eda58f9c6e98b877a1cda29055117 Mon Sep 17 00:00:00 2001 From: AutumnVN Date: Thu, 19 Oct 2023 04:54:35 +0700 Subject: [PATCH] betterNotes, userVoiceShow: fix padding issue (#1804) --- .../betterNotes/{index.ts => index.tsx} | 20 ++++++++++++++++++- .../components/VoiceChannelSection.css | 7 ++++--- src/plugins/userVoiceShow/index.tsx | 5 ++--- 3 files changed, 25 insertions(+), 7 deletions(-) rename src/plugins/betterNotes/{index.ts => index.tsx} (79%) diff --git a/src/plugins/betterNotes/index.ts b/src/plugins/betterNotes/index.tsx similarity index 79% rename from src/plugins/betterNotes/index.ts rename to src/plugins/betterNotes/index.tsx index d9c5b45c3..06c735504 100644 --- a/src/plugins/betterNotes/index.ts +++ b/src/plugins/betterNotes/index.tsx @@ -19,6 +19,9 @@ import { Settings } from "@api/Settings"; import { Devs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; +import { findByPropsLazy } from "@webpack"; + +const UserPopoutSectionCssClasses = findByPropsLazy("section", "lastSection"); export default definePlugin({ name: "BetterNotesBox", @@ -34,12 +37,20 @@ export default definePlugin({ match: /hideNote:.+?(?=[,}])/g, replace: "hideNote:true", } - }, { + }, + { find: "Messages.NOTE_PLACEHOLDER", replacement: { match: /\.NOTE_PLACEHOLDER,/, replace: "$&spellCheck:!Vencord.Settings.plugins.BetterNotesBox.noSpellCheck," } + }, + { + find: ".Messages.NOTE}", + replacement: { + match: /(\i)\.hideNote\?null/, + replace: "$1.hideNote?$self.patchPadding($1)" + } } ], @@ -56,5 +67,12 @@ export default definePlugin({ disabled: () => Settings.plugins.BetterNotesBox.hide, default: false } + }, + + patchPadding(e: any) { + if (!e.lastSection) return; + return ( +
+ ); } }); diff --git a/src/plugins/userVoiceShow/components/VoiceChannelSection.css b/src/plugins/userVoiceShow/components/VoiceChannelSection.css index 0cf8701fc..00ecf5d41 100644 --- a/src/plugins/userVoiceShow/components/VoiceChannelSection.css +++ b/src/plugins/userVoiceShow/components/VoiceChannelSection.css @@ -1,4 +1,4 @@ -.vc-uvs-button > div { +.vc-uvs-button>div { white-space: normal !important; } @@ -21,6 +21,7 @@ margin-bottom: 0 !important; } -.vc-uvs-popout-margin > [class^="section"] { - margin-top: -12px; +.vc-uvs-popout-margin-self>[class^="section"] { + padding-top: 0; + padding-bottom: 12px; } diff --git a/src/plugins/userVoiceShow/index.tsx b/src/plugins/userVoiceShow/index.tsx index 9d8730b80..85c1bedf1 100644 --- a/src/plugins/userVoiceShow/index.tsx +++ b/src/plugins/userVoiceShow/index.tsx @@ -20,14 +20,13 @@ import { definePluginSettings } from "@api/Settings"; import ErrorBoundary from "@components/ErrorBoundary"; import { Devs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; -import { findByPropsLazy, findStoreLazy } from "@webpack"; +import { findStoreLazy } from "@webpack"; import { ChannelStore, GuildStore, UserStore } from "@webpack/common"; import { User } from "discord-types/general"; import { VoiceChannelSection } from "./components/VoiceChannelSection"; const VoiceStateStore = findStoreLazy("VoiceStateStore"); -const UserPopoutSectionCssClasses = findByPropsLazy("section", "lastSection"); const settings = definePluginSettings({ showInUserProfileModal: { @@ -88,7 +87,7 @@ export default definePlugin({ patchPopout: ({ user }: UserProps) => { const isSelfUser = user.id === UserStore.getCurrentUser().id; return ( -
+
);