From 938bc9f34e047f813b8ec7601ee8d776160eb79e Mon Sep 17 00:00:00 2001 From: Wolfie <32025746+Wolfkid200444@users.noreply.github.com> Date: Sat, 22 Jun 2024 13:44:43 -0400 Subject: [PATCH] Fix HolyNotes (#6) * Fix HN * Remove Comments on code --- src/equicordplugins/holyNotes/NoteHandler.ts | 2 -- .../holyNotes/components/modals/NoteBookTab.tsx | 9 ++++++--- .../holyNotes/components/modals/RenderMessage.tsx | 6 +++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/equicordplugins/holyNotes/NoteHandler.ts b/src/equicordplugins/holyNotes/NoteHandler.ts index 01982693..d80f4282 100644 --- a/src/equicordplugins/holyNotes/NoteHandler.ts +++ b/src/equicordplugins/holyNotes/NoteHandler.ts @@ -144,8 +144,6 @@ export default new (class NoteHandler { const User = findByCode("tag", "isClyde"); - - for (const notebook in notebooks) for (const noteId in notebooks[notebook]) { const note = notebooks[notebook][noteId]; diff --git a/src/equicordplugins/holyNotes/components/modals/NoteBookTab.tsx b/src/equicordplugins/holyNotes/components/modals/NoteBookTab.tsx index c6561c63..672c04c0 100644 --- a/src/equicordplugins/holyNotes/components/modals/NoteBookTab.tsx +++ b/src/equicordplugins/holyNotes/components/modals/NoteBookTab.tsx @@ -5,7 +5,7 @@ */ import { classes } from "@utils/misc"; -import { findByProps } from "@webpack"; +import { findByCode } from "@webpack"; import { Button, Clickable, Menu, Popout, React } from "@webpack/common"; import { SvgOverFlowIcon } from "../icons/overFlowIcon"; @@ -20,8 +20,11 @@ export function NoteBookTabs({ tabs, selectedTabId, onSelectTab }: { tabs: strin const resizeObserverRef = React.useRef(null); const [show, setShow] = React.useState(false); - const { isNotNullish } = findByProps("isNotNullish"); - const { overflowIcon } = findByProps("overflowIcon"); + function isNotNullish(value) { + return value !== null && value !== undefined; + } + + const { overflowIcon } = findByCode("overflowIcon"); const handleResize = React.useCallback(() => { if (!tabBarRef.current) return; diff --git a/src/equicordplugins/holyNotes/components/modals/RenderMessage.tsx b/src/equicordplugins/holyNotes/components/modals/RenderMessage.tsx index ca51bcf5..37b589ec 100644 --- a/src/equicordplugins/holyNotes/components/modals/RenderMessage.tsx +++ b/src/equicordplugins/holyNotes/components/modals/RenderMessage.tsx @@ -6,7 +6,7 @@ import { classes } from "@utils/misc"; import { ModalProps } from "@utils/modal"; -import { findByCode, findByProps } from "@webpack"; +import { findByCode, findByCodeLazy, findByProps, findComponentByCodeLazy } from "@webpack"; import { Clipboard, ContextMenuApi, FluxDispatcher, Menu, NavigationRouter, React } from "@webpack/common"; import noteHandler from "../../NoteHandler"; @@ -26,11 +26,11 @@ export const RenderMessage = ({ fromDeleteModal: boolean; closeModal?: () => void; }) => { - const ChannelMessage = findByProps("ThreadStarterChatMessage").default; + const ChannelMessage = findComponentByCodeLazy("Message must not be a thread"); const { message, groupStart, cozyMessage } = findByProps("cozyMessage"); const User = findByCode("isClyde(){"); const Message = findByCode("isEdited(){"); - const Channel = findByProps("ChannelRecordBase").ChannelRecordBase; + const Channel = findByCodeLazy("computeLurkerPermissionsAllowList"); const [isHoldingDelete, setHoldingDelete] = React.useState(false);