From a25f0fadfb6cbb58fc7da15612a63a37ce42a0c6 Mon Sep 17 00:00:00 2001 From: MasterPepe <56143265+Accentaro@users.noreply.github.com> Date: Thu, 16 Apr 2026 01:09:00 +0100 Subject: [PATCH] Fix HideChatButtons interop with CollapsibleUI (#975) Co-authored-by: thororen1234 <78185467+thororen1234@users.noreply.github.com> Co-authored-by: creations --- src/equicordplugins/hideChatButtons/index.tsx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/equicordplugins/hideChatButtons/index.tsx b/src/equicordplugins/hideChatButtons/index.tsx index 5f19fe715..2a942ecd5 100644 --- a/src/equicordplugins/hideChatButtons/index.tsx +++ b/src/equicordplugins/hideChatButtons/index.tsx @@ -8,7 +8,7 @@ import { ChatBarButton } from "@api/ChatButtons"; import { definePluginSettings } from "@api/Settings"; import { EquicordDevs } from "@utils/constants"; import definePlugin, { OptionType, StartAt } from "@utils/types"; -import { React, useEffect, useState } from "@webpack/common"; +import { useEffect, useState } from "@webpack/common"; import type { MouseEventHandler, ReactNode } from "react"; let hidechatbuttonsopen: boolean | undefined; @@ -50,8 +50,14 @@ function HideToggleButton(props: { open: boolean | undefined, onClick: MouseEven ); } -function ButtonsInnerComponent({ buttons }: { buttons: ReactNode[]; }) { - if (!buttons || buttons.every(x => (x as any)?.props?.disabled === true)) return null; +function ButtonsInnerComponent({ buttons }: { buttons: ReactNode; }) { + const buttonItems = Array.isArray(buttons) + ? buttons + : buttons == null + ? [] + : [buttons]; + + if (buttonItems.length === 0 || buttonItems.every(button => (button as any)?.props?.disabled === true)) return null; const [open, setOpen] = useState(hidechatbuttonsopen); @@ -66,7 +72,7 @@ function ButtonsInnerComponent({ buttons }: { buttons: ReactNode[]; }) { overflowX: "auto", overflowY: "hidden" }}> - {open && buttons.map((b, i) => {b})} + {open && buttons} setOpen(!open)} open={open} /> ); @@ -87,7 +93,7 @@ export default definePlugin({ } ], startAt: StartAt.Init, - buttonsInner(buttons: ReactNode[]) { + buttonsInner(buttons: ReactNode) { return ; }, start() {